Skip to content
Merged
25 changes: 25 additions & 0 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,35 @@ if (!($simple_phys or $aqua_mode)) {
add_default($nl, 'stream_ndep_year_first' , 'sim_year'=>$sim_year);
add_default($nl, 'stream_ndep_year_last' , 'sim_year'=>$sim_year);
add_default($nl, 'stream_ndep_year_align' , 'sim_year'=>$sim_year);
add_default($nl, 'stream_ndep_taxmode' , 'sim_year'=>$sim_year);
add_default($nl, 'stream_ndep_varlist');
}
}

# Setup default co2 surface source stream only if not simple_phys or aqua_mode and
# the chemistry cannot produce the nitrogen depostion fluxes
if (!($simple_phys or $aqua_mode)) {
add_default($nl, 'co2_surface_source');
if ($nl->get_value('co2_surface_source') =~ /$TRUE/io) {
if ( !(defined $nl->get_value('stream_co2_surface_source_mesh_filename') and
defined $nl->get_value('stream_co2_surface_source_data_filename') and
defined $nl->get_value('stream_co2_surface_source_data_varname') and
defined $nl->get_value('stream_co2_surface_source_year_first') and
defined $nl->get_value('stream_co2_surface_source_year_last') and
defined $nl->get_value('stream_co2_surface_source_year_align') and
defined $nl->get_value('stream_co2_surface_source_taxmode') ) ) {
die "$ProgName - ERROR: if co2_surface_source is .true. then the following must be defined:
stream_co2_surface_source_mesh_filename,
stream_co2_surface_source_data_filename,
stream_co2_surface_source_data_varname,
stream_co2_surface_source_taxmode,
stream_co2_surface_source_year_first,
stream_co2_surface_source_year_last,
stream_co2_surface_source_year_align\n";
}
}
}

# Topography
add_default($nl, 'use_topo_file');
my $use_topo_file = $nl->get_value('use_topo_file');
Expand Down
8 changes: 7 additions & 1 deletion bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,9 @@
<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>

<!-- co2 surface source (overwrite co2_diag sent to land and ocean) -->
<co2_surface_source>.false.</co2_surface_source>

<!-- nitrogen deposition to surface components -->
<stream_ndep_varlist>NDEP_NHx_month:NDEP_NOy_month</stream_ndep_varlist>
<stream_ndep_varlist phys="cam7">drynhx:wetnhx:drynoy:wetnoy</stream_ndep_varlist>
Expand All @@ -2032,8 +2035,11 @@
<stream_ndep_year_last sim_year="1850-2022">2022</stream_ndep_year_last>
<stream_ndep_year_last sim_year="2010">2010</stream_ndep_year_last>

<stream_ndep_taxmode >cycle</stream_ndep_taxmode>
<stream_ndep_taxmode sim_year="1850-2022">extend</stream_ndep_taxmode>

<stream_ndep_year_align >1</stream_ndep_year_align>
<stream_ndep_year_align sim_year="1850-2015">1850</stream_ndep_year_align>
<stream_ndep_year_align sim_year="1850-2022">1850</stream_ndep_year_align>

<!-- Turbulent Mountain Stress -->
<do_tms > .false. </do_tms>
Expand Down
66 changes: 65 additions & 1 deletion bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8256,6 +8256,14 @@ calendar is setup to span the same year range as the forcing data.
Set by build-namelist.
Default: 1
</entry>
<entry id="stream_ndep_taxmode" type="char*256" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="cycle,extend,limit" >
Time extrapolation algorithm to use for nitrogen deposition.
- cycle: Simply cycle through the available model data (i.e., start over when the end is reached)
- extend: Use the final value when end of data is reached.
- limit: Halt the model run if the model time exceeds the available data.
Default: extend for transient, otherwise cycle
</entry>

<entry id="stream_ndep_data_filename" type="char*256" input_pathname="abs" category="Nitrogen Deposition"
group="ndep_stream_nl" valid_values="" >
Expand All @@ -8264,7 +8272,7 @@ Nitrogen deposition stream data filename.

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

<entry id="stream_ndep_varlist" type="char*256" category="Nitrogen Deposition"
Expand Down Expand Up @@ -10282,4 +10290,60 @@ Path to ocean file
Default: path
</entry>

<!-- co2 surface source stream -->

<entry id="co2_surface_source" type="logical" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
If TRUE, set co2_diag sent to land and ocean to value read from co2_surface_source_data_filename
Default: FALSE
</entry>
<entry id="stream_co2_surface_source_mesh_filename" type="char*256" input_pathname="abs" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
Grid mesh file corresponding to stream_co2_surface_source_data_filename.
Must be set by user.
</entry>
<entry id="stream_co2_surface_source_data_filename" type="char*256" input_pathname="abs" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
Data source file for reading CO2 concentrations to be passed to the surface if co2_surface_source=.true.
Must be set by user.
</entry>
<entry id="stream_co2_surface_source_data_varname" type="char*256" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
Variable name for reading CO2 concentrations in stream_co2_surface_source_data_filename.
Must be set by user.
</entry>
<entry id="stream_co2_surface_source_taxmode" type="char*256" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="cycle,extend,limit" >
Time extrapolation algorithm to use for CO2 surface stream data.
- cycle: Simply cycle through the available model data (i.e., start over when the end is reached)
- extend: Use the final value when end of data is reached.
- limit: Halt the model run if the model time exceeds the available data.
Must be set by user.
</entry>
<entry id="stream_co2_surface_source_year_first" type="integer" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
First year to use in CO2 surface stream data.
Must be set by user.
</entry>
<entry id="stream_co2_surface_source_year_last" type="integer" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
Last year to use in CO2 surface stream data.
Must be set by user.
</entry>
<entry id="stream_co2_surface_source_year_align" type="integer" category="CO2 surface source"
group="co2_surface_source_stream_nl" valid_values="" >
The simulation year corresponding to stream_co2_surface_source_year_first.
A common usage is to set this to the first year of the model run
(corresponding to the xml variable RUN_STARTDATE). With this setting,
the forcing in the first year of the run will be the forcing of year
yearFirst.
Another usage is to align the calendar of transient forcing with the
model calendar. For example, setting yearAlign = yearFirst will lead
to the forcing calendar being the same as the model calendar. The
forcing for a given model year would be the forcing of the same
year. This would be appropriate in transient runs where the model
calendar is setup to span the same year range as the forcing data.
Must be set by user.
</entry>

</namelist_definition>
2 changes: 2 additions & 0 deletions src/control/runtime_opts.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
use surface_emissions_mod, only: surface_emissions_readnl
use elevated_emissions_mod, only: elevated_emissions_readnl
use atm_stream_ndep, only: stream_ndep_readnl
use atm_stream_co2, only: stream_co2_surface_source_readnl

!---------------------------Arguments-----------------------------------

Expand Down Expand Up @@ -209,6 +210,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
call surface_emissions_readnl(nlfilename)
call elevated_emissions_readnl(nlfilename)
call stream_ndep_readnl(nlfilename)
call stream_co2_surface_source_readnl(nlfilename)

end subroutine read_namelist

Expand Down
12 changes: 12 additions & 0 deletions src/cpl/nuopc/atm_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module atm_import_export
use chemistry , only : chem_has_ndep_flx
use cam_control_mod , only : aqua_planet, simple_phys
use cam_esmf_mod , only : cam_esmf_set_areas
use atm_stream_co2 , only : stream_co2_surface_source_init, stream_co2_surface_source_interp
use atm_stream_co2 , only : stream_co2_surface_source_is_initialized, co2_surface_source

implicit none
private ! except
Expand Down Expand Up @@ -1227,6 +1229,16 @@ subroutine export_fields(gcomp, cam_out, rc)
call state_getfldptr(exportState, 'Sa_co2diag', fldptr=fldptr_co2diag, exists=exists, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (exists) then
! if co2_surface_source is a filename - use this to overwrite co2_diag
if (co2_surface_source) then
if (.not. stream_co2_surface_source_is_initialized) then
call stream_co2_surface_source_init(rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
call stream_co2_surface_source_interp(cam_out, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

Comment thread
gold2718 marked this conversation as resolved.
g = 1
do c = begchunk,endchunk
do i = 1,get_ncols_p(c)
Expand Down
Loading
Loading