# UKCA online emisison

**URL:** <https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639>\
**Category:** General\
**Created:** [4 February 2025 16:59 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639 "2025-02-04T16:59:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![emxin](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@emxin](https://cms-helpdesk.ncas.ac.uk/u/emxin)\
**Post date:** [4 February 2025 16:59 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/1 "2025-02-04T16:59:31Z")

</div>

Dear mdalvi,

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:

1. adding a new emission species (BrCl) in subroutine /src/control/core/top\_level/ukca\_config\_defs\_mod.F90;
2. 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
3. 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!

Best,  
Xin

---

<div class="post-metadata">

**Author:** ![mdalvi](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mdalvi](https://cms-helpdesk.ncas.ac.uk/u/mdalvi)\
**Post date:** [5 February 2025 12:15 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/2 "2025-02-05T12:15:44Z")

</div>

Hi Xin,

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](https://code.metoffice.gov.uk/trac/ukca/browser/main/branches/dev/xinyang/r3049_bsn_br_v1/src/science/core/emissions/ukca_add_emiss_mod.F90#L683) so the emissions need to be calculated and added to _emissions(ibrcl\_ssa)%values_ before this point.

–  
Mohit

---

<div class="post-metadata">

**Author:** ![emxin](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@emxin](https://cms-helpdesk.ncas.ac.uk/u/emxin)\
**Post date:** [5 February 2025 14:07 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/3 "2025-02-05T14:07:46Z")

</div>

Hi Mohit,

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!

Best,  
Xin

---

<div class="post-metadata">

**Author:** ![mdalvi](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mdalvi](https://cms-helpdesk.ncas.ac.uk/u/mdalvi)\
**Post date:** [5 February 2025 15:08 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/4 "2025-02-05T15:08:25Z")

</div>

Hi Xin,

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](https://www.ukca.ac.uk/wiki/index.php/UKCA_Chemistry_and_Aerosol_UMvn13.0_Tutorial_8#Code_changes_for_the_emissions_diagnostics)

—  
M

---

<div class="post-metadata">

**Author:** ![emxin](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@emxin](https://cms-helpdesk.ncas.ac.uk/u/emxin)\
**Post date:** [5 February 2025 15:59 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/5 "2025-02-05T15:59:45Z")

</div>

Hi Mohit,

I would give a try. What confused me now is how to get the UM trunck first. This sounds a simple issue, but I lost completely.

Best,  
Xin

---

<div class="post-metadata">

**Author:** ![mdalvi](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mdalvi](https://cms-helpdesk.ncas.ac.uk/u/mdalvi)\
**Post date:** [5 February 2025 16:37 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/6 "2025-02-05T16:37:22Z")

</div>

Hi,

The branch creation process is similar to the UKCA branch handling, replacing fcm:ukca with fcm:um: (on PUMA2)

> fcm --branch-create \<branch\_name\> fcm:um.x\_tr@vn13.0  
> fcm co fcm:um.x\_br/dev/xinyang/vn13.0\_branch\_name

make the changes to code and STASHmaster\_A (as per the tutorial) and _fcm commit_.

Add the branch to ‘um\_sources=’ in app/fcm\_make\_um/rose-app.conf, similar to the ukca branches.

- to request the new stash item in GUI edit _app/um/rose-app.conf_ and replace:

> meta=um-atmos/vn13.0 at the top with  
> meta=path-to-checkout-branch/rose-meta/um-atmos/HEAD

- to use the modified STASHmaster in the model run, again in app/um/rose-app.conf

> in the [env] section add the line:  
> _STASHMASTER=STASHmaster_

and at the end of the [file:xxx] section, add the following two lines:

> [file:STASHmaster]  
> source=fcm:um.xm\_br/dev/xinyang/vn13.0\_branch-name/rose-meta/um-atmos/HEAD/etc/stash/STASHmaster@latest-revision

> fcm commit the changes to the suite and run  
> –  
> M

---

<div class="post-metadata">

**Author:** ![emxin](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@emxin](https://cms-helpdesk.ncas.ac.uk/u/emxin)\
**Post date:** [13 February 2025 17:33 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/7 "2025-02-13T17:33:36Z")

</div>

Hi Mohit,

Thanks! I have made some progress, but still have some confusions:

1. I copied a “UKCA” suite (u-dn546) and added the new UM branch generated (/home/n02/n02/emxin/vn13.0\_ssa\_brcl@311510) in GUI “um\_sources”. is it right? Should I copy a new “UM” suite to run the model?
2. Although I can edit the file (app/um/rose-aap.conf) and commit the changes, I found all the updates are lost after I save the GUI (with other changes made). This looks strange and I do not know why. Note that the changes made in the new UM branch (eg in STASHmaster\_A) are not affected by saving GUI.

Best,  
Xin

---

<div class="post-metadata">

**Author:** ![mdalvi](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mdalvi](https://cms-helpdesk.ncas.ac.uk/u/mdalvi)\
**Post date:** [13 February 2025 18:34 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/8 "2025-02-13T18:34:31Z")

</div>

Hi Xin,

1. What you are using _is_ an UM model, which uses UKCA for Chem/aero, JULES as land-surface, (radiation from SOCRATES and so on). This extracts source code from all the different repositories including UKCA.
2. The GUI overwrites the rose-app.conf file when Saved (and Closed), so you can either edit this file manually or via GUI, not both at the same time.

---

<div class="post-metadata">

**Author:** ![emxin](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@emxin](https://cms-helpdesk.ncas.ac.uk/u/emxin)\
**Post date:** [13 February 2025 18:58 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/9 "2025-02-13T18:58:46Z")

</div>

Hi Mohit,

Thanks for the prompt response. I now manually edit the files and save them before I open the GUI to make sure the changes are not lost. However, the suite u-dn546 crashed with errors likely linking to these files changed, see attached screenshot.

 ![Screenshot 2025-02-13 at 18.49.51](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/a085d8fc8a86a96c22734528fd84d82a9d565bd3.png)

Xin

---

<div class="post-metadata">

**Author:** ![mdalvi](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mdalvi](https://cms-helpdesk.ncas.ac.uk/u/mdalvi)\
**Post date:** [14 February 2025 10:17 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/10 "2025-02-14T10:17:36Z")

</div>

Hi Xin,

It looks like the STASHmaster specification was reversed in your last commit.  
[Changeset 311546 for d/n/5/4/6/trunk – roses-u](https://code.metoffice.gov.uk/trac/roses-u/changeset/311546/d/n/5/4/6/trunk)  
The GUI should not remove any changes to rose-app.conf, unless you had another instance open before you made these.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/1fd2411499ffcbc299fe756cd5cdf26e44956558.png) [@system](https://cms-helpdesk.ncas.ac.uk/u/system)\
**Post date:** [16 March 2025 10:17 UTC](https://cms-helpdesk.ncas.ac.uk/t/ukca-online-emisison/1639/11 "2025-03-16T10:17:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
