mcgibbon / sympl

A toolkit for building planetary/Earth system models in Python
http://sympl.readthedocs.io
Other
50 stars 14 forks source link

Support for different condensible compounds #12

Closed mcgibbon closed 6 years ago

mcgibbon commented 6 years ago

Planetary modeling often requires condensible compounds other than water to be used, but we want to support interoperability between components written by planetary modelers and Earth modelers. We'll do this as follows:

JoyMonteiro commented 6 years ago

Just to clarify "by default, the generic names (such as vapor_phase) will be aliased to water" -- Does this mean changing heat_capacity_of_vapor_phase_at_constant_pressure will change heat_capacity_of_water_vapor_at_constant_pressure?

mcgibbon commented 6 years ago

Yes, it does.

mcgibbon commented 6 years ago

I'm thinking we should make a custom internal AliasDict class which implements this functionality, so that user code which directly accesses default_constants will also have this behavior.

mcgibbon commented 6 years ago

And/or we should remove default_constants from the public API, and have users use set_constant and get_constant functions to access constants. Actually I lean more towards this option.

JoyMonteiro commented 6 years ago

I agree that default_constants must be removed. Having two possibly incompatible ways of setting constants is just asking for trouble. OTOH, sympl does not have any way of listing what constants are available, and this will pose a problem if you want to set anything.

mcgibbon commented 6 years ago

Well, with a custom AliasDict class, the two ways of setting and getting constants would be entirely compatible. The list of available constants should be in the documentation. We could also write a function list_constants which does this, or something like your CliMT function which prints out all of the constants and their values.

JoyMonteiro commented 6 years ago

If they are compatible, I suggest keep it accessible. There must be some way for packages building on top of sympl to access default_constants (my code would break if it disappeared)

mcgibbon commented 6 years ago

Closed by #20, though we could still use some more constants to be set for different condensibles.