Sorry to bother you again. Last Nov. I raised a question re adding an online emission flux for an existing UKCA tracer (BrCl), but I did have much time to work on it until recently. What I did are:
adding a new emission species (BrCl) in subroutine /src/control/core/top_level/ukca_config_defs_mod.F90;
defining an online index (ibrcl_ssa) in subroutine /src/science/core/emissions/ukca_emiss_mod: ukca_onl_emiss_init :
IF (ANY (em_chem_spec == 'BrCl ')) THEN
ibrcl_ssa = num_cdf_em_flds + num_onln_em_flds + 1
num_onln_em_flds = num_onln_em_flds + 1
ENDIF
then within routine ukca_emiss_ctl_mod.F90, I passed the emission flux calcuated to emissions(ibrcl_ssa)%values(:,:,1).
However, the suite (ID: u-dm976) crushed with error message:
? Error code: 1
? Error from routine: GET_EMDIAG_STASH
? Error message: Unexpected UKCA emiss diagnostic: BrCl
? Error from processor: 402
? Error number: 778
Do I need to add “BrCl” as a new emitted specise within ukca_config_defs_mod.F90 if it is just online emitted? BTW, I cannot see the STASHmaster_A file. How do I get the um branch back?
If I do not need to add BrCl as a new emission species, then things may be easier. As I donot need to handle STARSHmaster file and diagnostics. But how do I pass the calculated emission flux to a specific species like BrCl? Thanks!
The error here is due to the emission diagnostic handling code not finding the STASH entry for the new diagnostic. If you have created an UM branch with STASHmaster changes this will have to be included in the fcm_make app. The emissions diagnostics are mapped to STASH numbers in UM routine src/control/ukca_interface/get_emdiag_stash.F90.
For online emissions there is no need to include these in em_chem_spec array- this is for file emissions only. The setting up of emissions(ibrcl_ssa)%xxx items in ukca_emiss_mod will ensure that the emission field is registered.
In the data structure, emissions(x)%tracer_name specifies which UKCA tracer the values should be added, but this has to be of 10 character length with trailing blanks if needed.
Finally, the emission values get added to the corresponding tracer in routine ukca_add_emiss so the emissions need to be calculated and added to emissions(ibrcl_ssa)%values before this point.
I did not have an UM branch for the suite (u-dm976), all the braches listed in the Sources are:
branches/dev/marcstringer/um13.0_bug_fixes@604
branches/dev/lukeabraham/um13.0_all_ntp_fix@1783
branches/dev/xinyang/r3049_bsn_br_v1@5384
I remebered I just created a UKCA branch, but donot know how to re-create a UM branch for this suite. If I have to create a new UM branch before the UKCA branch (or do everything from the beginning), please let me how to do it. Thanks!
An UM branch and STASHmaster changes will be needed if you want to output the new emission field as a diagnostic.
If needed, I can try to look if there is a simple recent example for doing this. Alternatively there is an exercise on creating emissions diagnostics in the UKCA tutorials. UKCA Chemistry and Aerosol UMvn13.0 Tutorial 8 - UKCA