Skip to content

Commit

Permalink
Merge branch 'main' into fix/nsteps_alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b authored Apr 10, 2024
2 parents a7b782f + 3b1e50b commit 65c02bd
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 174 deletions.
2 changes: 2 additions & 0 deletions cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
<default_value>1</default_value>
<values match="last">
<value compset="_DLND.*_CISM\d">1</value>
<value compset="_DGLC">1</value>
<value compset="_SGLC">$ATM_NCPL</value>
<value compset="_XGLC">$ATM_NCPL</value>
<value compset="_MOM6">1</value>
Expand Down Expand Up @@ -537,6 +538,7 @@
<default_value>FALSE</default_value>
<values match="last">
<value compset="_CLM.+CISM\d">TRUE</value>
<value compset="_CLM.+DGLC%">TRUE</value>
<!-- Turn on two-way coupling for TG compsets - even though there are no
feedbacks for a TG compset, this will give us additional diagnostics -->
<value compset="_DLND.+CISM\d">TRUE</value>
Expand Down
223 changes: 74 additions & 149 deletions cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,80 @@
</values>
</entry>

<!-- ======================================= -->
<!-- MED auxiliary wav2med history files -->
<!-- ======================================= -->

<entry id="histaux_wav2med_file1_enabled">
<type>logical</type>
<category>aux_hist</category>
<group>ALLCOMP_attributes</group>
<values>
<value>.false.</value>
</values>
<desc>Auxiliary mediator wav2med average history output every day.
Note that ww3dev will use this configuration variable and send
the fields needed for wav2med auxiliary file</desc>
</entry>
<entry id="histaux_wav2med_file1_flds">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>Sw_hs_avg:Sw_Tm1_avg:Sw_thm_avg:Sw_u_avg:Sw_v_avg:Sw_ustokes_avg:Sw_vstokes_avg:Sw_tusx_avg:Sw_tusy_avg:Sw_thp0_avg:Sw_fp0_avg:Sw_phs0_avg:Sw_phs1_avg:Sw_pdir0_avg:Sw_pdir1_avg:Sw_pTm10_avg:Sw_pTm11_avg</value>
</values>
<desc>Auxiliary mediator wav2med file1 colon delimited output
fields. NOTE: these are assumed to be time averaged over a day in
the WW3 cap - so the settings of histaux_wav2med_file1_history_n
and histaux_wav2med_file1_history_option should be 1 and ndays,
respectively.</desc>
</entry>
<entry id="histaux_wav2med_file1_history_option">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>ndays</value>
</values>
<desc>Auxiliary mediator wav2med file1 output option</desc>
</entry>
<entry id="histaux_wav2med_file1_history_n">
<type>integer</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>1</value>
</values>
<desc>Auxiliary mediator wav2med file1 output frequency (used for option type)</desc>
</entry>
<entry id="histaux_wav2med_file1_doavg">
<type>logical</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>.false.</value>
</values>
<desc>Auxiliary mediator wav2med file1 time averaged flag for file output.
If this flag is set to .false. only instantaneous output will be created in the auxiliary file.</desc>
</entry>
<entry id="histaux_wav2med_file1_auxname">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>wav.24h.avg</value>
</values>
</entry>
<entry id="histaux_wav2med_file1_ntperfile">
<type>integer</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>Number of time samples per file.</desc>
<values>
<value>30</value>
</values>
</entry>

<!-- =========================== -->
<!-- MED mapping attributes -->
<!-- =========================== -->
Expand Down Expand Up @@ -2636,24 +2710,6 @@
</values>
</entry>

<!-- <entry id="esp_run_on_pause" modify_via_xml="ESP_RUN_ON_PAUSE"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- true => ESP component runs after driver 'pause cycle' If any -->
<!-- component 'pauses' (see PAUSE_OPTION, -->
<!-- PAUSE_N and DATA_ASSIMILATION_XXX XML -->
<!-- variables), the ESP component (if present) will be run to -->
<!-- process the component 'pause' (restart) files and set any -->
<!-- required 'resume' signals. If true, esp_cpl_dt and -->
<!-- esp_cpl_offset settings are ignored. default: true -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>.true.</value> -->
<!-- </values> -->
<!-- </entry> -->

<entry id="calendar" modify_via_xml="CALENDAR">
<type>char</type>
<category>time</category>
Expand Down Expand Up @@ -2875,137 +2931,6 @@
</values>
</entry>

<!-- <entry id="pause_option" modify_via_xml="PAUSE_OPTION"> -->
<!-- <type>char</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <valid_values>none,never,nsteps,nseconds,nminutes,nhours,ndays,monthly,nmonths,nyears</valid_values> -->
<!-- <desc> -->
<!-- sets the pause frequency with pause_n -->
<!-- pause_option alarms are: -->
<!-- [none/never], turns option off -->
<!-- [nsteps] , pauses every pause_n nsteps , relative to start or last pause time -->
<!-- [nseconds] , pauses every pause_n nseconds, relative to start or last pause time -->
<!-- [nminutes] , pauses every pause_n nminutes, relative to start or last pause time -->
<!-- [nhours] , pauses every pause_n nhours , relative to start or last pause time -->
<!-- [ndays] , pauses every pause_n ndays , relative to start or last pause time -->
<!-- [nmonths] , pauses every pause_n nmonths , relative to start or last pause time -->
<!-- [monthly] , pauses every month , relative to start or last pause time -->
<!-- [nyear] , pauses every pause_n nyears , relative to start or last pause time -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_OPTION</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_n" modify_via_xml="PAUSE_N"> -->
<!-- <type>integer</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Sets the pause frequency with pause_option -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_N</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_atm" modify_via_xml="PAUSE_ACTIVE_ATM"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component atm -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_ATM</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_cpl" modify_via_xml="PAUSE_ACTIVE_CPL"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component CPL -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_CPL</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_ocn" modify_via_xml="PAUSE_ACTIVE_OCN"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component ocn -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_OCN</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_wav" modify_via_xml="PAUSE_ACTIVE_WAV"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component wav -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_WAV</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_glc" modify_via_xml="PAUSE_ACTIVE_GLC"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component glc -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_GLC</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_rof" modify_via_xml="PAUSE_ACTIVE_ROF"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component rof -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_ROF</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_ice" modify_via_xml="PAUSE_ACTIVE_ICE"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component ice -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_ICE</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_lnd" modify_via_xml="PAUSE_ACTIVE_LND"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component lnd -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_LND</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- =========================== -->
<!-- PELAYOUT attributes -->
<!-- =========================== -->
Expand Down
8 changes: 7 additions & 1 deletion cime_config/runseq/driver_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __compute_glc(self, case, coupling_times):
med_to_glc = False
elif (comp_glc == 'cism'):
if not case.get_value("CISM_EVOLVE"):
med_to_glc = False
run_glc = False

# If CISM is not evolving only get data back from cism at the initial time
# However will still need to call the exchange at the end if the stop_option
Expand All @@ -77,6 +77,12 @@ def __compute_glc(self, case, coupling_times):
glc_coupling_time = stop_n * 86400
else:
glc_coupling_time = 86400
elif (comp_glc == 'dglc'):
glc_coupling_time = coupling_times["glc_cpl_dt"]
stop_option = case.get_value('STOP_OPTION')
stop_n = case.get_value('STOP_N')
if stop_option == 'nsteps':
glc_coupling_time = stop_n*coupling_times["atm_cpl_dt"]
elif (comp_glc == 'xglc'):
glc_coupling_time = coupling_times["glc_cpl_dt"]
else:
Expand Down
6 changes: 4 additions & 2 deletions cime_config/runseq/runseq_TG.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def gen_runseq(case, coupling_times):
runseq.add_action ("MED med_phases_post_lnd" , run_lnd)
runseq.add_action ("MED med_phases_prep_glc" , med_to_glc)
runseq.add_action ("MED -> GLC :remapMethod=redist" , med_to_glc)
runseq.add_action ("GLC" , run_glc and med_to_glc)
runseq.add_action ("GLC -> MED :remapMethod=redist" , run_glc)
runseq.add_action ("GLC" , run_glc)
# Need to do GLC -> MED even if not running GLC; otherwise, we get a
# failure in InitializeRealize ("Object being used before creation")
runseq.add_action ("GLC -> MED :remapMethod=redist" , med_to_glc)
runseq.add_action ("MED med_phases_history_write" , True)

runseq.leave_time_loop(True)
Expand Down
41 changes: 22 additions & 19 deletions cime_config/runseq/runseq_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def gen_runseq(case, coupling_times):
cpl_seq_option = case.get_value('CPL_SEQ_OPTION')
coupling_mode = case.get_value('COUPLING_MODE')
diag_mode = case.get_value('BUDGETS')
xcompset = case.get_value("COMP_ATM") == 'xatm'
xcompset = case.get_value("COMP_ATM") == 'xatm'
cpl_add_aoflux = not xcompset and case.get_value('ADD_AOFLUX_TO_RUNSEQ')

# It is assumed that if a component will be run it will send information to the mediator
Expand All @@ -35,19 +35,6 @@ def gen_runseq(case, coupling_times):
run_rof, med_to_rof, rof_cpl_time = driver_config['rof']
run_wav, med_to_wav, wav_cpl_time = driver_config['wav']

comp_glc = case.get_value("COMP_GLC")
run_glc = False
post_glc = False
if (comp_glc == 'cism'):
run_glc = True
if case.get_value("CISM_EVOLVE"):
post_glc = True
else:
post_glc = False
elif (comp_glc == 'xglc'):
run_glc = True
post_glc = True

# Note: assume that atm_cpl_dt, lnd_cpl_dt, ice_cpl_dt and wav_cpl_dt are the same

if lnd_cpl_time != atm_cpl_time:
Expand All @@ -59,18 +46,32 @@ def gen_runseq(case, coupling_times):
if rof_cpl_time < ocn_cpl_time:
expect(False, "assume that rof_cpl_time is always greater than or equal to ocn_cpl_time")

if run_glc:
# It wouldn't make sense to run GLC unless we also do MED -> GLC to transfer fields to GLC,
# and some of the below logic controlling what appears in the run sequence depends on this
# (i.e., depends on the fact that, if run_glc is True, then med_to_glc is also True).
expect(med_to_glc, "if run_glc is True, then med_to_glc must also be True")

rof_outer_loop = run_rof and rof_cpl_time > atm_cpl_time
ocn_outer_loop = run_ocn and ocn_cpl_time > atm_cpl_time

# Note that we do some aspects of the GLC outer loop even if run_glc is False
# (as long as med_to_glc is True).
#
# Note that, in contrast to the other outer_loop variables, this doesn't check glc_cpl_time.
# This is for consistency with the logic that was in place before adding this variable;
# this seems to implicitly assume that glc_cpl_time > atm_cpl_time.
glc_outer_loop = med_to_glc

inner_loop = ((atm_cpl_time < ocn_cpl_time) or
(atm_cpl_time < rof_cpl_time) or
(run_glc and atm_cpl_time < glc_cpl_time) or
(glc_outer_loop and atm_cpl_time < glc_cpl_time) or
atm_cpl_time == ocn_cpl_time)

with RunSeq(os.path.join(caseroot, "CaseDocs", "nuopc.runseq")) as runseq:

#------------------
runseq.enter_time_loop(glc_cpl_time, newtime=run_glc, active=med_to_glc)
runseq.enter_time_loop(glc_cpl_time, newtime=glc_outer_loop)
#------------------

#------------------
Expand Down Expand Up @@ -199,8 +200,10 @@ def gen_runseq(case, coupling_times):

runseq.add_action("MED med_phases_prep_glc" , med_to_glc)
runseq.add_action("MED -> GLC :remapMethod=redist" , med_to_glc)
runseq.add_action("GLC" , run_glc and med_to_glc)
runseq.add_action("GLC -> MED :remapMethod=redist" , run_glc)
runseq.add_action("MED med_phases_post_glc" , run_glc and post_glc)
runseq.add_action("GLC" , run_glc)
# Need to do GLC -> MED even if not running GLC; otherwise, we get a
# failure in InitializeRealize ("Object being used before creation")
runseq.add_action("GLC -> MED :remapMethod=redist" , med_to_glc)
runseq.add_action("MED med_phases_post_glc" , run_glc)

shutil.copy(os.path.join(caseroot, "CaseDocs", "nuopc.runseq"), rundir)
Loading

0 comments on commit 65c02bd

Please sign in to comment.