Coupling STASH variables

It's clear that the list of chemistry and aeorosol fields which need sending from the Junior UM to the Senior UM is a long and likely to be an ever changing list. Consequently, we probably require a method of creating the namcouple file on the fly. The page outlines how I've done this.

Information required

The namcouple files requires

  1. a list of the fields to couple with model_level levels
  2. a list of the fields to couple with (model_level+1) levels
  3. the resolution of the Senior and Junior UMs
  4. which fields require the EXPOUT argument and which require the EXPORTED argument
  5. which fields require the remapping file to be created

The top two items in the list are required by UMs as well as the namcouple file, but the last three items are not needed by the UM code. This is why I've decided to created a hybrid file, STASH_CPL_HYBRID, where the information for the top two items are stored in namelist arrays - while the other information is stored after the `#' symbol and `grep -v "#"' can easily be used to remove this and leave the namelist. An example of this file is shown below

# This file contains both the namlist STASH_CPL and information
# only wanted by ~mstringe/cgi-bin/namcouple/create_namcouple.pl.
# Use line below to specify which fields should use the EXPOUT
# command, options are `all', `none' or specifying specific fields
# expout: Thet
# rmpCreate: none
&CODES_CPL
  CPL_CODES = 34162, 34163,
              38401, 38402, 38403, 38404, 38405,
              38408, 38409, 38410,
              38411,
              38431, 38432, 38433, 38434,
              38446, 38447, 38448, 38450,
              38451, 38452, 38453, 38454,
              38457, 38458, 38459, 38460,
              38461, 38464, 38465,
              38466
  CPL_XL_CODES = 34101, 34102, 34103, 34104, 34105,
                 34106, 34107, 34108, 34109, 34110,
                 34111, 34113, 34114, 34115,
                 34116, 34117, 34119, 34120,
                 34121, 
                 34126
&END 
# Senior resolution: 96
# Junior resolution: 96


The namelist STASH_CPL

The namelist STASH_CPL can be created simply with the command

$ grep -v "#" STASH_CPL_HYBRID > STASH_CPL

From the above it can be seen that leaves the namelist CODES_CPL with the two arrays CPL_CODES and CPL_XL_CODES. Fortunately, all the UKCA fields are held on theta levels, and so the only variation between the fields should be the number of levels - some fields will have model_levels levels (these are contained in CPL_CODES) and some will have (model_levels + 1) levels (these are contained in CPL_XL_CODES, where XL stands for eXtra Level).

This namelist is read in by the UM in the newly created routine OASIS_STASH_CPL. It is also ready by the perl code which creates the namcouple file.

Creating namcouple file

The namcouple file is created using the perl code on the HPC, which is contained in /home/cr/ukesm/mstringe/cgi-bin/namcouple. An example of running this code is shown below

perl create_namcouple.pl /home/cr/ukesm/mstringe/umui_runs/cakdc_cakdc-061094034/STASH_CPL_HYBRID

which should produces a file called nam_temp. The fields passed should include all the stash fields in CPL_CODES and CPL_XL_CODES, where the fields in CPL_CODES should have 85 levels and the fields in CPL_XL_CODES should have 86 levels.

There should also be the fields Uvel (u-velocity), Vvel (v-velocity) and Thet (potential temperature) and possibly others.

The resolutions of the senior and junior UM are picked up from the arguments following `# Senior resolution:' and `# Junior resolution:'. These two lines are added to a base STASH_CPL_HYBRID file by coupleJobs.scr, once coupleJobs.scr has determined what the resolution of the senior and junior UM are.

The EXPORTED argument will be used for all the fields unless the field appears as an argument following `# expout:', when the EXPOUT argument will be used. In the example above the only field where EXPOUT netCDF files will be produced from OASIS is the Thet (potential temperature) field.

Similarly, it is assumed that remapping fields already exist for all fields and don't need creating unless the field appears as an argument following `# rmpCreate:'. No fields are present in the example file above.