Solution to UKCA Chemistry and Aerosol Tutorial 9 Task 9.1

Output diagnostics of the reaction ${\displaystyle {\textrm {ALICE}}+{\textrm {OH}}\longrightarrow {\textrm {BOB}}+{\textrm {SEC\_ORG}}}$ 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 pa/UPA stream.

and were given the hint

Remember to use the correct sampling frequency.

Solution

As well as making some code changes and making a new user STASHmaster file, you will also need to make some changes to the STASH table to output the diagnostics correctly.

The only code changes that need to be made are in asad_flux_dat.F90, where you will need to add the following diagnostic specification blocks

```       asad_flux_defn('RXN',34461,'B',.FALSE.,0,4,                      &
(/'ALICE     ','OH        '/),                                   &
(/'BOB       ','Sec_Org   ','          ','          '/)),        &
(/'ALICE     ','          '/),                                   &
(/'          ','          ','          ','          '/)),        &
(/'BOB       ','          '/),                                   &
(/'          ','          ','          ','          '/))         &
```

It is probably best to make this as a separate array, rather than add this to the end of an existing array. You should then add this array into the asad_chemical_fluxes master array that holds all the possible diagnostics. You should also increase the n_chemical_fluxes integer by 3 to 235 to take account of these extra fluxes.

STASHmaster file

You will need to make a user STASHmaster file which looks similar to

```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 |
#
#===============================================================================
#
1|    1 |   34 |  461 |UKCA Tutorial: 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 |   34 |  462 |UKCA Tutorial: ALICE Dry Dep (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 |
#
1|    1 |   34 |  463 |UKCA Tutorial: BOB Wet Dep (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 |
#
#===============================================================================
#
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 |
#
```

This should be included in the UMUI in Model Selection → Atmosphere → STASH → User-STASHmaster files. Diags, Progs & Ancils and the three diagnostics should be initialised to zero (Option 3) in Model Selection → Atmosphere → STASH → Initialisation of User Prognostics.

An example STASHmaster file can be found at

```/home/ukca/userprestash/VN8.4/Tutorial/Task9.1_Tutorial_Diags.presm
```

UMUI STASH table changes

Once you have added in your new user STASHmaster file, you can now output these diagnostics through the STASH panel, by placing entries in the STASH table. However, to do this properly you will need to make a new STASH Time Profile.

Go to Model Selection → Atmosphere → STASH → STASH. Specification of Diagnostics requirements to make these changes.

Create a new time profile

We want to output these diagnostics as daily means, but we cannot use the existing TDAYM time profile, as the sampling frequency is incorrect. We also don't want to alter the existing TDAYM profile as this will then affect all diagnostics currently outputted using this profile. To make the required changes you need to

1. Select the TDAYM profile (it should now highlight yellow)
1. Go to Profiles → Copy Profile → Copy time
2. You will now be asked for a new name to copy this profile to (e.g. TDYMUKCA)
2. Now select this new profile
1. Edit it by going to Profiles → Edit Profile → Edit time
2. Set the Frequency (every) to 3
3. Change the Sampling offset to 2
4. Click Close to save these changes

You have now created a new time profile with the correct sampling frequency for UKCA diagnostics.

Output the diagnostics

Now that you have created the new time profile (TDYMUKCA), you should use it to output the diagnostics as

```34 461 UKCA Tutorial: ALICE+OH->BOB Flux   TDYMUKCA DALLTH   UPB      Y +  Y
34 462 UKCA Tutorial: ALICE Dry Dep (3D)   TDYMUKCA DALLTH   UPB      Y +  Y
34 463 UKCA Tutorial: BOB Wet Dep (3D)     TDYMUKCA DALLTH   UPB      Y +  Y
```

Output

Figure 1: Flux through the ALICE+OH->BOB Reaction in the lowest model level.
Figure 2: Dry deposition of ALICE in the lowest model level.
Figure 3: Wet deposition of BOB in the lowest model level.

Your pa file (located in your job directory) should now contain the following fields

```0    : 192   145   85    1     Stash code = 34001
1    : 192   145   85    1     Stash code = 34064
2    : 192   145   85    1     Stash code = 34065
3    : 192   145   85    1     Stash code = 34461
4    : 192   145   85    1     Stash code = 34462
5    : 192   145   85    1     Stash code = 34463
```

The surface plot of the flux through the ${\displaystyle {\textrm {ALICE}}+{\textrm {OH}}\longrightarrow {\textrm {BOB}}+{\textrm {Sec\_Org}}}$ can be seen in Figure 1, the dry deposition flux of ALICE is in Figure 2, and the wet deposition flux of BOB is in Figure 3. All fluxes are in moles/gridcell/s.

Sample output from this job can be found in

```/work/n02/n02/ukca/Tutorial/vn8.4/sample_output/Task9.1/
```

on ARCHER, and in

```/projects/ukca/Tutorial/vn8.4/sample_ouput/Task9.1/
```

on MONSooN.

Worked Solution

There is a worked solution to this problem in the UMUI Tutorial experiment. This is job j: Tutorial: solution to Task 9.1 - add new diagnostics.

The code changes can be viewed by using the following FCM command

```fcm diff fcm:um_br/dev/luke/vn8.4_UKCA_Tutorial_Solns@14713 fcm:um_br/dev/luke/vn8.4_UKCA_Tutorial_Solns@14714
```

This gives the following output:

```Index: src/atmosphere/UKCA/asad_flux_dat.F90
===================================================================
@@ -102,7 +102,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

! Do we load standard diagnostics as done below (T), or use only reactions
!  specified in STASH (F) ?
@@ -923,6 +923,21 @@
/)

+! UKCA Tutorial fluxes
+       TYPE(asad_flux_defn), PARAMETER, PUBLIC ::                       &
+                                         UKCA_Tutorial_Fluxes(3) = (/   &
+       (/'ALICE     ','OH        '/),                                   &
+       (/'BOB       ','Sec_Org   ','          ','          '/)),        &
+       (/'ALICE     ','          '/),                                   &
+       (/'          ','          ','          ','          '/)),        &
+       (/'BOB       ','          '/),                                   &
+       (/'          ','          ','          ','          '/))         &
+       /)
+
+