Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ozone DATM streams #188

Merged
merged 30 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bb7b710
added skip_restart_read logic needed for CTSM spin-up runs
Apr 16, 2022
310b399
addition -f new streams for datm
Apr 16, 2022
a07a078
fixes for getting streams with vector fields to work correctly
Apr 16, 2022
4bd6847
fixes for failed tests
Apr 19, 2022
992ef15
added ndep stream data
Mar 15, 2022
153b5cd
added ndep stream functionality
Apr 22, 2022
08da3ef
Merge remote-tracking branch 'myfork/feature/add_missing_datm_streams…
Apr 22, 2022
2201db4
first changes for ozone stream
Apr 28, 2022
93802ac
added ozone stream
May 4, 2022
94e013c
more updates for ozone
May 4, 2022
4cc26e7
merge in master
Aug 17, 2022
3810c33
update to fix some typos and add dshr_state_check for o3
Aug 17, 2022
6e9969a
add flds_preso3 to namelist definition
Aug 17, 2022
da9b542
set flds_preso3 to default false
Aug 17, 2022
d98af44
typo fix
adrifoster Aug 17, 2022
5ab6093
update file name
adrifoster Aug 18, 2022
975a566
add more ozone stream_entries
Aug 18, 2022
a6eca8e
add compset stream matches
Aug 18, 2022
4c23fca
update stream definitions
Aug 19, 2022
7cd1ca1
create drv_flds_in file
Aug 25, 2022
32801b5
update file names
adrifoster Aug 25, 2022
0ef7a64
update presaero stream entry and presndep stream entries - typo fixes
adrifoster Aug 26, 2022
c2220d6
Merge branch 'master' into ozone_update_mv
Aug 26, 2022
7f47d60
update ozone file locations
Aug 26, 2022
753ced5
Merge branch 'master' into ozone_update_mv
adrifoster Aug 29, 2022
73bc63b
Merge branch 'master' into ozone_update_mv
adrifoster Aug 30, 2022
540e0cf
updaing config component for stub/data land
Aug 30, 2022
bc449c5
add comment about stub land
Aug 30, 2022
b371237
fix typo in comment
Aug 31, 2022
e760d8e
fix small typo
Sep 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ module cdeps_datm_comp
character(CL) :: factorFn_data = 'null' ! file containing correction factors data
logical :: flds_presaero = .false. ! true => send valid prescribed aero fields to mediator
logical :: flds_presndep = .false. ! true => send valid prescribed ndep fields to mediator
logical :: flds_preso3 = .false. ! true => send valid prescribed ozone fields to mediator
logical :: flds_co2 = .false. ! true => send prescribed co2 to mediator
logical :: flds_wiso = .false. ! true => send water isotopes to mediator
character(CL) :: bias_correct = nullstr ! send bias correction fields to coupler
Expand Down Expand Up @@ -230,7 +231,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
model_meshfile, model_maskfile, &
nx_global, ny_global, restfilm, iradsw, factorFn_data, factorFn_mesh, &
flds_presaero, flds_co2, flds_wiso, bias_correct, anomaly_forcing, &
skip_restart_read, flds_presndep
skip_restart_read, flds_presndep, flds_preso3

rc = ESMF_SUCCESS

Expand Down Expand Up @@ -270,6 +271,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call shr_mpi_bcast(restfilm , mpicom, 'restfilm')
call shr_mpi_bcast(flds_presaero , mpicom, 'flds_presaero')
call shr_mpi_bcast(flds_presndep , mpicom, 'flds_presndep')
call shr_mpi_bcast(flds_preso3 , mpicom, 'flds_preso3')
call shr_mpi_bcast(flds_co2 , mpicom, 'flds_co2')
call shr_mpi_bcast(flds_wiso , mpicom, 'flds_wiso')
call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read')
Expand All @@ -288,6 +290,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
write(logunit,F00)' factorFn_mesh = ',trim(factorFn_mesh)
write(logunit,F02)' flds_presaero = ',flds_presaero
write(logunit,F02)' flds_presndep = ',flds_presndep
write(logunit,F02)' flds_preso3 = ',flds_preso3
write(logunit,F02)' flds_co2 = ',flds_co2
write(logunit,F02)' flds_wiso = ',flds_wiso
write(logunit,F02)' skip_restart_read = ',skip_restart_read
Expand Down Expand Up @@ -319,7 +322,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case ('CLMNCEP')
call datm_datamode_clmncep_advertise(exportState, fldsExport, flds_scalar_name, &
flds_co2, flds_wiso, flds_presaero, flds_presndep, rc)
flds_co2, flds_wiso, flds_presaero, flds_presndep, flds_preso3, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case ('CPLHIST')
call datm_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, &
Expand Down
37 changes: 35 additions & 2 deletions datm/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _get_neon_data_availability(case, neonsite):
oldestdate = datetime.strptime(neonatm[-10:],"%Y-%m.nc")
neonatm = f'cdeps/{version}/{neonsite}/'+neonatm
datavaliddate.append(neonatm)
if newestdate:
if newestdate:
logger.info("Found tower data version {} for {} through {}".format(version, oldestdate, newestdate))
datavaliddate.sort()
return datavaliddate
Expand Down Expand Up @@ -105,6 +105,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
datm_topo = case.get_value("DATM_TOPO")
datm_presaero = case.get_value("DATM_PRESAERO")
datm_presndep = case.get_value("DATM_PRESNDEP")
datm_preso3 = case.get_value("DATM_PRESO3")
datm_co2_tseries = case.get_value("DATM_CO2_TSERIES")
atm_grid = case.get_value("ATM_GRID")
model_grid = case.get_value("GRID")
Expand All @@ -116,6 +117,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
"A DATM_MODE for CLM is incompatible with DATM_PRESAERO=none.")
expect(datm_presndep != "none",
"A DATM_MODE for CLM is incompatible with DATM_PRESNDEP=none.")
expect(datm_preso3 != "none",
"A DATM_MODE for CLM is incompatible with DATM_PRESO3=none.")
expect(datm_topo != "none",
"A DATM_MODE for CLM is incompatible with DATM_TOPO=none.")

Expand All @@ -124,6 +127,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
logger.debug("DATM grid is {}".format(atm_grid))
logger.debug("DATM presaero mode is {}".format(datm_presaero))
logger.debug("DATM presndep mode is {}".format(datm_presndep))
logger.debug("DATM preso3 mode is {}".format(datm_preso3))
logger.debug("DATM topo mode is {}".format(datm_topo))

# Initialize namelist defaults
Expand All @@ -143,6 +147,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
config['datm_co2_tseries'] = datm_co2_tseries
config['datm_presaero'] = datm_presaero
config['datm_presndep'] = datm_presndep
config['datm_preso3'] = datm_preso3

if case.get_value('PTS_LON'):
scol_lon = float(case.get_value('PTS_LON'))
Expand Down Expand Up @@ -173,10 +178,13 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
streamlist.append("presaero.{}".format(datm_presaero))
if datm_presndep != "none":
streamlist.append("presndep.{}".format(datm_presndep))
if datm_preso3 != "none":
streamlist.append("preso3.{}".format(datm_preso3))
if datm_topo != "none":
streamlist.append("topo.{}".format(datm_topo))
if datm_co2_tseries != "none":
streamlist.append("co2tseries.{}".format(datm_co2_tseries))

bias_correct = nmlgen.get_value("bias_correct")
if bias_correct is not None:
streamlist.append(bias_correct)
Expand All @@ -189,10 +197,33 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
schema_file = os.path.join(_CDEPS_CONFIG,"stream_definition_v2.0.xsd")
stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "datm","cime_config","stream_definition_datm.xml")
streams = StreamCDEPS(stream_file, schema_file)
streams.create_stream_xml(streamlist, case, outfile, data_list_path,
streams.create_stream_xml(streamlist, case, outfile, data_list_path,
os.path.join(caseroot,'user_nl_datm_streams'+inst_string),
available_neon_data=available_neon_data)


####################################################################################
def _create_drv_flds_in(case, confdir):
####################################################################################
datm_preso3 = case.get_value("DATM_PRESO3")

# for now we are hard-coding this file name and values because we only need it for ozone
if datm_preso3 != "none":

# Generate drv_flds_in file
outfile = os.path.join(confdir, "drv_flds_in")
ozone_nl_name = "&ozone_coupling_nl"
ozone_freq_par = "atm_ozone_frequency"
ozone_freq_val = "'multiday_average'"
nl_fin = "/"

with open(outfile, "w") as drv_fl:
drv_fl.write("{}\n".format(ozone_nl_name))
drv_fl.write(" {} = {}\n".format(ozone_freq_par, ozone_freq_val))
drv_fl.write("{}\n".format(nl_fin))



###############################################################################
def buildnml(case, caseroot, compname):
###############################################################################
Expand Down Expand Up @@ -267,6 +298,8 @@ def buildnml(case, caseroot, compname):
# create namelist and stream file(s) data component
_create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path)

_create_drv_flds_in(case, confdir)

# copy namelist files and stream text files, to rundir
copy_inputs_to_rundir(caseroot, compname, confdir, rundir, inst_string)

Expand Down
24 changes: 23 additions & 1 deletion datm/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

<entry id="DATM_PRESNDEP">
<type>char</type>
<valid_values>none,clim_1850,clim_2000,clim_2010,hist,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5</valid_values>
<valid_values>none,clim_1850,clim_2000,clim_2010,hist,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5,cplhist</valid_values>
<default_value>clim_2000</default_value>
<values match="last">
<value compset="^1850_" >clim_1850</value>
Expand All @@ -112,6 +112,28 @@
<desc>DATM prescribed nitrogen deposition forcing</desc>
</entry>

<entry id="DATM_PRESO3">
<type>char</type>
<valid_values>none,clim_1850,clim_2000,clim_2010,hist,SSP2-4.5,SSP3-7.0,SSP5-8.5</valid_values>
<default_value>clim_2000</default_value>
<values match="last">
<value compset="^1850_" >clim_1850</value>
<value compset="^2000_" >clim_2000</value>
<value compset="^2010_" >clim_2010</value>
<value compset="^SSP245_" >SSP2-4.5</value>
<value compset="^SSP370_" >SSP3-7.0</value>
<value compset="^SSP585_" >SSP5-8.5</value>
<value compset="^HIST_" >hist</value>
<value compset="^20TR_" >hist</value>
<!-- Only needed for compsets with active land; only in DATM CLMNCEP mode -->
<value compset="_SLND">none</value>
<value compset="_DLND">none</value>
</values>
<group>run_component_datm</group>
<file>env_run.xml</file>
<desc>DATM prescribed ozone forcing</desc>
</entry>

<entry id="DATM_TOPO">
<type>char</type>
<valid_values>none,observed,cplhist</valid_values>
Expand Down
13 changes: 13 additions & 0 deletions datm/cime_config/namelist_definition_datm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,19 @@
</values>
</entry>

<entry id="flds_preso3">
<type>logical</type>
<category>datm</category>
<group>datm_nml</group>
<desc>
If true, prescribed o3 is sent from datm (must be true for running with CLM).
</desc>
<values>
<value>.true.</value>
<value datm_preso3="none">.false.</value>
</values>
</entry>

<entry id="flds_co2">
<type>logical</type>
<category>datm</category>
Expand Down
Loading