Solution to UKCA Chemistry and Aerosol Tutorial 5 Task 5.2: Difference between revisions

From UKCA
No edit summary
(Blanked the page)
Line 1: Line 1:
[[UKCA Chemistry and Aerosol Tutorials | Back to UKCA Chemistry and Aerosol Tutorials]]

[[UKCA Chemistry and Aerosol Tutorial 5#Solution to Task_5.2: Add these two new tracers to UKCA | Back to the adding new chemical tracers tutorial]]

==Task==

You were asked to

<blockquote>
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.
</blockquote>

==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_setd1defs.F90
ukca_chem_strattrop.F90
ukca_constants.F90
ukca_cspecies.F90

The following changes need to be made

===Changes to ukca_setd1defs.F90===

The value of '''n_chem_tracers''' need to be increased from 71 to '''73'''.

The '''nm_spec''' array has been edited to add in the ALICE and BOB tracers (changes in <span style="color:red">red</span>):

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 ','<span style="color:red">ALICE</span> ','<span style="color:red">BOB</span> ', &
'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
'ND_Nuc_SOL','Nuc_SOL_SU','ND_Ait_SOL','Ait_SOL_SU','Ait_SOL_BC', &
'Ait_SOL_OC','ND_Acc_SOL','Acc_SOL_SU','Acc_SOL_BC','Acc_SOL_OC', & !110
'Acc_SOL_SS','Acc_SOL_DU','ND_Cor_SOL','Cor_SOL_SU','Cor_SOL_BC', &
'Cor_SOL_OC','Cor_SOL_SS','Cor_SOL_DU','ND_Ait_INS','Ait_INS_BC', & !120
'Ait_INS_OC','ND_Acc_INS','Acc_INS_DU','ND_Cor_INS','Cor_INS_Du', &
'Nuc_SOL_OC','Ait_SOL_SS','Nuc_SOL_OZ','Ait_SOL_OZ','Acc_SOL_OZ', & !130
'Cor_SOL_OZ','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_chem_strattrop.F90===

The following lines have been added to the end of the '''chch_defs_strattrop_chem''' specification:

chch_t( 76,'ALICE ', 1,'TR ',' ', 0, 0, 0), & ! 76
chch_t( 77,'BOB ', 1,'TR ',' ', 0, 0, 0) & ! 77

(also, a comma has been added after the final ")" on line 75, specifying N2). The size of the <tt>chch_defs_strattrop_chem</tt> array has been increased from 75 to '''77'''.

===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 = 73,
.
/JPSPEC/
d
i
JPSPEC = 77,
.
w
q
EOF

An example can be found at

/home/ukca/hand_edits/VN8.2/Tutorial/Task4.2_incr_JPvals.ed

==Output==

If you open the '''pb''' file in your '''[[UKCA & UMUI Tutorials: Things to know before you start#Archiving|archive]]''' 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/sample_output/Task4.2/

on HECToR, and in

/projects/ukca/Tutorial/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

fcm diff -g fcm:um_br/dev/luke/vn8.2_UKCA_Tutorial_Solns@12143 fcm:um_br/dev/luke/vn8.2_UKCA_Tutorial_Solns@12148

This gives the following (non-graphical) output:

Index: src/atmosphere/UKCA/ukca_setd1defs.F90
===================================================================
--- src/atmosphere/UKCA/ukca_setd1defs.F90 (revision 12143)
+++ src/atmosphere/UKCA/ukca_setd1defs.F90 (revision 12148)
@@ -256,7 +256,7 @@
(/'NO ','CH4 ','CO ','HCHO ', &
'C2H6 ','C3H8 ','Me2CO ','MeCHO ', &
'C5H8 ','NO_aircrft'/)
- n_chem_tracers = 71 ! No chem tracers
+ n_chem_tracers = 73 ! No chem tracers
nr_therm = 220 ! thermal reactions
nr_phot = 55 ! photolytic (ATA)
@@ -409,7 +409,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
Index: src/atmosphere/UKCA/ukca_constants.F90
===================================================================
--- src/atmosphere/UKCA/ukca_constants.F90 (revision 12143)
+++ src/atmosphere/UKCA/ukca_constants.F90 (revision 12148)
@@ -267,6 +267,11 @@
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 12143)
+++ src/atmosphere/UKCA/ukca_chem_strattrop.F90 (revision 12148)
@@ -65,7 +65,7 @@
! ATA NLA CheST Chemistry v1.2
-TYPE(CHCH_T), DIMENSION( 75), PUBLIC :: chch_defs_strattrop_chem=(/ &
+TYPE(CHCH_T), DIMENSION( 77), PUBLIC :: chch_defs_strattrop_chem=(/ &
chch_t( 1,'O(3P) ', 1,'TR ','Ox ', 0, 0, 0), & ! 1
chch_t( 2,'O(1D) ', 1,'SS ','Ox ', 0, 0, 0), & ! 2
chch_t( 3,'O3 ', 1,'TR ','Ox ', 1, 0, 0), & ! 3 DD: 1,
@@ -140,7 +140,9 @@
chch_t( 72,'MeOH ', 1,'TR ',' ', 1, 1, 0), & ! 72 DD:36,WD:29,
chch_t( 73,'CO2 ', 1,'CT ',' ', 0, 0, 0), & ! 73
chch_t( 74,'O2 ', 1,'CT ',' ', 0, 0, 0), & ! 74
-chch_t( 75,'N2 ', 1,'CT ',' ', 0, 0, 0) & ! 75
+chch_t( 75,'N2 ', 1,'CT ',' ', 0, 0, 0), & ! 75
+chch_t( 76,'ALICE ', 1,'TR ',' ', 0, 0, 0), & ! 76
+chch_t( 77,'BOB ', 1,'TR ',' ', 0, 0, 0) & ! 77
/)
TYPE(CHCH_T), DIMENSION( 87), PUBLIC :: chch_defs_strattrop_aer=(/ &
Index: src/atmosphere/UKCA/ukca_cspecies.F90
===================================================================
--- src/atmosphere/UKCA/ukca_cspecies.F90 (revision 12143)
+++ src/atmosphere/UKCA/ukca_cspecies.F90 (revision 12148)
@@ -270,6 +270,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



----
''Written by [[User:Nla27 | Luke Abraham]] 2014''

Revision as of 09:54, 25 February 2014