Solution to UKCA Chemistry and Aerosol Tutorial 4 Task 4.2
Back to UKCA Chemistry and Aerosol Tutorials
Back to the adding new chemical tracers tutorial
Task
You were asked to
Make the required code changes so that your ALICE and BOB tracers are now specified in the UKCA CheST/StratTrop scheme. You should set the conversion factor for each of these to 1.0.
Solution
The solution to this task involves making changes to 4 files in the UKCA sub-directory of your source code. These files are
ukca_init.F90 ukca_setd1defs.F90 ukca_chem_strattrop.F90 ukca_constants.F90 ukca_cspecies.F90
The following changes need to be made
Changes to ukca_init.F90
The nm_spec array has been edited to add in the ALICE and BOB tracers (changes in red):
nm_spec(1:n_all_tracers) = (/ & 'O3 ','NO ','NO3 ','NO2 ','N2O5 ', & 'HO2NO2 ','HONO2 ','H2O2 ','CH4 ','CO ', & !10 'HCHO ','MeOOH ','HONO ','C2H6 ','EtOOH ', & 'MeCHO ','PAN ','C3H8 ','n-PrOOH ','i-PrOOH ', & !20 'EtCHO ','Me2CO ','MeCOCH2OOH','PPAN ','MeONO2 ', & 'O3_S ','C5H8 ','ISOOH ','ISON ','MACR ', & !30 'MACROOH ','MPAN ','HACET ','MGLY ','NALD ', & 'HCOOH ','MeCO3H ','MeCO2H ','H2O ','ISO2 ', & !40 'Cl ','ClO ','Cl2O2 ','OClO ','Br ', & 'BrO ','BrCl ','BrONO2 ','N2O ','HCl ', & !50 'HOCl ','HBr ','HOBr ','ClONO2 ','CFCl3 ', & 'CF2Cl2 ','MeBr ','N ','O(3P) ','MACRO2 ', & !60 'MeCl ','CF2ClBr ','CCl4 ','ALICE ','BOB ', & 'MeCCl3 ','CF3Br ','H2OS ','CH2Br2 ','H2 ', & !70 'DMS ','SO2 ','H2SO4 ','MSA ','DMSO ', & 'NH3 ','CS2 ','COS ','H2S ','H ', & !80 'OH ','HO2 ','MeOO ','EtOO ','MeCO3 ', & 'n-PrOO ','i-PrOO ','EtCO3 ','MeCOCH2OO ','MeOH ', & !90 'Monoterp ','Sec_Org ','SESQUITERP','SO3 ','AROM ', & 'O(3P)_S ','O(1D)_S ','NO2 ','BrO ','HCl ', & !100 'Nuc_SOL_ND','Nuc_SOL_SU','Ait_SOL_ND','Ait_SOL_SU','Ait_SOL_BC', & 'Ait_SOL_OC','Acc_SOL_ND','Acc_SOL_SU','Acc_SOL_BC','Acc_SOL_OC', & !110 'Acc_SOL_SS','Acc_SOL_DU','Cor_SOL_ND','Cor_SOL_SU','Cor_SOL_BC', & 'Cor_SOL_OC','Cor_SOL_SS','Cor_SOL_DU','Ait_INS_ND','Ait_INS_BC', & !120 'Ait_INS_OC','Acc_INS_ND','Acc_INS_DU','Cor_INS_ND','Cor_INS_DU', & 'Nuc_SOL_OC','Ait_SOL_SS','Nuc_SOL_SO','Ait_SOL_SO','Acc_SOL_SO', & !130 'Cor_SOL_SO','Nuc_SOL_NH','Ait_SOL_NH','Acc_SOL_NH','Cor_SOL_NH', & 'Nuc_SOL_NT','Ait_SOL_NT','Acc_SOL_NT','Cor_SOL_NT','XXX ', & !140 'Anth_Prec ','Bio_Prec ','Anth_Cond ','Bio_Cond ','XXX ', & 'XXX ','XXX ','XXX ','PASSIVE O3','AGE OF AIR' & !150 /)
Changes to ukca_setd1defs.F90
The value of n_chem_tracers need to be increased from 71 to 73, e.g.
ELSE IF (L_ukca_strattrop .AND. L_ukca_achem) THEN
n_chem_emissions = 21 ! em_chem_spec below
n_3d_emissions = 2 ! volc SO2 & aircraft NOX
ALLOCATE(em_chem_spec(n_chem_emissions+n_3d_emissions))
em_chem_spec = &
(/'NO ','CH4 ','CO ','HCHO ', &
'C2H6 ','C3H8 ','Me2CO ','MeCHO ', &
'C5H8 ','BC_fossil ','BC_biofuel','OC_fossil ', &
'OC_biofuel','Monoterp ','NVOC ','SO2_low ', &
'SO2_high ','DMS ','NH3 ','SO2_nat ', &
'BC_biomass','OC_biomass','NO_aircrft'/)
n_aero_tracers = 12
n_chem_tracers = 73 ! No. chem tracers
IF (L_ukca_trophet) THEN
nr_therm = 241 ! thermal reactions
ELSE
nr_therm = 239 ! thermal reactions
ENDIF
nr_phot = 59 ! photolytic (ATA)
Changes to ukca_chem_strattrop.F90
The following lines have been added to the end of the chch_defs_strattrop_chem specification:
! 88 chch_t( 88,'ALICE ', 1,'TR ',' ', 0, 0, 0), & ! 89 chch_t( 90,'BOB ', 1,'TR ',' ', 0, 0, 0) &
(also, a comma has been added after the final ")" on array line 87, specifying Sec_Org).
The size of the chch_defs_strattrop_aer array has been increased from 87 to 89.
Changes to ukca_constants.F90
The following lines have been added to the UKCA_CONSTANTS module:
! UKCA Tutorial tracers REAL, PARAMETER :: C_ALICE = 1.0000 REAL, PARAMETER :: C_BOB = 1.0000
Changes to ukca_cspecies.F90
The following lines have been added to the UKCA_CALC_CSPECIES subroutine which is held within the UKCA_CSPECIES module
! UKCA Tutorial Tracers WHERE (advt == 'ALICE ') c_species = C_ALICE WHERE (advt == 'BOB ') c_species = C_BOB
Hand-edit to increase values of JPCTR and JPSPEC
A hand-edit is required to increase the values of JPCTR and JPSPEC. This should contain the following:
ed CNTLATM<<\EOF /JPCTR/ d i JPCTR = 85, . /JPSPEC/ d i JPSPEC = 89, . w q EOF
An example can be found at
/home/ukca/hand_edits/VN8.4/Tutorial/Task4.2_incr_JPvals.ed
Output
If you open the pa file in your job directory you will find that it still contains the 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
If you open 34064 and 34065 you will find that they still only contain zeros. This will change in later tasks as we add-in emissions and reactions.
Sample output from this job can be found in
/work/n02/n02/ukca/Tutorial/vn8.4/sample_output/Task4.2/
on ARCHER, and in
/projects/ukca/Tutorial/vn8.4/sample_ouput/Task4.2/
on MONSooN.
Worked Solution
There is a worked solution to this problem in the UMUI Tutorial experiment. This is job d: Tutorial: solution to Task 4.2 - adding new chemical tracers to UKCA.
The code changes can be viewed by using the following FCM command (add -g for to view in xxdiff)
fcm diff fcm:um_br/dev/luke/vn8.4_UKCA_Tutorial_Solns@14676 fcm:um_br/dev/luke/vn8.4_UKCA_Tutorial_Solns@14692
This gives the following output:
Index: src/atmosphere/UKCA/ukca_setd1defs.F90 =================================================================== --- src/atmosphere/UKCA/ukca_setd1defs.F90 (revision 14676) +++ src/atmosphere/UKCA/ukca_setd1defs.F90 (revision 14692) @@ -284,7 +284,7 @@ 'SO2_high ','DMS ','NH3 ','SO2_nat ', & 'BC_biomass','OC_biomass','NO_aircrft'/) n_aero_tracers = 12 - n_chem_tracers = 71 ! No. chem tracers + n_chem_tracers = 73 ! No. chem tracers IF (L_ukca_trophet) THEN nr_therm = 241 ! thermal reactions ELSE Index: src/atmosphere/UKCA/ukca_constants.F90 =================================================================== --- src/atmosphere/UKCA/ukca_constants.F90 (revision 14676) +++ src/atmosphere/UKCA/ukca_constants.F90 (revision 14692) @@ -267,6 +267,10 @@ REAL, PARAMETER :: C_ISOSVOC2 = 2.3473 ! as C5H8 REAL, PARAMETER :: C_ISOSOA = 4.4874 ! 130.0 +! UKCA Tutorial tracers + REAL, PARAMETER :: C_ALICE = 1.0000 + REAL, PARAMETER :: C_BOB = 1.0000 + ! molecular masses in g/mol of emitted species, ! for budget calculations Index: src/atmosphere/UKCA/ukca_chem_strattrop.F90 =================================================================== --- src/atmosphere/UKCA/ukca_chem_strattrop.F90 (revision 14676) +++ src/atmosphere/UKCA/ukca_chem_strattrop.F90 (revision 14692) @@ -218,7 +218,7 @@ chch_t( 75,'N2 ', 1,'CT ',' ', 0, 0, 0) & /) -TYPE(CHCH_T), PUBLIC :: chch_defs_strattrop_aer(1:87)=(/ & +TYPE(CHCH_T), PUBLIC :: chch_defs_strattrop_aer(1:89)=(/ & ! 1 chch_t( 1,'O(3P) ', 1,'TR ','Ox ', 0, 0, 0), & ! 2 @@ -392,7 +392,11 @@ ! 86 DD:40, EM: 12 chch_t( 86,'Monoterp ', 1,'TR ',' ', 1, 0, 1), & ! 87 DD:41,WD:34 -chch_t( 87,'Sec_Org ', 1,'TR ',' ', 1, 1, 0) & +chch_t( 87,'Sec_Org ', 1,'TR ',' ', 1, 1, 0), & +! 88 +chch_t( 88,'ALICE ', 1,'TR ',' ', 0, 0, 0), & +! 89 +chch_t( 90,'BOB ', 1,'TR ',' ', 0, 0, 0) & /) TYPE(RATB_T) :: ratb_defs_strattrop_chem(200) Index: src/atmosphere/UKCA/ukca_cspecies.F90 =================================================================== --- src/atmosphere/UKCA/ukca_cspecies.F90 (revision 14676) +++ src/atmosphere/UKCA/ukca_cspecies.F90 (revision 14692) @@ -272,6 +272,9 @@ WHERE (advt == 'ORGNIT ') c_species = c_orgnit WHERE (advt == 'PASSIVE O3') c_species = 1.0 WHERE (advt == 'AGE OF AIR') c_species = 1.0 +! UKCA Tutorial Tracers + WHERE (advt == 'ALICE ') c_species = C_ALICE + WHERE (advt == 'BOB ') c_species = C_BOB ! non-advected tracers c_na_species=0.0 Index: src/atmosphere/UKCA/ukca_init.F90 =================================================================== --- src/atmosphere/UKCA/ukca_init.F90 (revision 14676) +++ src/atmosphere/UKCA/ukca_init.F90 (revision 14692) @@ -183,7 +183,7 @@ 'BrO ','BrCl ','BrONO2 ','N2O ','HCl ', & !50 'HOCl ','HBr ','HOBr ','ClONO2 ','CFCl3 ', & 'CF2Cl2 ','MeBr ','N ','O(3P) ','MACRO2 ', & !60 - 'MeCl ','CF2ClBr ','CCl4 ','CF2ClCFCl2','CHF2Cl ', & + 'MeCl ','CF2ClBr ','CCl4 ','ALICE ','BOB ', & 'MeCCl3 ','CF3Br ','H2OS ','CH2Br2 ','H2 ', & !70 'DMS ','SO2 ','H2SO4 ','MSA ','DMSO ', & 'NH3 ','CS2 ','COS ','H2S ','H ', & !80
Written by Luke Abraham 2014