Skip to content

Commit

Permalink
Merge pull request #968 from PeterHjortLauritzen/cam-opt
Browse files Browse the repository at this point in the history
cam6_3_152:  "Science optimize" SE-CSLAM dycore and stabilize WACCM
  • Loading branch information
nusbaume committed Mar 22, 2024
2 parents c97e39c + 919cce5 commit 39b31b4
Show file tree
Hide file tree
Showing 25 changed files with 732 additions and 383 deletions.
1 change: 1 addition & 0 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -4103,6 +4103,7 @@ if ($dyn =~ /se/) {
se_kmax_jet
se_molecular_diff
se_pgf_formulation
se_dribble_in_rsplit_loop
);

my %opts;
Expand Down
45 changes: 27 additions & 18 deletions bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,11 @@
<bnd_topo hgrid="ne3np4" npg="3">atm/cam/topo/se/ne3pg3_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230209.nc</bnd_topo>
<bnd_topo hgrid="ne5np4" npg="3">atm/cam/topo/se/ne5pg3_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170516.nc</bnd_topo>
<bnd_topo hgrid="ne16np4" npg="3">atm/cam/topo/se/ne16pg3_nc3000_Co120_Fi001_PF_nullRR_Nsw084_20171012.nc</bnd_topo>
<bnd_topo hgrid="ne30np4" npg="3">atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_20230105.nc</bnd_topo>
<bnd_topo hgrid="ne30np4" npg="3">atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_20240117.nc</bnd_topo>
<bnd_topo hgrid="ne60np4" npg="3">atm/cam/topo/se/ne60pg3_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171012.nc</bnd_topo>
<bnd_topo hgrid="ne120np4" npg="3">atm/cam/topo/se/ne120pg3_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171014.nc</bnd_topo>
<bnd_topo hgrid="ne240np4" npg="3">atm/cam/topo/se/ne240pg3_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171015.nc</bnd_topo>

<bnd_topo hgrid="ne5np4" npg="4">atm/cam/topo/se/ne5pg4_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw060_20170707.nc</bnd_topo>
<bnd_topo hgrid="ne30np4" npg="4">atm/cam/topo/se/ne30pg4_nc3000_Co060_Fi001_PF_nullRR_Nsw042_20171014.nc</bnd_topo>
<bnd_topo hgrid="ne60np4" npg="4">atm/cam/topo/se/ne60pg4_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171018.nc</bnd_topo>
<bnd_topo hgrid="ne120np4" npg="4">atm/cam/topo/se/ne120pg4_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171014.nc</bnd_topo>

<bnd_topo hgrid="ne0np4CONUS.ne30x8" >atm/cam/topo/se/ne30x8_CONUS_nc3000_Co060_Fi001_MulG_PF_RR_Nsw042_c200428.nc</bnd_topo>
<bnd_topo hgrid="ne0np4.ARCTIC.ne30x4" >atm/cam/topo/se/ne30x4_ARCTIC_nc3000_Co060_Fi001_MulG_PF_RR_Nsw042_c200428.nc</bnd_topo>
<bnd_topo hgrid="ne0np4.ARCTICGRIS.ne30x8" >atm/cam/topo/se/ne30x8_ARCTICGRIS_nc3000_Co060_Fi001_MulG_PF_RR_Nsw042_c200428.nc</bnd_topo>
Expand Down Expand Up @@ -3130,6 +3125,10 @@

<se_pgf_formulation> 1</se_pgf_formulation>
<se_pgf_formulation waccmx="1">3</se_pgf_formulation>

<se_dribble_in_rsplit_loop > 0</se_dribble_in_rsplit_loop>
<se_dribble_in_rsplit_loop hgrid="ne16np4" waccm_phys="1" waccmx="0"> 1</se_dribble_in_rsplit_loop>

<se_ftype> 2 </se_ftype>

<se_large_Courant_incr > .true. </se_large_Courant_incr>
Expand All @@ -3139,15 +3138,21 @@
<se_hypervis_subcycle > 3 </se_hypervis_subcycle>
<se_hypervis_subcycle waccm_phys="1" > 2 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne16np4" > 4 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne30np4" model_top="lt" > 4 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne16np4" waccm_phys="1" waccmx="0" > 9 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne30np4" waccm_phys="1" waccmx="0" > 8 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne30np4" model_top="lt" > 2 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne30np4" model_top="mt" > 3 </se_hypervis_subcycle>
<se_hypervis_subcycle se_refined_mesh="1" > 3 </se_hypervis_subcycle>
<se_hypervis_subcycle hgrid="ne0np4CONUS.ne30x8" waccm_phys="1" > 1 </se_hypervis_subcycle>

<se_hypervis_subcycle_sponge > 1 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge waccmx="1" > 20 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne120np4" > 4 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge se_refined_mesh="1" > 2 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne0np4CONUS.ne30x8" waccm_phys="1"> 4 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge > 1 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne30np4" model_top="mt" > 3 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne16np4" waccm_phys="1" waccmx="0"> 2 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne30np4" waccm_phys="1" waccmx="0"> 4 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge waccmx="1" > 20 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne120np4" > 4 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge se_refined_mesh="1" > 2 </se_hypervis_subcycle_sponge>
<se_hypervis_subcycle_sponge hgrid="ne0np4CONUS.ne30x8" waccm_phys="1" > 4 </se_hypervis_subcycle_sponge>

<se_hypervis_subcycle_q>1 </se_hypervis_subcycle_q>
<se_hypervis_subcycle_q hgrid="ne16np4">2 </se_hypervis_subcycle_q>
Expand All @@ -3161,22 +3166,26 @@
<se_max_hypervis_courant se_refined_mesh="1" hypervis_type="scalar" > 1.9 </se_max_hypervis_courant>

<se_nu>-1</se_nu>
<se_nu hgrid="ne16np4" waccm_phys="1" waccmx="0">6.e15</se_nu>
<se_nu waccmx="1">5.e15</se_nu>

<se_nu_div> -1 </se_nu_div>
<se_nu_div hgrid="ne16np4" waccm_phys="1" waccmx="0">6.e15</se_nu_div>
<se_nu_div waccmx="1"> 10.e15 </se_nu_div>

<se_nu_p>-1 </se_nu_p>

<se_nu_top > 1.25e5 </se_nu_top>
<se_nu_top waccmx="1" > 1.0e6 </se_nu_top>
<se_nu_top model_top="mt" > 1.0e6 </se_nu_top>
<se_nu_top waccm_phys="1" > 1.0e6 </se_nu_top>

<se_molecular_diff > 0.0 </se_molecular_diff>
<se_molecular_diff waccmx="1" > 1.0 </se_molecular_diff>

<se_sponge_del4_nu_fac > -1 </se_sponge_del4_nu_fac>
<se_sponge_del4_nu_div_fac> -1 </se_sponge_del4_nu_div_fac>
<se_sponge_del4_nu_div_fac hgrid="ne16np4" waccm_phys="1" waccmx="0"> 7.5 </se_sponge_del4_nu_div_fac>
<se_sponge_del4_lev > -1 </se_sponge_del4_lev>

<se_qsplit > 1 </se_qsplit>
Expand All @@ -3191,17 +3200,17 @@
<se_nsplit hgrid="ne16np4" > 1 </se_nsplit>

<se_nsplit hgrid="ne5np4" waccm_phys="1" > 3 </se_nsplit>
<se_nsplit hgrid="ne16np4" waccm_phys="1" waccmx="1" > 5 </se_nsplit>
<se_nsplit hgrid="ne16np4" waccm_phys="1" > 3 </se_nsplit>
<se_nsplit hgrid="ne30np4" waccm_phys="1" > 5 </se_nsplit>
<se_nsplit hgrid="ne30np4" model_top="mt" > 3 </se_nsplit>
<se_nsplit hgrid="ne16np4" waccmx="1" > 5 </se_nsplit>
<se_nsplit hgrid="ne16np4" waccm_phys="1" > 2 </se_nsplit>
<se_nsplit hgrid="ne30np4" waccm_phys="1" > 4 </se_nsplit>
<se_nsplit hgrid="ne30np4" > 2 </se_nsplit>
<se_nsplit hgrid="ne0np4CONUS.ne30x8" waccm_phys="1" > 10 </se_nsplit>

<se_nsplit hgrid="ne0np4TESTONLY.ne5x4"> 7 </se_nsplit>

<se_rsplit > 3 </se_rsplit>
<se_rsplit waccm_phys="1" > 4 </se_rsplit>
<se_rsplit model_top="mt" > 6 </se_rsplit>
<se_rsplit waccm_phys="1" waccmx="0" > 2 </se_rsplit>
<se_rsplit waccmx="1" > 4 </se_rsplit>
<se_rsplit hgrid="ne0np4CONUS.ne30x8" waccm_phys="1"> 3 </se_rsplit>

<se_fvm_supercycling>-1</se_fvm_supercycling>
Expand Down
14 changes: 14 additions & 0 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8255,6 +8255,20 @@ Default: Set by build-namelist.
Default: Set by build-namelist.
</entry>

<entry id="se_dribble_in_rsplit_loop" type="integer" category="se"
group="dyn_se_inparm" valid_values="0,1" >

0: physics tendencies will be added every vertical remapping time-step (dt_phys/se_nsplit)
for se_ftype=0,2

1: physics tendencies will be added every dynamics time-step (dt_phys/se_nsplit*se_rsplit)
for se_ftype=0,2

If se_ftype=1 then se_dribble_in_rsplit_loop has no effect since physics tendencies are added as an adjustment

Default: Set by build-namelist.
</entry>


<!-- MPAS dycore -->

Expand Down
9 changes: 5 additions & 4 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ create the cam library
# pylint: disable=multiple-imports, wrong-import-position, wildcard-import
# pylint: disable=unused-wildcard-import, bad-whitespace, too-many-locals
# pylint: disable=invalid-name
import sys, os, filecmp, shutil, imp
import sys, os, filecmp, shutil


_CIMEROOT = os.environ.get("CIMEROOT")
Expand All @@ -19,6 +19,7 @@ sys.path.append(_LIBDIR)
from standard_script_setup import *
from CIME.case import Case
from CIME.utils import run_sub_or_cmd, expect, run_cmd
from CIME.utils import import_from_file
from CIME.buildlib import parse_input
from CIME.build import get_standard_makefile_args

Expand All @@ -41,10 +42,10 @@ def _build_cam(caseroot, libroot, bldroot):
cmd = os.path.join(os.path.join(srcroot, "cime_config", "buildcpp"))
logger.info(" ...calling cam buildcpp to set build time options")
try:
mod = imp.load_source("buildcpp", cmd)
cam_cppdefs = mod.buildcpp(case)
buildcpp = import_from_file("buildcpp", cmd)
cam_cppdefs = buildcpp.buildcpp(case)
except:
raise
raise RuntimeError("CAM's 'buildcpp' script failed to run properly.")

with Case(caseroot) as case:

Expand Down
12 changes: 6 additions & 6 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
CAM namelist creator
"""
# pylint: disable=multiple-imports
import sys, os, shutil, filecmp, imp
import sys, os, shutil, filecmp

_CIMEROOT = os.environ.get("CIMEROOT")
if _CIMEROOT is None:
Expand All @@ -19,7 +19,7 @@ from standard_script_setup import *
from CIME.XML.standard_module_setup import *
from CIME.buildnml import create_namelist_infile, parse_input
from CIME.case import Case
from CIME.utils import expect, run_cmd
from CIME.utils import expect, run_cmd, import_from_file

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -75,10 +75,10 @@ def buildnml(case, caseroot, compname):
cmd = os.path.join(os.path.join(srcroot,"cime_config","buildcpp"))
logger.info(" ...calling cam buildcpp to set build time options")
try:
mod = imp.load_source("buildcpp", cmd)
mod.buildcpp(case)
buildcpp = import_from_file("buildcpp", cmd)
_ = buildcpp.buildcpp(case)
except:
raise
raise RuntimeError("CAM's 'buildcpp' script failed to run properly.")

# Verify that we have a config_cache file (generated by the call to buildcpp)
expect(os.path.isfile(filename),
Expand Down Expand Up @@ -173,7 +173,7 @@ def buildnml(case, caseroot, compname):

buildnl_opts += ["-inputdata", input_data_list]

CAM_NAMELIST_OPTS += " stream_ndep_year_first=" + stream_ndep_year_first
CAM_NAMELIST_OPTS += " stream_ndep_year_first=" + stream_ndep_year_first
CAM_NAMELIST_OPTS += " stream_ndep_year_last=" + stream_ndep_year_last
CAM_NAMELIST_OPTS += " stream_ndep_year_align=" + stream_ndep_year_align
CAM_NAMELIST_OPTS += " stream_ndep_data_filename='" + stream_ndep_data_filename.strip() + "'"
Expand Down
2 changes: 1 addition & 1 deletion cime_config/testdefs/testlist_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@
</options>
</test>
<!-- 704 tsm ter tbl -->
<test compset="FADIAB" grid="ne5pg4_ne5pg4_mg37" name="ERC_D_Ln9" testmods="cam/outfrq3s">
<test compset="FADIAB" grid="ne5pg3_ne5pg3_mg37" name="ERC_D_Ln9" testmods="cam/outfrq3s">
<machines>
<machine name="izumi" compiler="gnu" category="aux_cam"/>
</machines>
Expand Down
Loading

0 comments on commit 39b31b4

Please sign in to comment.