Difference between revisions of "UKCA Chemistry and Aerosol vn10.4 Tutorial 5"

From UKCA
Line 32: Line 32:
 
* units: According to CF conventions, all emissions should be expressed in <math>kg\, {m}^{-2}\, {s}^{-1}</math>. As a consequence, all files will contain the attribute
 
* units: According to CF conventions, all emissions should be expressed in <math>kg\, {m}^{-2}\, {s}^{-1}</math>. As a consequence, all files will contain the attribute
 
:: <code>units = "kg m-2 s-1"</code>
 
:: <code>units = "kg m-2 s-1"</code>
: However, under some circumstances emission fields need to be reported as kg of a given species (e.g. nitrogen, carbon, sulfur). When that is the case this needs to be indicated in the standard name attribute if possible (see example below), otherwise in the long name attribute. As an example, in the case of an emission field reported as kg of carbon, the attribute units will be “kg m-2 s-1” while the attribute standard name should contain the substring “expressed_as_carbon” if that is accepted by CF conventions for standard names (see http://cf-pcmdi.llnl.gov/documents/cf-standard-names); otherwise the attribute long name should contain the substring “expressed as carbon”. The UM subroutines BASE_EMISS_FACTORS and GET_BASE_SCALING will look for such substrings and apply some conversions if
+
: However, under some circumstances emission fields need to be reported as kg of a given species (e.g. nitrogen, carbon, sulfur). When that is the case this needs to be indicated in the standard name attribute if possible (see example below), otherwise in the long name attribute. As an example, in the case of an emission field reported as kg of carbon, the attribute units will be “kg m-2 s-1” while the attribute standard name should contain the substring “expressed_as_carbon” if that is accepted by CF conventions for standard names (see http://cf-pcmdi.llnl.gov/documents/cf-standard-names); otherwise the attribute long name should contain the substring “expressed as carbon”. The UM subroutines BASE_EMISS_FACTORS and GET_BASE_SCALING will look for such substrings and apply some conversions if needed. It is therefore essential that the substrings in standard name and long name are separated by underscores and white spaces, respectively, as indicated above.
needed. It is therefore essential that the substrings in standard name and long name are separated by underscores and white spaces, respectively, as indicated above.
 
 
* hourly scaling (optional): A character attribute used to apply a diurnal cycle to emissions data with daily or lower frequency. Allowed values:
 
* hourly scaling (optional): A character attribute used to apply a diurnal cycle to emissions data with daily or lower frequency. Allowed values:
 
** none (or attribute not present): no scaling
 
** none (or attribute not present): no scaling

Revision as of 13:31, 1 December 2016

UKCA Chemistry and Aerosol Tutorials at vn10.4

What you will learn in this Tutorial

During this tutorial you will learn how to make new UKCA netCDF emissions files. Then you will learn how to add new emissions into UKCA so that they emit into one of your new tracers.

At the end of the previous tutorial you will now know how to create new tracers for use by UKCA. However, after completing the tasks, your tracers will still be empty, as nothing has been put into them. This tutorial will teach you how to create an emissions file that the UKCA will read, and that you can then tell UKCA to use and emit into your tracer(s).

This tutorial will go through the steps needed to make an emission into a tracer which UKCA does not currently emit into. The steps in making the netCDF file will be the same for a species which is currently emitted into, although in this simpler case you would not need to make any code changes.

Task 5.1: Create a new emissions file and use it in your job

Task 5.1: In the
/work/n02/n02/ukca/Tutorial/vn10.4/Task5.1
directory on ARCHER there is the file Emissions_of_ALICE.nc which is a 0.5x0.5 degree resolution surface emission field. You should regrid this file to the N96 ENDGame grid, and output it as a netCDF file that has the required netCDF metadata for a climatological surface emission without any diurnal cycle.

The netCDF emissions system

UKCA uses netCDF files to specify the emissions into UKCA species. Using netCDF files means that the metadata in the file can be used to specify various options, such as which diurnal cycle to use.

Metadata

In Global Atmosphere 7.0, UKCA emissions are prescribed using netCDF files. The reason for this move away from the UM ancillary file format

Each emission field in the NetCDF files needs to include the following variable metadata attributes (there is no requirement for the netCDF variable names themselves except that they be no longer than 80 characters):

“tendency_of_atmosphere_mass_content_of_nitrogen_monoxide_due_to_emission”
(note that all substrings have to be separated by underscores).
  • long_name: It is recommendable but only compulsory if there is no ‘standard_name’ available for that emission field. There are no specific CF conventions for standard names, but within the UKCA code all substrings should be separated by white space as shown in this example:
“tendency of atmosphere mass content of nitrogen monoxide due to emission”.
The reason for this is given in the description of the attribute units.
  • tracer name: This attribute has to be equal to the name of a tracer (or of an emission field such as ‘NO - aircrft’) present in the list of emissions for the given chemical scheme, i.e. em_chem_spec. This name is used by the subroutine UKCA_ADD_EMISS to add the emission field to the corresponding tracer. There should be at least one emission field in the NetCDF files (or alternatively an online emission field) with the value of tracer name equal to one of the items in em_chem_spec, otherwise the subroutine UKCA_EMISS_INIT (in module UKCA_EMISS_MOD) will report a missing tracer in the emission files and the model will stop with error.
  • units: According to CF conventions, all emissions should be expressed in . As a consequence, all files will contain the attribute
units = "kg m-2 s-1"
However, under some circumstances emission fields need to be reported as kg of a given species (e.g. nitrogen, carbon, sulfur). When that is the case this needs to be indicated in the standard name attribute if possible (see example below), otherwise in the long name attribute. As an example, in the case of an emission field reported as kg of carbon, the attribute units will be “kg m-2 s-1” while the attribute standard name should contain the substring “expressed_as_carbon” if that is accepted by CF conventions for standard names (see http://cf-pcmdi.llnl.gov/documents/cf-standard-names); otherwise the attribute long name should contain the substring “expressed as carbon”. The UM subroutines BASE_EMISS_FACTORS and GET_BASE_SCALING will look for such substrings and apply some conversions if needed. It is therefore essential that the substrings in standard name and long name are separated by underscores and white spaces, respectively, as indicated above.
  • hourly scaling (optional): A character attribute used to apply a diurnal cycle to emissions data with daily or lower frequency. Allowed values:
    • none (or attribute not present): no scaling
    • traffic uk: used for UK air quality studies
    • TNO MACC EU SNAPnn (where nn=01 to 11): Hourly factors of emissions for Europe. Calculated by TNO for the MACC project.
    • diurnal isopems (for isoprene emissions): use the routine UKCA DIURNAL ISOP EMS to calculate a diurnal cycle using solar zenith angle and latitude to compute the expected number of sunshine hours.
  • daily scaling (optional): A character attribute used to apply a weekly cycle to emissions weekly or lower frequency. Only allowed when the model is using the Gregorian calendar. Allowed values:
    • none (or attribute not present): no scaling
    • traffic uk: used for UK air quality studies
    • TNO MACC GB SNAPnn (where nn=01 to 11): Hourly factors of emissions for Great Britain. Calculated by TNO for the MACC project.
  • vertical scaling (optional): A character attribute defining the vertical distribution of the emission. This allows the user to supply a 2D field to be applied over multiple levels. Allowed values:
    • surface (or attribute not present): treat as surface emission
    • all levels, 3D: field is three-dimensional and is provided on model levels (must have the same number

of levels as the model)

    • high level: spread a 2D field over multiple model levels, weighting by model layer thickness to achieve a uniform distribution in height. Must be accompanied by variable attributes lowest level and highest -

level to indicate the model levels over which to distribute the emission.

    • step1: used for air quality simulations, spreads emission over lowest 3 layers of the model; only allowed with 38 model levels.
    • EMEP modified SNAPnn (where nn=01 to 11): Average vertical profiles for SNAP sectors, similar to implementation for EMEP model. See routine vertical emiss factors for details.
    • Bieser modified SNAPnn (where nn=01 to 11): Average vertical profiles for SNAP sectors, similar to implementation of Bieser et al. (2011) with the SMOKE model and including fugitive emissions. See routine vertical_emiss_factors for details. In addition, each NetCDF file has to include two global attributes with information that is valid for all emission fields present in the file:
  • update freq in hours: Integer indicating the frequency (in hours) at which all emission fields present in that file should be read to update emissions(:)%values (:,:,:) in the UKCA code. Update points are calculated relative the model’s ancil reftime.
  • update type: Integer number indicating the times at which the data is provided. The same conventions as for ancillary files have been adopted:
    • 0: Single time
    • 1: Time series
    • 2: Periodic time series
When emissions are treated as time series (update type=1) the user is responsible for creating emission fields which cover the whole period for which the model is run; otherwise the model will not find the time registers to do interpolations and will stop with error. When emissions are periodic (update type=2) each emission field has to include exactly 12 monthly average emissions (Jan, Feb, ..., Dec). Other attributes, in particular some global attributes, as well as some additional fields (e.g. a variable indicating the type of grid mapping) should be present in the files to comply with CF conventions for NetCDF data, but they are not used by the UKCA code.

Using python to regrid your emissions

For this task we will be using the Iris python library, which is developed by the Met Office and can read Met Office formatted files. The cf-python library also does this, but we will not be using this here.

You can use Iris on ARCHER by loading the anaconda module:

module load anaconda

if you then

conda list

you will see that Iris is available:

iris                      1.10.0               np19py27_2    https://conda.binstar.org/scitools

when developing python scripts, a good command to use can be set by the following alias:

alias pylab='ipython --pylab --logfile=ipython-`date +"%Y%m%d-%H%M%S"`.py'

This uses ipython, which is an interactive shell for python. The --pylab automatically loads some standard python libraries such as scipy, numpy, and matplotlib. The --logfile means that all commands will be recorded in a file with the format ipython-YYYYMMDD-HHMMSS.py.

You can also execute pre-written python scripts by

python2.7 -c "execfile('name_of_script.py')"

However, don't panic. You are not expected to know python to complete this tutorial. You will be provided with an example script to use that you only need to edit a few lines to get to work. You do not need to write a script from scratch, just read-through the provided script and try to understand what it does, and why.

Example python script

In the directory:

/work/n02/n02/ukca/Tutorial/vn10.4/Task5.1

you will find the file regrid_ALICE_N96e.py. This file looks like

#!/usr/bin/env python

# This file is part of the UKCA Tutorials:
#  http://www.ukca.ac.uk/wiki/index.php/UKCA_Chemistry_and_Aerosol_Tutorials_at_vn10.4

# Copyright (C) 2015  University of Cambridge

# This is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.

# It is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.

# You find a copy of the GNU Lesser General Public License at <http://www.gnu.org/licenses/>.

# Written by N. Luke Abraham 2016-10-20 <nla27@cam.ac.uk> 

# preamble
import iris
import numpy
# pre-Iris v1.10, use iris.unit instead of cf_units
import cf_units

# --- CHANGE THINGS BELOW THIS LINE TO WORK WITH YOUR FILES ETC. ---

# name of file containing an ENDGame grid, e.g. your model output
# NOTE: all the fields in the file should be on the same horizontal
#       grid, as the field used MAY NOT be the first in order of STASH
grid_file='ai084a.pk19880901'
# name of emissions file
emissions_file='Emissions_of_ALICE.nc'

# --- BELOW THIS LINE, NOTHING SHOULD NEED TO BE CHANGED ---

species_name='ALICE'

# this is the grid we want to regrid to, e.g. N96 ENDGame
grd=iris.load(grid_file)[0]
grd.coord(axis='x').guess_bounds()
grd.coord(axis='y').guess_bounds()

# This is the original data
ems=iris.load_cube(emissions_file)
# make intersection between 0 and 360 longitude to ensure that 
# the data is regridded correctly
nems = ems.intersection(longitude=(0, 360))

# make sure that we use the same coordinate system, otherwise regrid won't work
nems.coord(axis='x').coord_system=grd.coord_system()
nems.coord(axis='y').coord_system=grd.coord_system()

# now guess the bounds of the new grid prior to regridding
nems.coord(axis='x').guess_bounds()
nems.coord(axis='y').guess_bounds()

# now regrid
ocube=nems.regrid(grd,iris.analysis.AreaWeighted())

# now add correct attributes and names to netCDF file
ocube.var_name='emissions_'+str.strip(species_name)
ocube.long_name=str.strip(species_name)+' surf emissions'
ocube.units=cf_units.Unit('kg m-2 s-1')
ocube.attributes['vertical_scaling']='surface'
ocube.attributes['tracer_name']=str.strip(species_name)
# global attributes, so don't set in local_keys
# NOTE: all these should be strings, including the numbers! This will change at a later UM version.
# basic emissions type
ocube.attributes['emission_type']='2' # periodic
ocube.attributes['update_type']='2'   # same as above
ocube.attributes['update_freq_in_hours']='120' # i.e. 5 days
ocube.attributes['source']='UKCA Tutorial Task 5.1 - creating netCDF emissions'

# rename and set time coord - set to be 0000/01/16:00:00-0000/12/16:00:00
# this bit is annoyingly fiddly
ocube.coord(axis='t').var_name='time'
ocube.coord(axis='t').standard_name='time'
ocube.coords(axis='t')[0].units=cf_units.Unit('hours since 1970-01-01', calendar='360_day')
ocube.coord(axis='t').points=numpy.array([-17020440, -17019720, -17019000, -17018280,
                                          -17017560, -17016840, -17016120, -17015400, 
                                          -17014680, -17013960, -17013240, -17012520]) 
# make z-direction.
zdims=iris.coords.DimCoord(numpy.array([0]),standard_name = 'model_level_number',
                           units='1',attributes={'positive':'up'})
ocube.add_aux_coord(zdims)
ocube=iris.util.new_axis(ocube, zdims)
# now transpose cube to put Z 2nd
ocube.transpose([1,0,2,3])

# make coordinates 64-bit
ocube.coord(axis='x').points=ocube.coord(axis='x').points.astype(dtype='float64')
ocube.coord(axis='y').points=ocube.coord(axis='y').points.astype(dtype='float64')
#ocube.coord(axis='z').points=ocube.coord(axis='z').points.astype(dtype='float64') # integer
ocube.coord(axis='t').points=ocube.coord(axis='t').points.astype(dtype='float64')
# for some reason, longitude_bounds are double, but latitude_bounds are float
ocube.coord('latitude').bounds=ocube.coord('latitude').bounds.astype(dtype='float64')


# add forecast_period & forecast_reference_time
# forecast_reference_time
frt=numpy.array([-17020080, -17019360, -17018640, -17017920, 
                 -17017200, -17016480, -17015760, -17015040, 
                 -17014320, -17013600, -17012880, -17012160],dtype='float64')
frt_dims=iris.coords.AuxCoord(frt,standard_name = 'forecast_reference_time',
                           units=cf_units.Unit('hours since 1970-01-01', calendar='360_day'))
ocube.add_aux_coord(frt_dims,data_dims=0)
ocube.coord('forecast_reference_time').guess_bounds()
# forecast_period
fp=numpy.array([-360],dtype='float64')
fp_dims=iris.coords.AuxCoord(fp,standard_name = 'forecast_period',
                           units=cf_units.Unit('hours'),bounds=numpy.array([-720,0],dtype='float64'))
ocube.add_aux_coord(fp_dims,data_dims=None)

# add-in cell_methods
ocube.cell_methods = [iris.coords.CellMethod('mean', 'time')]
# set _FillValue
fillval=1e+20
ocube.data = numpy.ma.array(data=ocube.data, fill_value=fillval, dtype='float32')

# output file name, based on species
outpath='ukca_emiss_'+species_name+'.nc'
# don't want time to be cattable, as is a periodic emissions file
iris.FUTURE.netcdf_no_unlimited=True
# annoying hack to set a missing_value attribute as well as a _FillValue attribute
dict.__setitem__(ocube.attributes, 'missing_value', fillval)
# now write-out to netCDF
saver = iris.fileformats.netcdf.Saver(filename=outpath, netcdf_format='NETCDF3_CLASSIC')
saver.update_global_attributes(Conventions=iris.fileformats.netcdf.CF_CONVENTIONS_VERSION)
saver.write(ocube, local_keys=['vertical_scaling', 'missing_value','um_stash_source','tracer_name'])

# end of script

# Why we are messing around with metadata?
#-----------------------------------------
#
# We need to adapt the metadata of the emissions data to 
# match what UKCA is expecting. 
#  e.g. the metadata of the 'Emissions_of_ALICE.nc file is:
#
#    netcdf Emissions_of_ALICE {
#    dimensions:
#            lon = 720 ;
#            lat = 360 ;
#            date = UNLIMITED ; // (12 currently)
#    variables:
#            float lon(lon) ;
#                    lon:long_name = "Longitude" ;
#                    lon:standard_name = "longitude" ;
#                    lon:units = "degrees_east" ;
#                    lon:point_spacing = "even" ;
#                    lon:modulo = " " ;
#            float lat(lat) ;
#                    lat:long_name = "Latitude" ;
#                    lat:standard_name = "latitude" ;
#                    lat:units = "degrees_north" ;
#                    lat:point_spacing = "even" ;
#            float date(date) ;
#                    date:long_name = "Time" ;
#                    date:units = "days since 1960-01-01" ;
#                    date:time_origin = "01-JAN-1960:00:00:00" ;
#            float ALICE(date, lat, lon) ;
#                    ALICE:source = " " ;
#                    ALICE:name = "ALICE" ;
#                    ALICE:title = "Emissions of ALICE in kg/m^2/s" ;
#                    ALICE:date = "01/01/60" ;
#                    ALICE:time = "00:00" ;
#                    ALICE:long_name = "Emissions of ALICE in kg/m^2/s" ;
#                    ALICE:standard_name = "tendency_of_atmosphere_mass_content_of_ALICE_due_to_emission" ;
#                    ALICE:units = "kg/m2/s" ;
#                    ALICE:missing_value = 2.e+20f ;
#                    ALICE:_FillValue = 2.e+20f ;
#                    ALICE:valid_min = 0.f ;
#                    ALICE:valid_max = 2.60646e-08f ;
#    
#    // global attributes:
#                    :history = "Tue Jun 18 14:32:42 BST 2013 - XCONV V1.92 16-February-2006" ;
#    }
#
#  whereas, the metadata of the 
#  /work/n02/n02/hum/ancil/atmos/n96e/ukca_emiss/cmip5/2000/v2/ukca_emiss_CO.nc
#  file is, e.g.:
#
#    netcdf ukca_emiss_CO {
#    dimensions:
#            time = UNLIMITED ; // (12 currently)
#            model_level_number = 1 ;
#            latitude = 144 ;
#            longitude = 192 ;
#            bnds = 2 ;
#    variables:
#            double emissions_CO(time, model_level_number, latitude, longitude) ;
#                    emissions_CO:long_name = "CO surf emissions" ;
#                    emissions_CO:units = "kg m-2 s-1" ;
#                    emissions_CO:um_stash_source = "m01s00i303" ;
#                    emissions_CO:tracer_name = "CO" ;
#                    emissions_CO:vertical_scaling = "surface" ;
#                    emissions_CO:cell_methods = "time: mean" ;
#                    emissions_CO:grid_mapping = "latitude_longitude" ;
#                    emissions_CO:coordinates = "forecast_period forecast_reference_time" ;
#            int latitude_longitude ;
#                    latitude_longitude:grid_mapping_name = "latitude_longitude" ;
#                    latitude_longitude:longitude_of_prime_meridian = 0. ;
#                    latitude_longitude:earth_radius = 6371229. ;
#            double time(time) ;
#                    time:axis = "T" ;
#                    time:bounds = "time_bnds" ;
#                    time:units = "hours since 1970-01-01 00:00:00" ;
#                    time:standard_name = "time" ;
#                    time:calendar = "360_day" ;
#            double time_bnds(time, bnds) ;
#            int model_level_number(model_level_number) ;
#                    model_level_number:axis = "Z" ;
#                    model_level_number:units = "metre" ;
#                    model_level_number:standard_name = "model_level_number" ;
#                    model_level_number:long_name = "height at theta layer midpoint" ;
#                    model_level_number:positive = "up" ;
#            float latitude(latitude) ;
#                    latitude:axis = "Y" ;
#                    latitude:bounds = "latitude_bnds" ;
#                    latitude:units = "degrees_north" ;
#                    latitude:standard_name = "latitude" ;
#            float latitude_bnds(latitude, bnds) ;
#            float longitude(longitude) ;
#                    longitude:axis = "X" ;
#                    longitude:bounds = "longitude_bnds" ;
#                    longitude:units = "degrees_east" ;
#                    longitude:standard_name = "longitude" ;
#            double longitude_bnds(longitude, bnds) ;
#            double forecast_period ;
#                    forecast_period:bounds = "forecast_period_bnds" ;
#                    forecast_period:units = "hours" ;
#                    forecast_period:standard_name = "forecast_period" ;
#            double forecast_period_bnds(bnds) ;
#            double forecast_reference_time(time) ;
#                    forecast_reference_time:units = "hours since 1970-01-01 00:00:00" ;
#                    forecast_reference_time:standard_name = "forecast_reference_time" ;
#                    forecast_reference_time:calendar = "360_day" ;
#    
#    // global attributes:
#                    :emission_type = "2" ;
#                    :source = "Data from Met Office Unified Model" ;
#                    :um_version = "7.3" ;
#                    :update_freq_in_hours = "120" ;
#                    :update_type = "2" ;
#                    :Conventions = "CF-1.5" ;
#    }
#
#  so the metadata of our new emissions file needs to be edited to be what UKCA
#  expects.
#
#  After using this script, the resultant netCDF file should look like:
#
#    netcdf ukca_emiss_ALICE {
#    dimensions:
#            time = 12 ;
#            model_level_number = 1 ;
#            latitude = 144 ;
#            longitude = 192 ;
#            bnds = 2 ;
#    variables:
#            float emissions_ALICE(time, model_level_number, latitude, longitude) ;
#                    emissions_ALICE:_FillValue = 1.e+20f ;
#                    emissions_ALICE:long_name = "ALICE surf emissions" ;
#                    emissions_ALICE:units = "kg m-2 s-1" ;
#                    emissions_ALICE:missing_value = 1.e+20f ;
#                    emissions_ALICE:tracer_name = "ALICE" ;
#                    emissions_ALICE:vertical_scaling = "surface" ;
#                    emissions_ALICE:cell_methods = "time: mean" ;
#                    emissions_ALICE:grid_mapping = "latitude_longitude" ;
#                    emissions_ALICE:coordinates = "forecast_period forecast_reference_time" ;
#            int latitude_longitude ;
#                    latitude_longitude:grid_mapping_name = "latitude_longitude" ;
#                    latitude_longitude:longitude_of_prime_meridian = 0. ;
#                    latitude_longitude:earth_radius = 6371229. ;
#            double time(time) ;
#                    time:axis = "T" ;
#                    time:units = "hours since 1970-01-01" ;
#                    time:standard_name = "time" ;
#                    time:long_name = "Time" ;
#                    time:calendar = "360_day" ;
#                    time:time_origin = "01-JAN-1960:00:00:00" ;
#            int model_level_number(model_level_number) ;
#                    model_level_number:axis = "Z" ;
#                    model_level_number:units = "1" ;
#                    model_level_number:standard_name = "model_level_number" ;
#                    model_level_number:positive = "up" ;
#            double latitude(latitude) ;
#                    latitude:axis = "Y" ;
#                    latitude:bounds = "latitude_bnds" ;
#                    latitude:units = "degrees_north" ;
#                    latitude:standard_name = "latitude" ;
#            double latitude_bnds(latitude, bnds) ;
#            double longitude(longitude) ;
#                    longitude:axis = "X" ;
#                    longitude:bounds = "longitude_bnds" ;
#                    longitude:units = "degrees_east" ;
#                    longitude:standard_name = "longitude" ;
#            double longitude_bnds(longitude, bnds) ;
#            double forecast_period ;
#                    forecast_period:bounds = "forecast_period_bnds" ;
#                    forecast_period:units = "hours" ;
#                    forecast_period:standard_name = "forecast_period" ;
#            double forecast_period_bnds(bnds) ;
#            double forecast_reference_time(time) ;
#                    forecast_reference_time:bounds = "forecast_reference_time_bnds" ;
#                    forecast_reference_time:units = "hours since 1970-01-01" ;
#                    forecast_reference_time:standard_name = "forecast_reference_time" ;
#                    forecast_reference_time:calendar = "360_day" ;
#            double forecast_reference_time_bnds(time, bnds) ;
#    
#    // global attributes:
#                    :Conventions = "CF-1.5" ;
#                    :date = "01/01/60" ;
#                    :emission_type = "2" ;
#                    :history = "Tue Jun 18 14:32:42 BST 2013 - XCONV V1.92 16-February-2006" ;
#                    :invalid_standard_name = "tendency_of_atmosphere_mass_content_of_ALICE_due_to_emission" ;
#                    :name = "ALICE" ;
#                    :source = "UKCA Tutorial Task 5.1 - creating netCDF emissions" ;
#                    :time = "00:00" ;
#                    :title = "Emissions of ALICE in kg/m^2/s" ;
#                    :update_freq_in_hours = "120" ;
#                    :update_type = "2" ;
#    }


Solution to Task5.1

A file that has been produced by the above script can be found at

/work/n02/n02/ukca/Tutorial/vn10.4/Task5.1/solution/ukca_emiss_ALICE.nc

Task 5.2: make the required code changes to add your emission into UKCA

TASK 5.2: You should now make the UKCA code changes to add your emission into the ALICE tracer.

Note: If you were unable to successfully complete

Rose changes

Code changes


Then include in Rose, and also make branch changes:

[16:10:16 luke@puma vn10.4_UKCA_Tutorials]$ fcm diff https://code.metoffice.gov.uk/svn/um/main/branches/dev/lukeabraham/vn10.4_UKCA_Tutorials@28917 https://code.metoffice.gov.uk/svn/um/main/branches/dev/lukeabraham/vn10.4_UKCA_Tutorials@29446
Index: src/atmosphere/UKCA/ukca_setd1defs.F90
===================================================================
--- src/atmosphere/UKCA/ukca_setd1defs.F90      (revision 28917)
+++ src/atmosphere/UKCA/ukca_setd1defs.F90      (revision 29446)
@@ -301,7 +301,7 @@
       nr_phot         = 38
     END IF
   ELSE IF (L_ukca_strattrop .AND. .NOT. L_ukca_achem) THEN
-    n_chem_emissions = 9
+    n_chem_emissions = 10
     n_3d_emissions = 1       ! aircraft NOX
     n_aero_tracers =  0
     ALLOCATE(em_chem_spec(n_chem_emissions+n_3d_emissions))
@@ -308,19 +308,20 @@
     em_chem_spec =                                             &
         (/'NO        ','CH4       ','CO        ','HCHO      ', &
           'C2H6      ','C3H8      ','Me2CO     ','MeCHO     ', &
-          'C5H8      ','NO_aircrft'/)
+          'C5H8      ','ALICE     ','NO_aircrft'/)
     n_chem_tracers = 73         ! No chem tracers
     nr_therm       = 220        ! thermal reactions
     nr_phot        = 55         ! photolytic (ATA)
 
   ELSE IF (L_ukca_strattrop .AND. L_ukca_achem) THEN
-    n_chem_emissions = 19      ! em_chem_spec below
+    n_chem_emissions = 20      ! em_chem_spec below
     n_3d_emissions   = 4       ! BC, OC, 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 ', &
+          'C5H8      ','ALICE     ',                           &
+          'BC_fossil ','BC_biofuel','OC_fossil ',              &
           'OC_biofuel','Monoterp  ','NVOC      ','SO2_low   ', &
           'SO2_high  ','NH3       ','DMS       ','SO2_nat   ', &
           'BC_biomass','OC_biomass','NO_aircrft'/)
@@ -715,6 +716,8 @@
       UkcaD1Codes(j+i)%item = 314
     ELSE IF (em_chem_spec(i) == 'NVOC      ') THEN
       UkcaD1Codes(j+i)%item = 315
+    ELSE IF (em_chem_spec(i) == 'ALICE     ') THEN
+      UkcaD1Codes(j+i)%item = 316
     ELSE IF (em_chem_spec(i) == 'BC_biomass') THEN
       UkcaD1Codes(j+i)%item = 322
       UkcaD1Codes(j+i)%len_dim3 = tr_levels
Index: src/atmosphere/UKCA/get_molmass_mod.F90
===================================================================
--- src/atmosphere/UKCA/get_molmass_mod.F90     (revision 28917)
+++ src/atmosphere/UKCA/get_molmass_mod.F90     (revision 29446)
@@ -242,6 +242,9 @@
 CASE ('BrCl      ')
   get_molmass = m_brcl
 
+CASE ('ALICE     ')
+  get_molmass = m_ALICE
+
   ! -----------------------------------------
   !   Others (report warning)
 CASE ('AGE       ')
Index: src/atmosphere/UKCA/ukca_constants.F90
===================================================================
--- src/atmosphere/UKCA/ukca_constants.F90      (revision 28917)
+++ src/atmosphere/UKCA/ukca_constants.F90      (revision 29446)
@@ -390,6 +390,9 @@
 REAL, PARAMETER :: m_aromooh  = 130.0
 REAL, PARAMETER :: m_mekooh   = 104.0
 
+!     UKCA Tutorial tracers - only ALICE is emitted
+REAL, PARAMETER :: m_ALICE    = 1.0000  
+
 !     The mass of organic nitrate is an approximation,
 !     calculated as the average of ORGNIT formed by two
 !     reacs. in UKCA_CHEMCO_RAQ:
Index: src/atmosphere/UKCA/ukca_chem_strattrop.F90
===================================================================
--- src/atmosphere/UKCA/ukca_chem_strattrop.F90 (revision 28917)
+++ src/atmosphere/UKCA/ukca_chem_strattrop.F90 (revision 29446)
@@ -215,7 +215,7 @@
 !  75
 chch_t( 75,'N2        ',  1,'CT        ','          ',  0,  0,  0),  &
 !  76 
-chch_t( 88,'ALICE     ',  1,'TR        ','          ',  0,  0,  0),  &
+chch_t( 88,'ALICE     ',  1,'TR        ','          ',  0,  0,  1),  &
 !  77 
 chch_t( 89,'BOB       ',  1,'TR        ','          ',  0,  0,  0)   &
   /)
@@ -372,7 +372,7 @@
 !  75
 chch_t( 75,'N2        ',  1,'CT        ','          ',  0,  0,  0),  &
 !  76 
-chch_t( 88,'ALICE     ',  1,'TR        ','          ',  0,  0,  0),  &
+chch_t( 88,'ALICE     ',  1,'TR        ','          ',  0,  0,  1),  &
 !  77 
 chch_t( 89,'BOB       ',  1,'TR        ','          ',  0,  0,  0),  &
 !  78

Note: may also need to technically make changes to old emissions routines. However, job runs as is. May not need to make changes to STASH block in ukca_setd1defs.F90, as this is for old scheme.