Skip to content

Commit 3b1e50b

Browse files
authored
Merge pull request #445 from mvertens/feature/add_dglc
Changes for the addition of a new dglc component
2 parents d6dc571 + 07bbf45 commit 3b1e50b

8 files changed

+648
-563
lines changed

cime_config/config_component_cesm.xml

+2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@
299299
<default_value>1</default_value>
300300
<values match="last">
301301
<value compset="_DLND.*_CISM\d">1</value>
302+
<value compset="_DGLC">1</value>
302303
<value compset="_SGLC">$ATM_NCPL</value>
303304
<value compset="_XGLC">$ATM_NCPL</value>
304305
<value compset="_MOM6">1</value>
@@ -537,6 +538,7 @@
537538
<default_value>FALSE</default_value>
538539
<values match="last">
539540
<value compset="_CLM.+CISM\d">TRUE</value>
541+
<value compset="_CLM.+DGLC%">TRUE</value>
540542
<!-- Turn on two-way coupling for TG compsets - even though there are no
541543
feedbacks for a TG compset, this will give us additional diagnostics -->
542544
<value compset="_DLND.+CISM\d">TRUE</value>

cime_config/namelist_definition_drv.xml

+74-149
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,80 @@
20862086
</values>
20872087
</entry>
20882088

2089+
<!-- ======================================= -->
2090+
<!-- MED auxiliary wav2med history files -->
2091+
<!-- ======================================= -->
2092+
2093+
<entry id="histaux_wav2med_file1_enabled">
2094+
<type>logical</type>
2095+
<category>aux_hist</category>
2096+
<group>ALLCOMP_attributes</group>
2097+
<values>
2098+
<value>.false.</value>
2099+
</values>
2100+
<desc>Auxiliary mediator wav2med average history output every day.
2101+
Note that ww3dev will use this configuration variable and send
2102+
the fields needed for wav2med auxiliary file</desc>
2103+
</entry>
2104+
<entry id="histaux_wav2med_file1_flds">
2105+
<type>char</type>
2106+
<category>aux_hist</category>
2107+
<group>MED_attributes</group>
2108+
<values>
2109+
<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>
2110+
</values>
2111+
<desc>Auxiliary mediator wav2med file1 colon delimited output
2112+
fields. NOTE: these are assumed to be time averaged over a day in
2113+
the WW3 cap - so the settings of histaux_wav2med_file1_history_n
2114+
and histaux_wav2med_file1_history_option should be 1 and ndays,
2115+
respectively.</desc>
2116+
</entry>
2117+
<entry id="histaux_wav2med_file1_history_option">
2118+
<type>char</type>
2119+
<category>aux_hist</category>
2120+
<group>MED_attributes</group>
2121+
<values>
2122+
<value>ndays</value>
2123+
</values>
2124+
<desc>Auxiliary mediator wav2med file1 output option</desc>
2125+
</entry>
2126+
<entry id="histaux_wav2med_file1_history_n">
2127+
<type>integer</type>
2128+
<category>aux_hist</category>
2129+
<group>MED_attributes</group>
2130+
<values>
2131+
<value>1</value>
2132+
</values>
2133+
<desc>Auxiliary mediator wav2med file1 output frequency (used for option type)</desc>
2134+
</entry>
2135+
<entry id="histaux_wav2med_file1_doavg">
2136+
<type>logical</type>
2137+
<category>aux_hist</category>
2138+
<group>MED_attributes</group>
2139+
<values>
2140+
<value>.false.</value>
2141+
</values>
2142+
<desc>Auxiliary mediator wav2med file1 time averaged flag for file output.
2143+
If this flag is set to .false. only instantaneous output will be created in the auxiliary file.</desc>
2144+
</entry>
2145+
<entry id="histaux_wav2med_file1_auxname">
2146+
<type>char</type>
2147+
<category>aux_hist</category>
2148+
<group>MED_attributes</group>
2149+
<values>
2150+
<value>wav.24h.avg</value>
2151+
</values>
2152+
</entry>
2153+
<entry id="histaux_wav2med_file1_ntperfile">
2154+
<type>integer</type>
2155+
<category>aux_hist</category>
2156+
<group>MED_attributes</group>
2157+
<desc>Number of time samples per file.</desc>
2158+
<values>
2159+
<value>30</value>
2160+
</values>
2161+
</entry>
2162+
20892163
<!-- =========================== -->
20902164
<!-- MED mapping attributes -->
20912165
<!-- =========================== -->
@@ -2635,24 +2709,6 @@
26352709
</values>
26362710
</entry>
26372711

2638-
<!-- <entry id="esp_run_on_pause" modify_via_xml="ESP_RUN_ON_PAUSE"> -->
2639-
<!-- <type>logical</type> -->
2640-
<!-- <category>time</category> -->
2641-
<!-- <group>CLOCK_attributes</group> -->
2642-
<!-- <desc> -->
2643-
<!-- true => ESP component runs after driver 'pause cycle' If any -->
2644-
<!-- component 'pauses' (see PAUSE_OPTION, -->
2645-
<!-- PAUSE_N and DATA_ASSIMILATION_XXX XML -->
2646-
<!-- variables), the ESP component (if present) will be run to -->
2647-
<!-- process the component 'pause' (restart) files and set any -->
2648-
<!-- required 'resume' signals. If true, esp_cpl_dt and -->
2649-
<!-- esp_cpl_offset settings are ignored. default: true -->
2650-
<!-- </desc> -->
2651-
<!-- <values> -->
2652-
<!-- <value>.true.</value> -->
2653-
<!-- </values> -->
2654-
<!-- </entry> -->
2655-
26562712
<entry id="calendar" modify_via_xml="CALENDAR">
26572713
<type>char</type>
26582714
<category>time</category>
@@ -2874,137 +2930,6 @@
28742930
</values>
28752931
</entry>
28762932

2877-
<!-- <entry id="pause_option" modify_via_xml="PAUSE_OPTION"> -->
2878-
<!-- <type>char</type> -->
2879-
<!-- <category>time</category> -->
2880-
<!-- <group>CLOCK_attributes</group> -->
2881-
<!-- <valid_values>none,never,nsteps,nseconds,nminutes,nhours,ndays,monthly,nmonths,nyears</valid_values> -->
2882-
<!-- <desc> -->
2883-
<!-- sets the pause frequency with pause_n -->
2884-
<!-- pause_option alarms are: -->
2885-
<!-- [none/never], turns option off -->
2886-
<!-- [nsteps] , pauses every pause_n nsteps , relative to start or last pause time -->
2887-
<!-- [nseconds] , pauses every pause_n nseconds, relative to start or last pause time -->
2888-
<!-- [nminutes] , pauses every pause_n nminutes, relative to start or last pause time -->
2889-
<!-- [nhours] , pauses every pause_n nhours , relative to start or last pause time -->
2890-
<!-- [ndays] , pauses every pause_n ndays , relative to start or last pause time -->
2891-
<!-- [nmonths] , pauses every pause_n nmonths , relative to start or last pause time -->
2892-
<!-- [monthly] , pauses every month , relative to start or last pause time -->
2893-
<!-- [nyear] , pauses every pause_n nyears , relative to start or last pause time -->
2894-
<!-- </desc> -->
2895-
<!-- <values> -->
2896-
<!-- <value>$PAUSE_OPTION</value> -->
2897-
<!-- </values> -->
2898-
<!-- </entry> -->
2899-
2900-
<!-- <entry id="pause_n" modify_via_xml="PAUSE_N"> -->
2901-
<!-- <type>integer</type> -->
2902-
<!-- <category>time</category> -->
2903-
<!-- <group>CLOCK_attributes</group> -->
2904-
<!-- <desc> -->
2905-
<!-- Sets the pause frequency with pause_option -->
2906-
<!-- </desc> -->
2907-
<!-- <values> -->
2908-
<!-- <value>$PAUSE_N</value> -->
2909-
<!-- </values> -->
2910-
<!-- </entry> -->
2911-
2912-
<!-- <entry id="pause_active_atm" modify_via_xml="PAUSE_ACTIVE_ATM"> -->
2913-
<!-- <type>logical</type> -->
2914-
<!-- <category>time</category> -->
2915-
<!-- <group>CLOCK_attributes</group> -->
2916-
<!-- <desc> -->
2917-
<!-- Whether Pause signals are active for component atm -->
2918-
<!-- </desc> -->
2919-
<!-- <values> -->
2920-
<!-- <value>$PAUSE_ACTIVE_ATM</value> -->
2921-
<!-- </values> -->
2922-
<!-- </entry> -->
2923-
2924-
<!-- <entry id="pause_active_cpl" modify_via_xml="PAUSE_ACTIVE_CPL"> -->
2925-
<!-- <type>logical</type> -->
2926-
<!-- <category>time</category> -->
2927-
<!-- <group>CLOCK_attributes</group> -->
2928-
<!-- <desc> -->
2929-
<!-- Whether Pause signals are active for component CPL -->
2930-
<!-- </desc> -->
2931-
<!-- <values> -->
2932-
<!-- <value>$PAUSE_ACTIVE_CPL</value> -->
2933-
<!-- </values> -->
2934-
<!-- </entry> -->
2935-
2936-
<!-- <entry id="pause_active_ocn" modify_via_xml="PAUSE_ACTIVE_OCN"> -->
2937-
<!-- <type>logical</type> -->
2938-
<!-- <category>time</category> -->
2939-
<!-- <group>CLOCK_attributes</group> -->
2940-
<!-- <desc> -->
2941-
<!-- Whether Pause signals are active for component ocn -->
2942-
<!-- </desc> -->
2943-
<!-- <values> -->
2944-
<!-- <value>$PAUSE_ACTIVE_OCN</value> -->
2945-
<!-- </values> -->
2946-
<!-- </entry> -->
2947-
2948-
<!-- <entry id="pause_active_wav" modify_via_xml="PAUSE_ACTIVE_WAV"> -->
2949-
<!-- <type>logical</type> -->
2950-
<!-- <category>time</category> -->
2951-
<!-- <group>CLOCK_attributes</group> -->
2952-
<!-- <desc> -->
2953-
<!-- Whether Pause signals are active for component wav -->
2954-
<!-- </desc> -->
2955-
<!-- <values> -->
2956-
<!-- <value>$PAUSE_ACTIVE_WAV</value> -->
2957-
<!-- </values> -->
2958-
<!-- </entry> -->
2959-
2960-
<!-- <entry id="pause_active_glc" modify_via_xml="PAUSE_ACTIVE_GLC"> -->
2961-
<!-- <type>logical</type> -->
2962-
<!-- <category>time</category> -->
2963-
<!-- <group>CLOCK_attributes</group> -->
2964-
<!-- <desc> -->
2965-
<!-- Whether Pause signals are active for component glc -->
2966-
<!-- </desc> -->
2967-
<!-- <values> -->
2968-
<!-- <value>$PAUSE_ACTIVE_GLC</value> -->
2969-
<!-- </values> -->
2970-
<!-- </entry> -->
2971-
2972-
<!-- <entry id="pause_active_rof" modify_via_xml="PAUSE_ACTIVE_ROF"> -->
2973-
<!-- <type>logical</type> -->
2974-
<!-- <category>time</category> -->
2975-
<!-- <group>CLOCK_attributes</group> -->
2976-
<!-- <desc> -->
2977-
<!-- Whether Pause signals are active for component rof -->
2978-
<!-- </desc> -->
2979-
<!-- <values> -->
2980-
<!-- <value>$PAUSE_ACTIVE_ROF</value> -->
2981-
<!-- </values> -->
2982-
<!-- </entry> -->
2983-
2984-
<!-- <entry id="pause_active_ice" modify_via_xml="PAUSE_ACTIVE_ICE"> -->
2985-
<!-- <type>logical</type> -->
2986-
<!-- <category>time</category> -->
2987-
<!-- <group>CLOCK_attributes</group> -->
2988-
<!-- <desc> -->
2989-
<!-- Whether Pause signals are active for component ice -->
2990-
<!-- </desc> -->
2991-
<!-- <values> -->
2992-
<!-- <value>$PAUSE_ACTIVE_ICE</value> -->
2993-
<!-- </values> -->
2994-
<!-- </entry> -->
2995-
2996-
<!-- <entry id="pause_active_lnd" modify_via_xml="PAUSE_ACTIVE_LND"> -->
2997-
<!-- <type>logical</type> -->
2998-
<!-- <category>time</category> -->
2999-
<!-- <group>CLOCK_attributes</group> -->
3000-
<!-- <desc> -->
3001-
<!-- Whether Pause signals are active for component lnd -->
3002-
<!-- </desc> -->
3003-
<!-- <values> -->
3004-
<!-- <value>$PAUSE_ACTIVE_LND</value> -->
3005-
<!-- </values> -->
3006-
<!-- </entry> -->
3007-
30082933
<!-- =========================== -->
30092934
<!-- PELAYOUT attributes -->
30102935
<!-- =========================== -->

cime_config/runseq/driver_config.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __compute_glc(self, case, coupling_times):
5858
med_to_glc = False
5959
elif (comp_glc == 'cism'):
6060
if not case.get_value("CISM_EVOLVE"):
61-
med_to_glc = False
61+
run_glc = False
6262

6363
# If CISM is not evolving only get data back from cism at the initial time
6464
# However will still need to call the exchange at the end if the stop_option
@@ -77,6 +77,12 @@ def __compute_glc(self, case, coupling_times):
7777
glc_coupling_time = stop_n * 86400
7878
else:
7979
glc_coupling_time = 86400
80+
elif (comp_glc == 'dglc'):
81+
glc_coupling_time = coupling_times["glc_cpl_dt"]
82+
stop_option = case.get_value('STOP_OPTION')
83+
stop_n = case.get_value('STOP_N')
84+
if stop_option == 'nsteps':
85+
glc_coupling_time = stop_n*coupling_times["atm_cpl_dt"]
8086
elif (comp_glc == 'xglc'):
8187
glc_coupling_time = coupling_times["glc_cpl_dt"]
8288
else:

cime_config/runseq/runseq_TG.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ def gen_runseq(case, coupling_times):
3434
runseq.add_action ("MED med_phases_post_lnd" , run_lnd)
3535
runseq.add_action ("MED med_phases_prep_glc" , med_to_glc)
3636
runseq.add_action ("MED -> GLC :remapMethod=redist" , med_to_glc)
37-
runseq.add_action ("GLC" , run_glc and med_to_glc)
38-
runseq.add_action ("GLC -> MED :remapMethod=redist" , run_glc)
37+
runseq.add_action ("GLC" , run_glc)
38+
# Need to do GLC -> MED even if not running GLC; otherwise, we get a
39+
# failure in InitializeRealize ("Object being used before creation")
40+
runseq.add_action ("GLC -> MED :remapMethod=redist" , med_to_glc)
3941
runseq.add_action ("MED med_phases_history_write" , True)
4042

4143
runseq.leave_time_loop(True)

cime_config/runseq/runseq_general.py

+22-19
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def gen_runseq(case, coupling_times):
2020
cpl_seq_option = case.get_value('CPL_SEQ_OPTION')
2121
coupling_mode = case.get_value('COUPLING_MODE')
2222
diag_mode = case.get_value('BUDGETS')
23-
xcompset = case.get_value("COMP_ATM") == 'xatm'
23+
xcompset = case.get_value("COMP_ATM") == 'xatm'
2424
cpl_add_aoflux = not xcompset and case.get_value('ADD_AOFLUX_TO_RUNSEQ')
2525

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

38-
comp_glc = case.get_value("COMP_GLC")
39-
run_glc = False
40-
post_glc = False
41-
if (comp_glc == 'cism'):
42-
run_glc = True
43-
if case.get_value("CISM_EVOLVE"):
44-
post_glc = True
45-
else:
46-
post_glc = False
47-
elif (comp_glc == 'xglc'):
48-
run_glc = True
49-
post_glc = True
50-
5138
# Note: assume that atm_cpl_dt, lnd_cpl_dt, ice_cpl_dt and wav_cpl_dt are the same
5239

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

49+
if run_glc:
50+
# It wouldn't make sense to run GLC unless we also do MED -> GLC to transfer fields to GLC,
51+
# and some of the below logic controlling what appears in the run sequence depends on this
52+
# (i.e., depends on the fact that, if run_glc is True, then med_to_glc is also True).
53+
expect(med_to_glc, "if run_glc is True, then med_to_glc must also be True")
54+
6255
rof_outer_loop = run_rof and rof_cpl_time > atm_cpl_time
6356
ocn_outer_loop = run_ocn and ocn_cpl_time > atm_cpl_time
6457

58+
# Note that we do some aspects of the GLC outer loop even if run_glc is False
59+
# (as long as med_to_glc is True).
60+
#
61+
# Note that, in contrast to the other outer_loop variables, this doesn't check glc_cpl_time.
62+
# This is for consistency with the logic that was in place before adding this variable;
63+
# this seems to implicitly assume that glc_cpl_time > atm_cpl_time.
64+
glc_outer_loop = med_to_glc
65+
6566
inner_loop = ((atm_cpl_time < ocn_cpl_time) or
6667
(atm_cpl_time < rof_cpl_time) or
67-
(run_glc and atm_cpl_time < glc_cpl_time) or
68+
(glc_outer_loop and atm_cpl_time < glc_cpl_time) or
6869
atm_cpl_time == ocn_cpl_time)
6970

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

7273
#------------------
73-
runseq.enter_time_loop(glc_cpl_time, newtime=run_glc, active=med_to_glc)
74+
runseq.enter_time_loop(glc_cpl_time, newtime=glc_outer_loop)
7475
#------------------
7576

7677
#------------------
@@ -199,8 +200,10 @@ def gen_runseq(case, coupling_times):
199200

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

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

0 commit comments

Comments
 (0)