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

Run MED -> GLC in CISM NOEVOLVE mode #442

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 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 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
39 changes: 21 additions & 18 deletions cime_config/runseq/runseq_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines -38 to -49
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the other changes in this PR, this whole block became redundant.


# 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)
Comment on lines +58 to +74
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece (the control over the inner_loop and enter_time_loop's newtime) is the piece I'm least certain of and would be most happy to get a second set of eyes on. These now depend on med_to_glc rather than run_glc – though note that I have effectively swapped the logic for run_glc and med_to_glc in this PR: in most cases they have the same value, but in a NOEVOLVE case now med_to_glc is True and run_glc is False, whereas previously the reverse was the case. It seems right to have these depend on the one that is more often True (med_to_glc now).

#------------------

#------------------
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