Skip to content

Commit

Permalink
updated to upcoming #442
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariana Vertenstein committed Mar 30, 2024
2 parents 0ce3cc6 + ac458c3 commit f9169ce
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
4 changes: 2 additions & 2 deletions cime_config/runseq/driver_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ 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
elif (comp_glc == 'dglc'):
if not case.get_value("DGLC_GET_IMPORT_DATA"):
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 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
45 changes: 21 additions & 24 deletions cime_config/runseq/runseq_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +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 == 'dglc'):
run_glc = True
if case.get_value("DGLC_IMPORT_ON"):
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 @@ -65,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 @@ -205,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)

0 comments on commit f9169ce

Please sign in to comment.