Reorganizing the handling of constants in MOM6 #1379
Replies: 6 comments
-
Since I don't have permission to assign anyone or label this, I am mentioning @adcroft @Hallberg-NOAA @marshallward @gustavo-marques |
Beta Was this translation helpful? Give feedback.
-
Point (1) seems very reasonable and is a design goal, since But having said that, the only other references I can see to On my branch:
and most of those are false positives. Is this something more specific to the NCAR fork? Or am I searching for the wrong thing? |
Beta Was this translation helpful? Give feedback.
-
You are right. I was searching in the wrong directory. Upon closer review, it looks like there are two fundamental differences in handling of constants in MOM6 vs CESM.
So I am not sure how it would be viable to coordinate these two approaches at this point. Regardless of coordination, some issues I noticed due to decentralized constants approach in MOM6:
|
Beta Was this translation helpful? Give feedback.
-
Totally agree @alperaltuntas . I have a pending PR which addresses this in MOM_oda_driver. |
Beta Was this translation helpful? Give feedback.
-
By "constants" do you mean model parameters or do you mean physical constants like the speed of light in a vacuum? There are very few real constants used in an ocean model (I'm struggling to think of more than one right now - see below). I think the need to coordinate values for run-time parameters between components in a coupled system is worth addressing. Right now, requiring the parameters to be consistent involves scripting outside of MOM. The way parameters are handled appears to be distributed but in fact is not - generally one processor reads the parameter file. It appears to be distributed because any module can access a parameter but to do so it must define it consistently - there is a runtime warning if it is inconsistent. I think we could evolve what is called the "file parser" to treat parameters more dynamically so that a Concerning the parameters you've mentioned:
Concerning the three numbers in MOM_constants.F90:
|
Beta Was this translation helpful? Give feedback.
-
Thanks, Alistair! Let's talk more about this in an upcoming dev call. |
Beta Was this translation helpful? Give feedback.
-
Within the CESM framework, we would like to use the constants from CIME which are shared by all other CESM components, instead of the constant values set by FMS. See:
https://github.com/ESMCI/cime/blob/master/src/share/util/shr_const_mod.F90
Handling of constants in MOM6 code makes this a bit challenging.
In MOM6, there is a
MOM_constants
module with only three constants, two of which is directly imported from the FMS'sconstants_mod
module (that areHLV
andHLF
). In the rest of the code, about 20 other constants from FMS'sconstants_mod
are imported in multiple MOM6 modules.Here is my suggestion:
(1)
MOM_constants
module should be the sole interface between FMS'sconstants_mod
module and MOM6. In other words, all FMS constants should be imported byMOM_constants
first. Then, other MOM6 modules should import those constants fromMOM_constants
.(2) Move
MOM_constants
module to the cap level (i.e.,config_src
). This would allow, say, CESM to override the FMS constants with the constants obtained from CIME's shared constants module.If the above plan sounds good, and unless someone has a better suggestion to achieve this, I am happy to take on and implement the above two changes in NCAR fork.
Beta Was this translation helpful? Give feedback.
All reactions