FormingWorlds / PROTEUS

Coupled atmosphere-interior framework to simulate the temporal evolution of rocky planets.
https://fwl-proteus.readthedocs.io
Apache License 2.0
11 stars 1 forks source link

Detangling input/output variables #111

Closed nichollsh closed 1 month ago

nichollsh commented 1 month ago

This PR makes a significant step towards reworking how PROTEUS handles variables. With this version, output variables are stored as a Pandas DataFrame (the helpfile, HF). However, this HF is no longer passed around to as many functions as before, and is never modified by them directly. Calls to submodules (e.g. SPIDER, JANUS) only return the variables which they have calculated, which are then used to update the current working row of the HF. Once an iteration of the model is completed, the new row is committed to the HF and the whole DataFrame is saved to a CSV file.

Similarly, the COUPLER_options dictionary now exclusively stores model input variables. These are never modified at runtime and are not returned from any functions other than when the configuration file is first read-in.

The model runs and reproduces the previous results, which is expected given that these modifications are not intended to modify any physics. However, the output columns of the helpfile have different names in some cases, so this may break analysis or post-processing scripts written externally to the code itself.

Closes #95.

Other changes:

nichollsh commented 1 month ago

Next step after this will be to merge my resume branch, which includes functionality for resuming the simulation from the disk. https://github.com/FormingWorlds/PROTEUS/tree/resume

nichollsh commented 1 month ago

Thanks Tim! I agree it's hard to tell through all of the changes but it does seem to reproduce the same results as before for the pure-steam Earth example case.

We should think about adding some tests.