-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add structure(s) to iterate over all state variables #282
Comments
I envision the definition of "state variable" being tied to whether it's needed on the restart file. A nice benefit of this definition is that we have automated tests (ERS, etc.) that make sure that all variables that should be on the restart file truly are on the restart file. Thus, before we tackle this project, it's probably worth doing some initial cleanup:
|
Note to self: See the following evernote entries (sorry that this isn't useful to others; maybe I'll incorporate some relevant notes from these Evernote documents into this issue at some point): - "Making state updates more maintainable" (evernote:///view/1172113975/s44/12e24a30-a72b-49a1-a0bd-2a9c47a067c5/12e24a30-a72b-49a1-a0bd-2a9c47a067c5/) - "CLM redesign ideas" (evernote:///view/1172113975/s44/13c5d9e4-9cfc-4493-a9f2-b04c7eea4305/13c5d9e4-9cfc-4493-a9f2-b04c7eea4305/) (February 11, 2016 notes) - "Handling CLM's restart variables more like history variables" (evernote:///view/1172113975/s44/fea9c49a-c6bf-4b43-8ac5-d1e13ad06b46/fea9c49a-c6bf-4b43-8ac5-d1e13ad06b46/) |
@billsacks -- this is very useful. I think it is desirable to (1) be more precise about the variable type (state variable, diagnostic variable, flux, parameter, etc.) and (2) have the capability to loop over all variable types. This is useful for fluxes, for example, when there is a need to calculate the time-step average from multiple flux calls. In short, I think that the need to loop over state variables extends to other variable types also. |
carbon balance fix
I started thinking about this more when looking back at code like this for harvest: CTSM/src/biogeochem/dynHarvestMod.F90 Lines 336 to 342 in 5cc4ede
and similar code in a module on the TRENDY branch, An important goal in software design is that different aspects should be orthogonal, so that if you want to change one aspect of the code, you only need to make the change in one place. With our current code structure, adding a new state variable often requires many changes, including to code like the above that is doing some operation on all state variables of a certain type. This makes it much more difficult and error-prone to change the model. I feel it would help to have the ability to loop through state variables, perhaps separated on a few basic characteristics - e.g., letting you loop through all soil BGC variables, all vegetation BGC variables, etc. There are a lot of details that would need to be worked out, like how to associate a flux with a given state variable, but I feel that something like this could be very helpful long-term as the model gets more and more complex. |
I'm 100% behind this, if you can make it work @billsacks ! |
Thanks @wwieder . This is an ambitious issue, so I don't expect to tackle it any time soon.... |
I was randomly giving this issue a bit of thought recently. A few thoughts:
|
There are a number of times when we need to iterate over all state variables (i.e., variables with some persistent memory from one timestep to another), or some large subset of them. This includes:
restart
adjustments for transient PFT weights
adjustments for transient column / landunit weights
adjustments for fire
As well as some possible future needs:
Ability to expand / contract memory for dynamic landunits? (rather than pre-allocating everything we need up front)
Dynamic load balancing?
Code related to these things would be more maintainable if we had the ability to iterate over all state variables, or the subset of state variables that met some criteria.
The text was updated successfully, but these errors were encountered: