UKCA Chemistry and Aerosol vn10.4 Tutorial 9

From UKCA

UKCA Chemistry and Aerosol Tutorials at vn10.4

What you will learn in this Tutorial

In this tutorial you will learn about the UKCA diagnostics package and the different diagnostics that you can output using it. You will also learn how to add new diagnostics from the new reactions and deposition that you have added.

Task 9.1: Output new diagnostics

TASK 9.1: Output diagnostics of the reaction to STASH code 50230, the dry deposition of ALICE to STASH code 50231, and the wet deposition of BOB to 50232. They should be outputted as a daily mean to the pk/UPK stream.

Note:

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:

Diagnostic Type

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)
  • 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)

STASH Code

This is a 5 digit integer defining the STASH code that the diagnostic will be outputted to (e.g. 50001). Currently this must be in section 50.

Diagnostic Specification

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.

  • RXN
    • 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
  • DEP
    • D to output the dry deposition flux
    • W to output the wet deposition flux
  • PSC
    • 1 to output the fraction of Type 1 PSCs
    • 2 to output the fraction of Type 2 PSCs

Mask

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.

Reaction number

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.

Species

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, 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.

Changes to asad_chem_flux_diags.F90

You will need to edit asad_chem_flux_diags.F90 if you want to output a new type of diagnostic. This can be quite involved, but you can look at existing routines to see how things are done. Also, you will probably need to increment the nmax_chemdiags counter, which is essentially the maximum STASH item number in section 50 that this routine will write to.

STASHmaster file

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 edit the STASHmaster_A file in your branch.

Most UKCA diagnostics are 3D, although some, such as emissions (which are outputted in a different way), are 2D. You should take care with the STASH settings in STASHmaster_A between these types, as there some differences that will need to be considered.

Rose Changes

After you have made your STASmaster_A file changes, you will need to add these diagnostics into STASH, as per Tutorial 3. Remember to run the TidyStashTransform macro. If you included this STASHmaster_A file using @HEAD, you won't need to make any further changes to Rose, but you will need to make sure that you have committed your UM branch prior to running. Because the file is taken from fcm:um.xm_br you will need to make sure that the revision has synced to the PUMA mirror (i.e. by waiting a few minutes).

Solution to Task 9.1: Output new diagnostics

You were given the task

  • Output diagnostics of the reaction to STASH code 50230, the dry deposition of ALICE to STASH code 50231, and the wet deposition of BOB to 50232. They should be outputted as a daily mean to the pk/UPK stream.

You were given the hint:

  • Remember to use the correct sampling frequency.

For a working Rose suite that has completed this task, please see u-ai084@26618

The specific Rose changes made are:

Index: trunk/app/um/rose-app.conf
===================================================================
--- trunk/app/um/rose-app.conf	(revision 26593)
+++ trunk/app/um/rose-app.conf	(revision 26618)
@@ -7534,6 +7534,14 @@
 tim_name='TDMPMN'
 use_name='UPMEAN'
 
+[namelist:streq(8d9d5406)]
+dom_name='DALLTH'
+isec=50
+item=230
+package=
+tim_name='TDAYM'
+use_name='UPK'
+
 [namelist:streq(8db529bf)]
 dom_name='DIAG'
 isec=5
@@ -7838,6 +7846,14 @@
 tim_name='TALLTS'
 use_name='UPUKCA'
 
+[namelist:streq(9b488d41)]
+dom_name='DALLTH'
+isec=50
+item=231
+package=
+tim_name='TDAYM'
+use_name='UPK'
+
 [namelist:streq(9c7680fe)]
 dom_name='DSOIL'
 isec=8
@@ -9366,6 +9382,14 @@
 tim_name='TMPMN15'
 use_name='UPMEAN'
 
+[namelist:streq(e03d06b7)]
+dom_name='DALLTH'
+isec=50
+item=232
+package=
+tim_name='TDAYM'
+use_name='UPK'
+
 [namelist:streq(e063ae3a)]
 dom_name='DALLRH'
 isec=0
Index: trunk/app/fcm_make_um/rose-app.conf
===================================================================
--- trunk/app/fcm_make_um/rose-app.conf	(revision 26593)
+++ trunk/app/fcm_make_um/rose-app.conf	(revision 26618)
@@ -45,4 +45,4 @@
 stash_version=1A
 timer_version=3A
 um_rev=vn10.4
-um_sources=branches/dev/mohitdalvi/vn10.4_scale_lightning_nox@19623 branches/dev/stevenhardiman/vn10.4_ukca_tropopause_amendment@19627 branches/dev/alistairsellar/vn10.4_no_expvolc_so2@19808 branches/dev/marcuskoehler/vn10.4_ukca_fix_glomap_climatol_surfarea@24038 branches/dev/lukeabraham/vn10.4_UKCA_Tutorial_Solns@31398
+um_sources=branches/dev/mohitdalvi/vn10.4_scale_lightning_nox@19623 branches/dev/stevenhardiman/vn10.4_ukca_tropopause_amendment@19627 branches/dev/alistairsellar/vn10.4_no_expvolc_so2@19808 branches/dev/marcuskoehler/vn10.4_ukca_fix_glomap_climatol_surfarea@24038 branches/dev/lukeabraham/vn10.4_UKCA_Tutorial_Solns@31422

These differences can be found in the file /home/ukca/Tutorial/worked_solutions/Task9.1/task9.1.rose.diff on PUMA.

For a working UM branch that has completed this task, please see fcm:um.x_br/dev/lukeabraham/vn10.4_UKCA_Tutorial_Solns@31422

The specific UM changes made are:

Index: src/atmosphere/UKCA/asad_flux_dat.F90
===================================================================
--- src/atmosphere/UKCA/asad_flux_dat.F90	(revision 31398)
+++ src/atmosphere/UKCA/asad_flux_dat.F90	(revision 31422)
@@ -97,7 +97,7 @@
 CHARACTER(LEN=10) :: blank0 = '          '   ! Defines null product
 
 ! Number of chemical fluxes defined below
-INTEGER, PARAMETER :: n_chemical_fluxes = 232
+INTEGER, PARAMETER :: n_chemical_fluxes = 235
 
 TYPE(asad_flux_defn), ALLOCATABLE, SAVE :: asad_chemical_fluxes(:)
 
@@ -1022,6 +1022,19 @@
 
 TYPE(asad_flux_defn), PUBLIC :: asad_aerosol_chem(16)
 
+TYPE(asad_flux_defn), PARAMETER, PUBLIC ::                       &
+                                    ukca_tutorial_fluxes(3) = (/ &
+asad_flux_defn('RXN',50230,'B',.FALSE.,0,4,                      &
+(/'ALICE     ','OH        '/),                                   &
+(/'BOB       ','Sec_Org   ','          ','          '/)),        &
+asad_flux_defn('DEP',50231,'D',.FALSE.,0,1,                      &
+(/'ALICE     ','          '/),                                   &
+(/'          ','          ','          ','          '/)),        &
+asad_flux_defn('DEP',50232,'W',.FALSE.,0,1,                      &
+(/'BOB       ','          '/),                                   &
+(/'          ','          ','          ','          '/))         &
+/)
+
 PUBLIC :: asad_load_default_fluxes
 
   CHARACTER(LEN=*), PARAMETER, PRIVATE :: ModuleName='ASAD_FLUX_DAT'
@@ -1096,7 +1109,8 @@
    asad_strat_oh_loss,         & ! 26 181
    asad_strat_o3_budget,       & ! 20 201
    asad_strat_o3_misc,         & ! 15 216
-   asad_aerosol_chem           & ! 16 232
+   asad_aerosol_chem,          & ! 16 232
+   ukca_tutorial_fluxes        & ! 3  235
    /)
 
 IF (printstatus >= PrStatus_Normal) THEN  
Index: src/atmosphere/UKCA/asad_chem_flux_diags.F90
===================================================================
--- src/atmosphere/UKCA/asad_chem_flux_diags.F90	(revision 31398)
+++ src/atmosphere/UKCA/asad_chem_flux_diags.F90	(revision 31422)
@@ -158,7 +158,7 @@
 TYPE(stashsumdiag), DIMENSION(:), ALLOCATABLE, SAVE ::            &
                                              stash_handling
 
-INTEGER, PARAMETER :: nmax_chemdiags = 205      ! For CJ
+INTEGER, PARAMETER :: nmax_chemdiags = 232      ! For CJ
 INTEGER, SAVE :: n_chemdiags
 
 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: temp_chemdiag
Index: rose-meta/um-atmos/HEAD/etc/stash/STASHmaster/STASHmaster-meta.conf
===================================================================
--- rose-meta/um-atmos/HEAD/etc/stash/STASHmaster/STASHmaster-meta.conf	(revision 31398)
+++ rose-meta/um-atmos/HEAD/etc/stash/STASHmaster/STASHmaster-meta.conf	(revision 31422)
@@ -17800,6 +17800,21 @@
     =
     =Available if chemistry and photolysis are turned ON in UKCA
 
+[stashmaster:code(50230)]
+description=RXN FLUX: ALICE+OH->BOB+Sec_Org
+help=Flux through ALICE+OH->BOB+Sec_Org reaction
+    =moles/s
+
+[stashmaster:code(50231)]
+description=DRY DEP FLUX: ALICE
+help=Dry Deposition flux of ALICE (3D)
+    =moles/s
+
+[stashmaster:code(50232)]
+description=WET DEP FLUX: BOB
+help=Wet Deposition flux of BOB (3D)
+    =moles/s
+
 [stashmaster:code(51001)]
 description=O3 MASS MIXING RATIO ON PRESS LEVS
 help=Ozone Mass Mixing Ratio in kg/kg(Air)
@@ -20228,6 +20243,21 @@
     =This is the sum of all species contributing to NOy in a
     =given chemistry scheme
 
+[stashmaster:code(52230)]
+description=RXN FLUX: ALICE+OH->BOB+Sec_Org PLEV
+help=Flux through ALICE+OH->BOB+Sec_Org reaction on pressure levels
+    =moles/s
+
+[stashmaster:code(52231)]
+description=DRY DEP FLUX: ALICE PRESSURE LEVELS
+help=Dry Deposition flux of ALICE (3D) on pressure levels
+    =moles/s
+
+[stashmaster:code(52232)]
+description=WET DEP FLUX: BOB PRESSURE LEVELS
+help=Wet Deposition flux of BOB (3D) on pressure levels
+    =moles/s
+
 [stashmaster:code(53181)]
 description=Temperature Inc: Idealised  (K/step)
 help=Temperature increment from the idealised section in Kelvin per model
Index: rose-meta/um-atmos/HEAD/etc/stash/STASHmaster/STASHmaster_A
===================================================================
--- rose-meta/um-atmos/HEAD/etc/stash/STASHmaster/STASHmaster_A	(revision 31398)
+++ rose-meta/um-atmos/HEAD/etc/stash/STASHmaster/STASHmaster_A	(revision 31422)
@@ -21441,6 +21441,24 @@
 4|    1 |    0 | -17  -17  -17  -17  -21  16  -17  -99  -99  -99 |
 5|    0 | 3829 |    0 |   65 |    0 |    0 |    0 |    0 |    0 |
 #
+1|    1 |   50 |  230 |RXN FLUX: ALICE+OH->BOB+Sec_Org     |
+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 |
+#
+1|    1 |   50 |  231 |DRY DEP FLUX: ALICE                 |
+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 |
+#
+1|    1 |   50 |  232 |WET DEP FLUX: BOB                   |
+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 |
+#
 #===============================================================================
 # Section 50 Item 999 reserved.
 #===============================================================================
@@ -23615,6 +23633,24 @@
 4|    1 |    0 | -17  -17  -17  -17  -21  16  -17  -99  -99  -99 |
 5|    0 | 3829 |    0 |    8 |    0 |    0 |    0 |    0 |    0 |
 #
+1|    1 |   52 |  230 |RXN FLUX: ALICE+OH->BOB+Sec_Org PLEV|
+2|    0 |    0 |    1 |    1 |    3 |    1 |    2 |    0 |    0 |    0 |    1 |
+3| 000000000000000000000000000000 | 00000000000000000001 |    3 |
+4|    1 |    0 | -99  -99  -99  -99  -99  -99  -99  -99  -99  -99 |
+5|    0 | 1871 |    0 |    8 |    0 |    0 |    0 |    0 |    0 |
+#
+1|    1 |   52 |  231 |DRY DEP FLUX: ALICE PRESSURE LEVELS |
+2|    0 |    0 |    1 |    1 |    3 |    1 |    2 |    0 |    0 |    0 |    1 |
+3| 000000000000000000000000000000 | 00000000000000000001 |    3 |
+4|    1 |    0 | -99  -99  -99  -99  -99  -99  -99  -99  -99  -99 |
+5|    0 | 1871 |    0 |    8 |    0 |    0 |    0 |    0 |    0 |
+#
+1|    1 |   52 |  232 |WET DEP FLUX: BOB PRESSURE LEVELS   |
+2|    0 |    0 |    1 |    1 |    3 |    1 |    2 |    0 |    0 |    0 |    1 |
+3| 000000000000000000000000000000 | 00000000000000000001 |    3 |
+4|    1 |    0 | -99  -99  -99  -99  -99  -99  -99  -99  -99  -99 |
+5|    0 | 1871 |    0 |    8 |    0 |    0 |    0 |    0 |    0 |
+#
 #===============================================================================
 # Section 52 Item 999 reserved.
 #===============================================================================

These differences can be found in the file /home/ukca/Tutorial/worked_solutions/Task9.1/task9.1.um.diff on PUMA.

If you open the .pk file in Xconv, you should now see the following fields:

0    : 192   144   36    1     O3 MASS MIXING RATIO
1    : 192   144   36    1     Molar flux density
2    : 192   144   85    1     O3 MASS MIXING RATIO
3    : 192   144   85    1     Field code =  2164
4    : 192   144   85    1     Field code =  2165
5    : 192   144   85    1     Molar flux density
6    : 192   144   85    1     Molar flux density
7    : 192   144   85    1     Molar flux density

Sample output from this task can be found at /work/n02/n02/ukca/Tutorial/vn10.4/sample_output/Task9.1/ai084a.pk19880901 on ARCHER.

Tutorial 10


Written by Luke Abraham 2016