vancesteven / PlanetProfile

Construct 1D interior structure models based on planetary properties. Self-consistent thermodynamics are used for fluid, rock, and mineral phases. Sound speeds, attenuation, and electrical conductivities are computed as outputs.
https://vancesteven.github.io/PlanetProfile/
Other
18 stars 13 forks source link

Gridded runs use too much memory #49

Closed itsmoosh closed 2 years ago

itsmoosh commented 2 years ago

Currently, any of the functionality making use of ParPlanet to do gridded or parallel runs makes a deepcopy of the Planet class object in order to run each separately. The problem with this is that even though the EOS tables get reused from one PlanetProfile run to the next, which is fast since they are kept in memory, they get copied to each and every Planet class object that is deepcopy'd. This means that large lookup tables, especially for MgSO4 compositions, create prohibitively large grids of Planet class objects.

This configuration can be improved by finding a way to change the EOS subclasses to be references to the tables saved in the EOSlist dict, rather than being fully copied to the Planet class. That way, any fully reused table will take up no extra space in memory.

itsmoosh commented 2 years ago

Solved with commit https://github.com/vancesteven/PlanetProfile/commit/8197ee6fe25490bdb2cf21c767935012b4c648c2 -- implemented central storage of EOS functions, accessed by a wrapper saved to Planet.