Skip to content

Commit

Permalink
more sane way to control nitrogen deposition to surface models
Browse files Browse the repository at this point in the history
	modified:   bld/build-namelist
	modified:   bld/namelist_files/namelist_defaults_cam.xml
	modified:   bld/namelist_files/namelist_definition.xml
	modified:   bld/namelist_files/use_cases/1850_cam_lt.xml
	modified:   bld/namelist_files/use_cases/1850_cam_mt.xml
	modified:   bld/namelist_files/use_cases/hist_cam_lt.xml
	modified:   bld/namelist_files/use_cases/hist_cam_mt.xml
	modified:   cime_config/buildnml
	modified:   cime_config/config_component.xml
	modified:   src/chemistry/mozart/chemistry.F90
	modified:   src/chemistry/mozart/mo_chm_diags.F90
	modified:   src/chemistry/pp_none/chemistry.F90
	modified:   src/control/camsrfexch.F90
	modified:   src/control/runtime_opts.F90
	modified:   src/cpl/nuopc/atm_import_export.F90
	modified:   src/cpl/nuopc/atm_stream_ndep.F90
	modified:   src/physics/cam/cam_diagnostics.F90
	modified:   src/utils/srf_field_check.F90
  • Loading branch information
fvitt committed Dec 11, 2024
1 parent 47dd341 commit fa69b87
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 229 deletions.
8 changes: 0 additions & 8 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,6 @@ if ($phys_mode_flags > 1) {
my $simple_phys = 0;
if ($adia_mode or $ideal_mode) { $simple_phys = 1; }

# If running either a simple physics or an aquaplanet configuration, the nitrogen
# deposition data is not used. These files are set in buildnml and can't be overridden
# via user_nl_cam. So provide an override here.
if ($simple_phys or $aqua_mode) {
$nl->set_variable_value('ndep_stream_nl', 'stream_ndep_data_filename', '" "');
$nl->set_variable_value('ndep_stream_nl', 'stream_ndep_mesh_filename', '" "');
}

# Single column mode
my $scam = $cfg->get('scam');
my $scam_iop = $cfg->get('scam_iop');
Expand Down
7 changes: 7 additions & 0 deletions bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,13 @@
<soil_erod_file phys="cam4" >atm/cam/dst/dst_source2x2tuned-cam4-06132012.nc</soil_erod_file>
<soil_erod_file phys="cam4" hgrid="0.9x1.25">atm/cam/dst/dst_source1x1tuned-cam4-06202012.nc</soil_erod_file>

<!-- nitrogen deposition to surface models -->
<stream_ndep_data_filename>lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</stream_ndep_data_filename>
<stream_ndep_mesh_filename>share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</stream_ndep_mesh_filename>
<stream_ndep_year_first>2000</stream_ndep_year_first>
<stream_ndep_year_last>2000</stream_ndep_year_last>
<stream_ndep_year_align>1</stream_ndep_year_align>

<!-- Turbulent Mountain Stress -->
<do_tms > .false. </do_tms>
<do_tms waccm_phys="1" phys="cam4" > .true. </do_tms>
Expand Down
19 changes: 4 additions & 15 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7609,40 +7609,29 @@ Bubble-mediated sea-air transfer. See ocean_emis.F90 for details.
Default: FALSE
</entry>

<entry id="ndep_list" type="char*16(2)" category="Nitrogen Deposition"
group="ndep_inparm" valid_values="" >
List of nitrogen deposition fluxes to be sent from CAM to surface models.
Default: set by build-namelist.
</entry>

<entry id="stream_ndep_year_first" type="integer" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="" >
Year first to use in nitrogen deposition stream data. Set by case xml variable
CAM_STREAM_NDEP_YEAR_FIRST
Year first to use in nitrogen deposition stream data.
</entry>

<entry id="stream_ndep_year_last" type="integer" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="" >
Year last to use in nitrogen deposition stream data.
Set by case xml variable CAM_STREAM_NDEP_YEAR_LAST
</entry>

<entry id="stream_ndep_year_align" type="integer" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="" >
Model year to align with CAM_STREAM_NDEP_YEAR_FIRST.
Set by case xml variable CAM_STREAM_NDEP_YEAR_ALIGN
Model year to align with stream_ndep_year_first.
</entry>

<entry id="stream_ndep_data_filename" type="char*256" input_pathname="abs" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="" >
NDEP stream data filename.
Set by case xml variable CAM_STREAM_NDEP_DATA_FILENAME.
Nitrogen deposition stream data filename.
</entry>

<entry id="stream_ndep_mesh_filename" type="char*256" input_pathname="abs" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="" >
NDEP mesh file corresponding to sream_ndep_data_filename.
Set by case xml variable CAM_STREAM_NDEP_MESH_FILENAME.
Grid mesh file corresponding to stream_ndep_data_filename.
</entry>

<entry id="megan_factors_file" type="char*256" input_pathname="abs" category="VOC_emissions"
Expand Down
7 changes: 7 additions & 0 deletions bld/namelist_files/use_cases/1850_cam_lt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@
<csw_time_type>CYCLICAL</csw_time_type>
<csw_cycle_yr>1850 </csw_cycle_yr>

<!-- prescribed nitrogen deposition fluxes -->
<stream_ndep_data_filename>lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</stream_ndep_data_filename>
<stream_ndep_mesh_filename>share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</stream_ndep_mesh_filename>
<stream_ndep_year_first>1850</stream_ndep_year_first>
<stream_ndep_year_last>1850</stream_ndep_year_last>
<stream_ndep_year_align>1</stream_ndep_year_align>

</namelist_defaults>
7 changes: 7 additions & 0 deletions bld/namelist_files/use_cases/1850_cam_mt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@
<csw_time_type>CYCLICAL</csw_time_type>
<csw_cycle_yr>1850 </csw_cycle_yr>

<!-- prescribed nitrogen deposition fluxes -->
<stream_ndep_data_filename>lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</stream_ndep_data_filename>
<stream_ndep_mesh_filename>share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</stream_ndep_mesh_filename>
<stream_ndep_year_first>1850</stream_ndep_year_first>
<stream_ndep_year_last>1850</stream_ndep_year_last>
<stream_ndep_year_align>1</stream_ndep_year_align>

</namelist_defaults>
7 changes: 7 additions & 0 deletions bld/namelist_files/use_cases/hist_cam_lt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@
<srf_emis_type>INTERP_MISSING_MONTHS</srf_emis_type>
<csw_time_type>SERIAL</csw_time_type>

<!-- prescribed nitrogen deposition fluxes -->
<stream_ndep_data_filename>lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</stream_ndep_data_filename>
<stream_ndep_mesh_filename>share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</stream_ndep_mesh_filename>
<stream_ndep_year_first>1850</stream_ndep_year_first>
<stream_ndep_year_last>2015</stream_ndep_year_last>
<stream_ndep_year_align>1850</stream_ndep_year_align>

</namelist_defaults>
7 changes: 7 additions & 0 deletions bld/namelist_files/use_cases/hist_cam_mt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@
<srf_emis_type>INTERP_MISSING_MONTHS</srf_emis_type>
<csw_time_type>SERIAL</csw_time_type>

<!-- prescribed nitrogen deposition fluxes -->
<stream_ndep_data_filename>lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</stream_ndep_data_filename>
<stream_ndep_mesh_filename>share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</stream_ndep_mesh_filename>
<stream_ndep_year_first>1850</stream_ndep_year_first>
<stream_ndep_year_last>2015</stream_ndep_year_last>
<stream_ndep_year_align>1850</stream_ndep_year_align>

</namelist_defaults>
12 changes: 0 additions & 12 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ def buildnml(case, caseroot, compname):
RUN_REFTOD = case.get_value("RUN_REFTOD")
COMP_INTERFACE = case.get_value("COMP_INTERFACE")

stream_ndep_year_first = case.get_value("CAM_STREAM_NDEP_YEAR_FIRST")
stream_ndep_year_last = case.get_value("CAM_STREAM_NDEP_YEAR_LAST")
stream_ndep_year_align = case.get_value("CAM_STREAM_NDEP_YEAR_ALIGN")
stream_ndep_data_filename = case.get_value("CAM_STREAM_NDEP_DATA_FILENAME")
stream_ndep_mesh_filename = case.get_value("CAM_STREAM_NDEP_MESH_FILENAME")

testsrc = os.path.join(srcroot, "components", "cam")
if os.path.exists(testsrc):
srcroot = testsrc
Expand Down Expand Up @@ -173,12 +167,6 @@ def buildnml(case, caseroot, compname):

buildnl_opts += ["-inputdata", input_data_list]

CAM_NAMELIST_OPTS += " stream_ndep_year_first=" + stream_ndep_year_first
CAM_NAMELIST_OPTS += " stream_ndep_year_last=" + stream_ndep_year_last
CAM_NAMELIST_OPTS += " stream_ndep_year_align=" + stream_ndep_year_align
CAM_NAMELIST_OPTS += " stream_ndep_data_filename='" + stream_ndep_data_filename.strip() + "'"
CAM_NAMELIST_OPTS += " stream_ndep_mesh_filename='" + stream_ndep_mesh_filename.strip() + "'"

buildnl_opts += ["-namelist",
'" &atmexp ' + CAM_NAMELIST_OPTS + '/" ']

Expand Down
73 changes: 0 additions & 73 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,79 +383,6 @@
<desc>User mods to apply to specific compset matches. </desc>
</entry>

<!--
===============
NDEP Forcing from Streams
===============
-->

<entry id="CAM_STREAM_NDEP_YEAR_FIRST">
<type>char</type>
<default_value>2000</default_value>
<values match="last">
<value compset="^1850[CE]?_">1850</value>
<value compset="^2010_">2010</value>
<value compset="^HIST[CE]?_">1850</value>
<value compset="^SSP" >2015</value>
</values>
<group>run_component_cam</group>
<file>env_run.xml</file>
<desc>Nitrogen deposition data year first</desc>
</entry>

<entry id="CAM_STREAM_NDEP_YEAR_LAST">
<type>char</type>
<default_value>2000</default_value>
<values match="last">
<value compset="^2010_">2010</value>
<value compset="^1850[CE]?_">1850</value>
<value compset="^HIST[CE]?_">2015</value>
<value compset="^SSP" >2101</value>
</values>
<group>run_component_cam</group>
<file>env_run.xml</file>
<desc>Nitrogen deposition data year last</desc>
</entry>

<entry id="CAM_STREAM_NDEP_YEAR_ALIGN">
<type>char</type>
<default_value>1</default_value>
<values match="last">
<value compset="^HIST[CE]?_">1850</value>
<value compset="^SSP" >2015</value>
</values>
<group>run_component_cam</group>
<file>env_run.xml</file>
<desc>Nitrogen deposition align CAM_STREAM_NDEP_YEAR_FIRST with this model year</desc>
</entry>

<entry id="CAM_STREAM_NDEP_DATA_FILENAME">
<!-- Only the CMIP6 Tier I Nitogen deposition files are available -->
<type>char</type>
<default_value>UNSET</default_value>
<values match="last">
<value compset="^SSP585_">$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc</value>
<value compset="^SSP126_">$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc</value>
<value compset="^SSP245_">$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc</value>
<value compset="^SSP370_">$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.002_1849-2101_monthly_0.9x1.25_c211216.nc</value>
<value compset="^HIST[CE]?_" >$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</value>
<value compset="^2000_" >$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</value>
<value compset="^2010_" >$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc</value>
<value compset="^1850[CE]?_" >$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc</value>
</values>
<group>run_component_cam</group>
<file>env_run.xml</file>
<desc>Nitrogen deposition data filename</desc>
</entry>

<entry id="CAM_STREAM_NDEP_MESH_FILENAME">
<type>char</type>
<default_value>$DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</default_value>
<group>run_component_cam</group>
<file>env_run.xml</file>
<desc>Nitrogen deposition mesh filename (corresponding to the CAM_STREAM_NDEP_DATA_FILENAME)</desc>
</entry>

<help>
=========================================
CAM naming conventions
Expand Down
15 changes: 10 additions & 5 deletions src/chemistry/mozart/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module chemistry
use ref_pres, only : ptop_ref
use phys_control, only : waccmx_is ! WACCM-X switch query function
use phys_control, only : use_hemco ! HEMCO switch logical
use mo_chm_diags, only : chem_has_ndep_flx => chm_prod_ndep_flx

implicit none
private
Expand All @@ -46,6 +47,7 @@ module chemistry
public :: chem_read_restart
public :: chem_init_restart
public :: chem_emissions
public :: chem_has_ndep_flx

integer, public :: imozart = -1 ! index of 1st constituent

Expand Down Expand Up @@ -1147,6 +1149,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
use mo_neu_wetdep, only : neu_wetdep_tend
use aerodep_flx, only : aerodep_flx_prescribed
use short_lived_species, only : short_lived_species_writeic
use atm_stream_ndep, only : ndep_stream_active

implicit none

Expand Down Expand Up @@ -1265,11 +1268,13 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
cam_out%precc, cam_out%precl, cam_in%snowhland, ghg_chem, state%latmapback, &
drydepflx, wetdepflx, cam_in%cflx, cam_in%fireflx, cam_in%fireztop, &
nhx_nitrogen_flx, noy_nitrogen_flx, use_hemco, ptend%q, pbuf )
if (associated(cam_out%nhx_nitrogen_flx)) then
cam_out%nhx_nitrogen_flx(:ncol) = nhx_nitrogen_flx(:ncol)
endif
if (associated(cam_out%noy_nitrogen_flx)) then
cam_out%noy_nitrogen_flx(:ncol) = noy_nitrogen_flx(:ncol)
if (.not.ndep_stream_active) then
if (associated(cam_out%nhx_nitrogen_flx)) then
cam_out%nhx_nitrogen_flx(:ncol) = nhx_nitrogen_flx(:ncol)
endif
if (associated(cam_out%noy_nitrogen_flx)) then
cam_out%noy_nitrogen_flx(:ncol) = noy_nitrogen_flx(:ncol)
endif
endif

call t_stopf( 'chemdr' )
Expand Down
5 changes: 5 additions & 0 deletions src/chemistry/mozart/mo_chm_diags.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module mo_chm_diags
public :: chm_diags_inti
public :: chm_diags
public :: het_diags
public :: chm_prod_ndep_flx

integer :: id_n,id_no,id_no2,id_no3,id_n2o5,id_hno3,id_ho2no2,id_clono2,id_brono2
integer :: id_isopfdn, id_isopfdnc, id_terpfdn !these are dinitrates
Expand Down Expand Up @@ -55,6 +56,8 @@ module mo_chm_diags
real(r8), parameter :: N_molwgt = 14.00674_r8
real(r8), parameter :: S_molwgt = 32.066_r8

logical, protected :: chm_prod_ndep_flx =.false.

contains

subroutine chm_diags_inti
Expand Down Expand Up @@ -330,6 +333,8 @@ subroutine chm_diags_inti

toth_species = (/ id_ch4, id_h2o, id_h2 /)

chm_prod_ndep_flx = any(noy_species>0) .or. any(nhx_species>0)

call addfld( 'NOX', (/ 'lev' /), 'A', 'mol/mol', 'nox (N+NO+NO2)' )
call addfld( 'NOY', (/ 'lev' /), 'A', 'mol/mol', &
'noy = total nitrogen (N+NO+NO2+NO3+2N2O5+HNO3+HO2NO2+ORGNOY+NH4NO3)' )
Expand Down
Loading

0 comments on commit fa69b87

Please sign in to comment.