Description
For some specific background, I'm currently working with code (CAM) that will call the MPAS-Atmosphere core's atm_core_run
method in a loop, and what I'd like to be able to do is to tell the atmosphere core how far to integrate in each call.
The central issue is that at present, each core's run method accepts just a single parameter, a domain_type
type, which doesn't have a place where the specification of a "run until" time can be provided. As potential solutions to this, I had thought of three possible solutions, some of which require modifications to shared code, and I was hoping to get some feedback on whether others would have any objections to the second two options, or a preference for either of the second two.
Option 1: We could just add a module variable to the MPAS-Atmosphere's atm_core
module to store the current "run until" time, and set this module variable through various means before each call to atm_core_run
. This option would certainly work, but as a design consideration I'd prefer to have the behavior of the atm_core_run
depend as much as possible on values provided through its argument list for clarity.
Option 2: We could add an MPAS_Time_type
optional argument to all cores's run methods. In the case of MPAS-Atmosphere, we would use this optional argument to specify the point to which the model should integrate on any particular invocation of the run method. Other cores could simply ignore this optional argument.
Option 3: A more forward-looking (IMHO, but also riskier) approach would be to allow cores to extend the domain_type
, and to have all shared code that accepts a domain_type
as an argument declare the dummy argument as
class (domain_type) :: domain
rather than the current declarations, which look like
type (domain_type) :: domain
Control over the allocation of the original domain type would need to be turned over to each core, so that, e.g., the atmosphere core could allocate the domain as some extension of the base domain class. In the case of MPAS-Atmosphere, the extended domain type could contain the MPAS_Time_type
that specifies a "run until" time, and the domain
argument to atm_core_run
would provide all that we need to have the MPAS-Atmosphere core integrate only to a specified point.
I've attached an example program to illustrate conceptually how the third option might look in MPAS. See domain_extension.F90.txt .
My current preference is for the second option, perhaps because it would require the least amount of work while satisfying my design preference for the atm_core_run
routine.