Open ccarouge opened 2 months ago
The following set of comments provides a bit more information on this technical task.
The POP and POPLUC sub-models are written assuming that CABLE and CASA will operate on the same land points as POP - i.e. there is only ever (up to) 3 tiles per grid cell. Technically this assumption is manifest by the passing of entire CABLE/CASA TYPES into SUBROUTINEs and expecting that the land points align in all the variables. It is also inefficient in that large numbers of variables are being passed around for no purpose.
For example SUBROUTINE LUCdriver( casabiome, casapool, casaflux, POP, LUC_EXPT, POPLUC, veg)
passes the entirety of 7 TYPES around whereas only 7 fields in the CASA and veg TYPES are actually used.
For ACCESS3 we are likely to want to break this assumption - with CABLE/CASA operating with (up to) 17 (or perhaps 27) tiles per grid cell whereas POP retaining it's 3 tiles per grid cell structure. There are two high-level approaches to deal with this - Both of which require technical work within those routines that share CABLE/CASA and POP TYPES.
Considering the LUCdriver
case again - at the moment a broad overview of the CABLE-POP_TRENDY run sequence goes
Option 1 would look something like
then either for TRENDY
or for ACCESS
The advantages of this approach are that the code within the LUCdriver should be entirely unchanged and single definition points.
The disadvantages are i) efficiency/size of memory, ii) different CALLs depending on USE case, iii) likelihood that widespread tweaks will be needed because the same TYPE definition is used with different sizes, and iv) technical challenges of passing an additional set of fields through the MPI capability (if this needs to be maintained). There is also a risk that (since we would only ever map variables that are truly needed between the 3 and 17 tile versions) that unassigned variables get inadvertently used in future developments (the resulting code will be quite obscure)
Option 2 would look something like
The disadvantages of this approach are that i) the code within the LUCdriver would be changed (backwards compatibility?), ii) the number of mapCASAtoPOP() routines could end up being quite noticeable, and iii) that we could end up having to pass additional arguments through lots of layers of the code (if it turns out that it's important when in the cycle the temporary vars are set).
The advantages of this approach are i) efficiency, ii) identical CALLs across use cases, iii) this can sit on the worker side of the MPI code and iv) clarity of code.
Note that for a TRENDY run where x=3 by default the mapCASAtoPOP routines would simply assign the appropriate field from the TYPEs into the temporary_vars without any additional manipulation/model code
Assuming that we aim for option 2 above then we would look to ALLOCATE the TYPES (in ACCESS at least) according the primary model dimensions, i.e.
The offline initialisation code could be awkward since the TYPEs are interwoven (see load_params)
BLAZE science code will be awkward since the TYPEs are interwoven - especially adjust_pop_for_fire()
CASAONLY_LUC and spincasacnp will need CASAtoPOP interface routines included within then.
There are 6 (7) subroutines [outside of BLAZE] which option 2 would require the creation/assignment of temporary_vars under option 2
For the moment, we pass full TYPE structures around and that includes more than what is needed.
Need to review to pass around only the information necessary.
Required for the tile mapping.
ACCESS-NRI