UKCA & UMUI Tutorial 9
- 1 Adding New UKCA Diagnostics
- 2 Flux Definitions in asad_flux_dat.F90
- 3 STASHmaster file
- 4 Time Validity
- 5 Task 9.1: Output new diagnostics
Adding New UKCA Diagnostics
If you are using one of the chemistry schemes that uses ASAD (e.g. CheT/TropIsop, CheS/Strat, CheST/StratTrop) then you can make use of the ASAD Reaction Flux Diagnostics module (held in asad_chem_flux_diags.F90). These allow you to straight-forwardly output new reaction and deposition fluxes.
To output new diagnostics you will first need to define them in the asad_flux_dat.F90 module, and then create new STASHmaster file specifications for them.
During this tutorial you will be tasked with outputting the reaction and deposition fluxes that you have added in to your branch.
Flux Definitions in asad_flux_dat.F90
Within the asad_flux_dat.F90 module the diagnostics are defined in blocks with the format
asad_flux_defn('Diagnostic type',STASH code,'Diagnostic specification',Mask,Reaction number,Number of species, & (/'Species/Reactant 1','Reactant 2'/), & (/'Product 1','Product 2','Product 3','Product 4'/)), &
Which have the following meaning:
This is a three character string which defines what type of diagnostic is being requested. This can take the values
- RXN to output the flux through a reaction (in moles/gridcell/s)
- DEP to output the deposition flux of a species (in moles/gridcell/s)
- EMS to output the emission flux into a species (in moles/gridcell/s)
- NET to output the net chemical tendency of a species (in moles/gridcell/s)
- STE to output the net dynamical tendency of a species (in moles/gridcell/s)
- MAS to output the mass of the atmosphere (in kg/gridcell)
- PSC to output polar stratospheric cloud diagnostics (1 when the gridcell contains a PSC, 0 otherwise - monthly mean field will be a fraction in range 0 → 1)
- TPM to output the tropospheric mask (1 for troposphere, 0 otherwise - monthly mean field will be a fraction in range 0 → 1)
- OUT to output a tracer in mmr. Only really useful if the field is masked to give the tropospheric concentration only (see the discussion of the Mask option)
- RTE to output the rate of a reaction (in gridcell/s)
This is a 5 digit integer defining the STASH code that the diagnostic will be outputted to (e.g. 34301). Currently this must be in section 34.
This is a one character string which is needed to further define what diagnostic is required. If it isn't needed then it should just be set to X or left blank.
- B to output the flux through a bimolecular reaction
- T to output the flux through a termolecular reaction
- H to output the flux through a heterogeneous reaction
- J to output the flux through a photolysis reaction
- D to output the dry deposition flux
- W to output the wet deposition flux
- S to output a surface emission (2D)
- A to output aircraft emissions (3D)
- L to output lightning emissions (3D)
- V to output volcanic SO2 emissions (3D)
- T to output SO2 emissions (3D)
- 1 to output the fraction of Type 1 PSCs
- 2 to output the fraction of Type 2 PSCs
- B to output the rate of a bimolecular reaction
- T to output the rate of a termolecular reaction
- H to output the rate of a heterogeneous reaction
- J to output the rate of a photolysis reaction
This is a logical which defines whether only the tropospheric values of the diagnostic are outputted (.TRUE.) or not (.FALSE.). It is calculated every timestep.
For the STE diagnostic this is required if you wish to output the diagnosed stratosphere-troposphere exchange of a species. For the OUT diagnostic this can be used to output only the tropospheric concentration of a tracer. This is also used in the calculation of the of the TPM diagnostic.
This is an integer, and should only be used in the special case of there being two (or more) reactions with the exactly the same reactants and products, but with different rate coefficients. In this case the first reaction in the list would be given number 1 and the second 2 etc. If this is not needed then it should be set to 0 (which will be usual for most reactions).
Number of Species
This is an integer, and should give the total number of species, so this will be 1 for diagnostics such as DEP, STE, NET etc., which only consider a single species, and the total number of reactants and products for diagnostics RXN and RTE.
This is a 10-character string giving the exact name of the species that the diagnostic should be considered for (including capitalisation). This is only used for the DEP, EMS, NET, STE, and OUT. For the RXN and RTE diagnostics the full list of reactants and products should be given (see below). For the MAS, PSC, and TPM diagnostics this isn't needed and could either be set to XXX or left blank. If it is needed the other reactant/product slots should be left blank.
Reactants and Products
These are 10-character strings, and should be as the reaction is defined in the ukca_chem_scheme.F90 modules.
Addition of Diagnostics
If you define more than one diagnostic to be output to the same STASH code, then the diagnostic routines will sum these diagnostics together. This can be useful (e.g., if you wanted to output the sum of all NO+RO2 reactions to one STASH item), but can be problematic if you accidentally output two fields to the same STASH code, as this will give strange results!
Changes to asad_flux_dat.F90
After you have defined your new diagnostics at the top of this module, you will need to make sure that they have been added correctly to the asad_chemical_fluxes array, which is defined in the ASAD_LOAD_DEFAULT_FLUXES subroutine held in the asad_flux_dat.F90.
While the diagnostics are defined in asad_flux_dat.F90 they are turned on by requesting the item through STASH. To do this you will need to make a new STASHmaster file for diagnostics that you have defined yourself. The easiest option is to copy an existing diagnostic specification from the STASHmaster_A file, which is located at
on HECToR, and at
2D Diagnostic Fields
If you are outputting a 2D field such as a surface emission or a dry deposition field (e.g. you are using the old 2D dry deposition scheme) then the fact that this is a 2D surface field is defined in the STASHmaster entry, which looks like this e.g.
# 1| 1 | 34 | 321 |Ox BUDGET: O3 DRY DEPOSITION (2D) | 2| 0 | 0 | 1 | 1 | 5 | -1 | -1 | 0 | 0 | 0 | 0 | 3| 000000000000000000000000000000 | 00000000000000000001 | 3 | 4| 1 | 0 | -99 -99 -99 -99 -99 -99 -99 -99 -99 -99 | 5| 0 | 1871 | 1 | 129 | 0 | 0 | 0 | 0 | 0 | #
However, you can always output a surface diagnostic using a STASHmaster file that defines a 3D field, it is just that only the surface values will be non-zero (if the full field is output).
You will need to edit the two elements in red to match your new diagnostic.
3D Diagnostic Fields
A 3D diagnostic field has slightly different values for some of the elements of the STASHmaster definition. These can been seen by comparing the specification above with the one below
# 1| 1 | 34 | 321 |Ox BUDGET: O3 DRY DEPOSITION (3D) | 2| 0 | 0 | 1 | 1 | 2 | 10 | 11 | 0 | 0 | 0 | 0 | 3| 000000000000000000000000000000 | 00000000000000000001 | 3 | 4| 1 | 0 | -99 -99 -99 -99 -99 -99 -99 -99 -99 -99 | 5| 0 | 1871 | 0 | 65 | 0 | 0 | 0 | 0 | 0 | #
You will need to edit the two elements in red to match your new diagnostic.
STASHmaster file format
As well as defining the STASH items in your new user STASHmaster file, you will also need to include the correct preamble and an end of file specifier. These are
H1| SUBMODEL_NUMBER=1 H2| SUBMODEL_NAME=ATMOS H3| UM_VERSION=8.2 # #|Model |Sectn | Item |Name | #|Space |Point | Time | Grid |LevelT|LevelF|LevelL|PseudT|PseudF|PseudL|LevCom| #| Option Codes | Version Mask | Halo | #|DataT |DumpP | PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PCA | #|Rotate| PPF | USER | LBVC | BLEV | TLEV |RBLEVV| CFLL | CFFF | #
which is also helpful in describing what the elements in the STASH specification are.
End of file specifier:
# 1| -1 | -1 | -1 |END OF FILE MARK | 2| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3| 000000000000000000000000000000 | 00000000000000000000 | 0 | 4| 0 | 0 | -99 -99 -99 -99 -30 -99 -99 -99 -99 -99 | 5| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | #
After you have made your STASHmaster file with the required diagnostics, you should add it to the UMUI in Model Selection → Atmosphere → STASH → User-STASHmaster files. Diags, Progs & Ancils. You will also need to give it an initial value in Model Selection → Atmosphere → STASH → Initialisation of User Prognostics (you can just set it to zero, i.e. 3 in the Option column). After you have done this you can select the diagnostic in the Model Selection → Atmosphere → STASH → STASH. Specification of Diagnostics requirements panel.
When outputting UKCA reaction and deposition fluxes, you need to consider what time-points these diagnostics are valid at. Tracer fields are valid at all timesteps, but for reaction fluxes this is not the case. For all the chemistry schemes which use ASAD/Newton-Raphson (CheT/TropIsop, CheS/Strat, and CheST/StratTrop), the UKCA chemical timestep is every hour.
This means that when you output this diagnostic through STASH you need to change the sampling frequency. To do this, go to the STASH panel in the UMUI (Model Selection → Atmosphere → STASH → STASH. Specification of Diagnostic requirements) and copy the time profile you would like to use for the diagnostic to a new profile (giving it a similar, but slightly different name) and then change the sampling frequency to be
- Frequency (every) to be 3
- Offset to be 2
This will then sample the diagnostic on the UKCA timesteps. If you don't sample the diagnostic using this sampling frequency, then the output may be incorrect.
The following diagnostics are valid on all timesteps:
The following diagnostics are only valid on chemical timesteps:
Task 9.1: Output new diagnostics
TASK 9.1: Output diagnostics of the reaction to STASH code 34461, the dry deposition of ALICE to STASH code 34462, and the wet deposition of BOB to 34463. They should be outputted as a daily mean to the pb/UPB stream.
|Remember to use the correct sampling frequency.|
Note: If you were unable to successfully complete Task 8.1 , then please take a copy of the i job from the Tutorial experiment (Tutorial: solution to Task 8.1 - add new wet deposition) and work from there, as this will allow you to only make the changes required for this task.
Remember: If you are using MONSooN you will need to delete/move any existing output files in your archive directory.
Written by Luke Abraham 2013