Skip to content

Commit

Permalink
changes for porting to cesm3_0_beta03
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Oct 27, 2024
1 parent 6a1beda commit c10ede6
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tests/2_integration/test_constraint_violation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_constraint_violation_detection():
cvars['COMP_LND_OPTION'].value = "SP"

cvars['COMP_ICE_OPTION'].value = "(none)"
cvars['COMP_OCN_OPTION'].value = "(none)"
cvars['COMP_ROF_OPTION'].value = "(none)"

# Grid
Expand Down Expand Up @@ -168,12 +169,11 @@ def test_multiple_reasons():
cvars['COMP_ROF'].value = "drof"
cvars['COMP_WAV'].value = "dwav"

# Combination of five reasons
# Combination of four reasons
with pytest.raises(ConstraintViolation) as exc_info:
cvars['COMP_GLC'].value = "cism"
err_msg = str(exc_info.value)
assert "CLM cannot be coupled with a data runoff model" in err_msg
assert "GLC, ROF, and WAV cannot be coupled with SLIM." in err_msg
assert "MOM6 cannot be coupled with data wave component" in err_msg
assert "GLC cannot be coupled with a stub land model, unless it is coupled with MOM6" in err_msg
assert "CAM-DLND coupling is not supported" in err_msg
Expand Down
1 change: 1 addition & 0 deletions tests/2_integration/test_custom_compset.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def configure_custom_compset():
# Physics stage should be automatically completed. The next stage is Component Options.
assert Stage.active().title.startswith('Component Options')
cvars['COMP_ATM_OPTION'].value = "JRA"
cvars['COMP_OCN_OPTION'].value = "(none)"
cvars['COMP_ICE_OPTION'].value = "PRES"

# check if COMPSET_LNAME is set to the correct value
Expand Down
2 changes: 1 addition & 1 deletion tests/2_integration/test_standard_compset.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def configure_standard_compset(cime):
cvars[f"COMP_{comp_class}_FILTER"].value = "any"

## Pick a standard compset
cvars['COMPSET_ALIAS'].value = "B1850MOM"
cvars['COMPSET_ALIAS'].value = "BLT1850"

# Generate standard grids list (but don't select any yet)
cvars['GRID_MODE'].value = 'Standard'
Expand Down
2 changes: 1 addition & 1 deletion tests/3_system/test_custom_mom6_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_custom_mom6_grid():
cvars[f"COMP_{comp_class}_FILTER"].value = "any"

## Pick a standard compset
cvars["COMPSET_ALIAS"].value = "GMOM_JRA"
cvars["COMPSET_ALIAS"].value = "G_JRA"

# Create a custom grid
assert Stage.active().title.startswith("2. Grid")
Expand Down
10 changes: 5 additions & 5 deletions tests/3_system/test_f2000_custom_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def construct_custom_f2000_compset():
cvars["COMP_ROF_OPTION"].value = "(none)"
cvars["COMP_GLC_OPTION"].value = "NOEVOLVE"

def construct_standard_b1850mom(cime):
"""Construct a standard B1850 compset with MOM6 ocean component."""
def construct_standard_blt1850(cime):
"""Construct a standard BLT1850 case."""
assert os.path.exists(base_temp_dir), "temp testing directory does not exist"

# At initialization, the first stage should be enabled
Expand All @@ -131,7 +131,7 @@ def construct_standard_b1850mom(cime):
cvars[f"COMP_{comp_class}_FILTER"].value = "any"

## Pick a standard compset
cvars["COMPSET_ALIAS"].value = "B1850MOM"
cvars["COMPSET_ALIAS"].value = "BLT1850"


def construct_custom_res_from_std_grids(cime):
Expand Down Expand Up @@ -177,7 +177,7 @@ def construct_custom_res_from_std_grids(cime):
safe_create_case(cime.srcroot, case_creator)

# sleep for a bit to allow the case to be created
time.sleep(5)
time.sleep(9)

# remove the caseroot directory
shutil.rmtree(temp_case_path)
Expand Down Expand Up @@ -426,7 +426,7 @@ def test_custom_f2000_new_mom6_grid_modified_clm_grid():
if machine not in ["derecho", "casper"]:
pytest.skip("This test is only for the derecho and casper machines")

construct_standard_b1850mom(cime)
construct_standard_blt1850(cime)
construct_custom_res_from_new_mom6_grid_modified_clm_grid(cime)

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/3_system/test_fhist_custom_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def construct_custom_res_from_std_grids(cime):
safe_create_case(cime.srcroot, case_creator)

# sleep for a bit to allow the case to be created
time.sleep(5)
time.sleep(9)

# remove the caseroot directory
shutil.rmtree(temp_case_path)
Expand Down
1 change: 0 additions & 1 deletion tools/faulty_config_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def main():

# narrow down the search to simpler models configs:
s.add(cvars['INITTIME'] == "2000")
s.add(cvars['COMP_OCN'] != "pop")
s.add(cvars['COMP_WAV'] != "ww3dev")

# Check that assertions are satisfiable
Expand Down
2 changes: 2 additions & 0 deletions visualCaseGen/cime_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ def _retrieve_clm_data(self):
for flanduse_node in clm_namelist_xml.get_children("flanduse_timeseries"):
hgrid = clm_namelist_xml.get(flanduse_node, "hgrid")
filedir = clm_namelist_xml.text(flanduse_node)
if filedir is None:
continue
self.clm_flanduse[hgrid] = os.path.join(
self.din_loc_root.strip(),
filedir.strip()
Expand Down
11 changes: 4 additions & 7 deletions visualCaseGen/specs/relational_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def get_relational_constraints(cvars):
Implies(COMP_ATM=="cam", COMP_ICE!="dice") :
"CAM cannot be coupled with Data ICE.",

Implies(COMP_WAV=="ww3", In(COMP_OCN, ["mom", "pop"])) :
"WW3 can only be selected if either POP2 or MOM6 is the ocean component.",
Implies(COMP_WAV=="ww3", COMP_OCN!="socn") :
"WW3 can only be selected if an active or data ocean component is present.",

Implies(Or(COMP_ROF=="rtm", COMP_ROF=="mosart", COMP_ROF=="mizuroute"), COMP_LND=='clm') :
"Active runoff models can only be selected if CLM is the land component.",

Implies(And(In(COMP_OCN, ["pop", "mom"]), COMP_ATM=="datm"), COMP_LND=="slnd") :
"When MOM|POP is coupled with data atmosphere (datm), LND component must be stub (slnd).",
Implies(And(COMP_OCN=="mom", COMP_ATM=="datm"), COMP_LND=="slnd") :
"When MOM is coupled with data atmosphere (datm), LND component must be stub (slnd).",

Implies(And(COMP_ATM=="datm", COMP_LND=="clm"), And(COMP_ICE=="sice", COMP_OCN=="socn")) :
"If CLM is coupled with DATM, then both ICE and OCN must be stub.",
Expand Down Expand Up @@ -96,9 +96,6 @@ def get_relational_constraints(cvars):
Implies(COMP_OCN=="mom", In(OCN_GRID, ["tx2_3v2", "tx0.66v1", "gx1v6", "tx0.25v1"])):
"Not a valid MOM6 grid.",

Implies(COMP_OCN=="pop", In(OCN_GRID, ["gx1v6", "gx1v7", "gx3v7", "tx0.1v2", "tx0.1v3", "tx1v1"])):
"Not a valid POP2 grid.",

Implies(Contains(COMP_OCN_OPTION, "AQ"), In(OCN_GRID,["0.9x1.25", "1.9x2.5", "4x5"])):
"When in aquaplanet mode, the ocean grid must be set to f09, f19, or f45",

Expand Down

0 comments on commit c10ede6

Please sign in to comment.