NCAR / ccpp-framework

Common Community Physics Package (CCPP)
http://www.dtcenter.org/community-code/common-community-physics-package-ccpp/
Other
26 stars 63 forks source link

Need plan for implementing process and time-split physics in capgen #467

Open nusbaume opened 1 year ago

nusbaume commented 1 year ago

Description

It is still a little unclear how capgen should formally manage process-split versus time-split physics in a way that is relatively seamless for the user (i.e. doesn't require a large number of manually-added interstitial schemes). The hope is that this issue can be a place to discuss what an agreed-upon solution should be.

Solution

The current plan, as suggested by @gold2718, is:

Post processing for scheme in time split sequence: For every output variable (intent(out) or intent(inout)) variable with the name, tendency_of_X, look to see if the scheme has an input-only variable, X. For each such X, update it with tendency_of_X.

Post processing for scheme in process split sequence: (Note, this might not work because to set up a process-split sequence, we need to create temporaries for all "state variables" that are modified by schemes in the sequence. We also need to create a total_tendency_of_X variable for the sequence. One way to interpret a "state variable" is any variable that does not begin with "tendencyof". If that works, I think the scheme below works. Can you think of any counter examples?) For every output variable, X, add the difference between X and its initial value to the total_tendency_of_X for the sequence unless the scheme also produces a tendency_of_X output variable. Reset X to its initial value.

Alternatives (optional)

We could instead have new meta-data properties, such as state_variable, which specify how/when fields should be updated for a given physics scheme.

Related to (optional)

https://github.com/NCAR/atmospheric_physics/issues/36 https://github.com/NCAR/atmospheric_physics/issues/12

Also pinging @peverwhee