Skip to content

Commit

Permalink
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
Browse files Browse the repository at this point in the history
  • Loading branch information
lizziel committed Jan 18, 2024
2 parents e06ddff + 452cb5b commit 4441ce0
Show file tree
Hide file tree
Showing 24 changed files with 1,185 additions and 446 deletions.
2 changes: 1 addition & 1 deletion Externals_CAM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ required = True
local_path = src/physics/pumas
protocol = git
repo_url = https://github.com/ESCOMP/PUMAS
tag = pumas_cam-release_v1.29
tag = pumas_cam-release_v1.35
required = True

[pumas-frozen]
Expand Down
18 changes: 16 additions & 2 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -3182,14 +3182,28 @@ if ($cfg->get('microphys') =~ /^mg/) {
add_default($nl, 'micro_mg_iaccr_factor');
add_default($nl, 'micro_mg_max_nicons');

# For CESM2, the decision was made to set micro_do_sb_physics to false
add_default($nl, 'micro_do_sb_physics', 'val'=>'.false.');

# namelist options for pumas tag release_v1.22 or later
# (currently only in the cam_dev physics package)
if ($phys =~ /cam_dev/) {
add_default($nl, 'micro_mg_warm_rain');
add_default($nl, 'micro_mg_accre_sees_auto');
add_default($nl, 'micro_mg_vtrms_factor');
add_default($nl, 'micro_mg_implicit_fall');
add_default($nl, 'pumas_stochastic_tau_kernel_filename', 'val'=>"$cfgdir/../src/physics/pumas/KBARF_tau_kernel.dat");

#set path for stochastic_tau_kernel_filename
my $cam_dir = $cfg->get('cam_dir');
add_default($nl, 'pumas_stochastic_tau_kernel_filename');
my $rel_path = $nl->get_value('pumas_stochastic_tau_kernel_filename');
my $abs_path = quote_string(set_abs_filepath($rel_path, $cam_dir));
#overwrite the relative pathname with the absolute pathname
$nl->set_variable_value('pumas_stochastic_tau_nl', 'pumas_stochastic_tau_kernel_filename', $abs_path);

}else {
# For CESM2, the decision was made to set micro_do_sb_physics to false
# This variable is replaced with micro_mg_warm_rain in cam_dev runs
add_default($nl, 'micro_do_sb_physics', 'val'=>'.false.');
}

# tunings for micro_mg_dcs
Expand Down
4 changes: 2 additions & 2 deletions bld/config_files/definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ Physics package: cam3, cam4, cam5, cam6, cam_dev, held_suarez, adiabatic, kessle
<entry id="hemco" valid_values="0,1" value="0">
Switch to turn on Harmonized Emissions Component (HEMCO) for chemistry: 0 => no, 1 => yes.
</entry>
<entry id="microphys" valid_values="rk,mg1,mg2,mg3,spcam_m2005,spcam_sam1mom,none" value="">
<entry id="microphys" valid_values="rk,mg1,mg2,mg3,pumas,spcam_m2005,spcam_sam1mom,none" value="">
Microphysics package: rk (Rasch and Kristjansson), mg1 (Morrison and
Gettelman two moment scheme CAM5.1), mg2 (Morrison and Gettelman second
version CAM6), mg3 (MG scheme 3rd version, graupel), SPCAM_m2005, SPCAM_sam1mom.
version CAM6), mg3 (MG scheme 3rd version, graupel), PUMAS, SPCAM_m2005, SPCAM_sam1mom.
</entry>
<entry id="macrophys" valid_values="rk,park,clubb_sgs,spcam_sam1mom,spcam_m2005,none" value="">
Macrophysics package: RK, Park, CLUBB_SGS, SPCAM_sam1mom, SPCAM_m2005.
Expand Down
12 changes: 8 additions & 4 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ OPTIONS
-macrophys <name> Specify the macrophysics option [rk | park | clubb_sgs].
-max_n_rad_cnst <n> Maximum number of constituents that are either radiatively
active, or in any single diagnostic list for the radiation.
-microphys <name> Specify the microphysics option [mg1 | mg2 | mg3| rk].
-microphys <name> Specify the microphysics option [mg1 | mg2 | mg3| rk | pumas].
-model_top <name> Specify the model_top option [ lt | mt ].
-nadv <n> Set total number of advected species to <n>.
-nadv_tt <n> Set number of advected test tracers <n>.
Expand Down Expand Up @@ -839,6 +839,10 @@ if (defined $opts{'microphys'}) {
$microphys_pkg = lc($opts{'microphys'});
}

if($microphys_pkg eq 'pumas') {
$microphys_pkg = 'mg3';
}

$cfg_ref->set('microphys', $microphys_pkg);

if ($print>=2) { print "Microphysics package: $microphys_pkg$eol"; }
Expand All @@ -857,7 +861,7 @@ if ($carma_pkg =~ m/cirrus/i) {
unless ($microphys_pkg =~ /^mg/) {
die <<"EOF";
** ERROR: microphysics package set to: $microphys_pkg
** The CARMA cirrus model only works with MG microphysics.
** The CARMA cirrus model only works with MG or PUMAS microphysics.
EOF
}
}
Expand All @@ -884,7 +888,7 @@ if (defined $opts{'clubb_sgs'}) {
if ($clubb_sgs and not ($microphys_pkg =~ m/^mg/ )) {
die <<"EOF";
** ERROR: microphysics package set to: $microphys_pkg
** CLUBB_SGS only works with MG microphysics.
** CLUBB_SGS only works with MG or PUMAS microphysics.
EOF
}

Expand Down Expand Up @@ -1024,7 +1028,7 @@ if ($pbl_pkg =~ m/uw/i) {
unless ($microphys_pkg =~ /^mg/) {
die <<"EOF";
** ERROR: microphysics package set to: $microphys_pkg
** The UW PBL scheme only works with MG microphysics.
** The UW PBL scheme only works with MG or PUMAS microphysics.
EOF
}
}
Expand Down
3 changes: 3 additions & 0 deletions bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,7 @@
<microp_scheme microphys="spcam_m2005" >SPCAM_m2005 </microp_scheme>
<microp_scheme microphys="spcam_sam1mom">SPCAM_sam1mom</microp_scheme>
<microp_scheme microphys="mg3">MG</microp_scheme>
<microp_scheme microphys="pumas">MG</microp_scheme>

<micro_mg_version microphys="mg1"> 1 </micro_mg_version>
<micro_mg_sub_version microphys="mg1"> 0 </micro_mg_sub_version>
Expand Down Expand Up @@ -2258,6 +2259,7 @@
<micro_mg_homog_size microphys="mg2" > 25.D-6 </micro_mg_homog_size>

<micro_mg_vtrmi_factor > 1.D0 </micro_mg_vtrmi_factor>
<micro_mg_vtrms_factor > 1.D0 </micro_mg_vtrms_factor>

<micro_mg_effi_factor > 1.D0 </micro_mg_effi_factor>
<micro_mg_effi_factor microphys="mg2" > 1.D0 </micro_mg_effi_factor>
Expand All @@ -2270,6 +2272,7 @@

<micro_mg_implicit_fall phys="cam_dev" > .true. </micro_mg_implicit_fall>
<micro_mg_accre_sees_auto phys="cam_dev" > .true. </micro_mg_accre_sees_auto>
<micro_mg_warm_rain phys="cam_dev" > kk2000 </micro_mg_warm_rain>
<micro_mg_precip_fall_corr phys="cam_dev" > .true. </micro_mg_precip_fall_corr>

<cld_macmic_num_steps> 1 </cld_macmic_num_steps>
Expand Down
38 changes: 37 additions & 1 deletion bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2740,6 +2740,12 @@ Unitless scaling factor for ice fall speed to account for sub-grid scale ice cry
Default: 1.0
</entry>

<entry id="micro_mg_vtrms_factor" type="real" category="microphys"
group="micro_mg_nl" valid_values="" >
Unitless scaling factor for snow fall speed to account for sub-grid scale ice crystal shape variability.
Default: 1.0
</entry>

<entry id="micro_mg_effi_factor" type="real" category="microphys"
group="micro_mg_nl" valid_values="" >
Unitless scaling factor for ice effective radius as seen by radiation. This scaling factor adjusts for sub-grid scale ice crystal shape variability.
Expand All @@ -2757,13 +2763,43 @@ Default: 1
Maximum allowed ice number concentration
Default: 1.0e8
</entry>
x

<entry id="micro_do_sb_physics" type="logical" category="microphys"
group="micro_mg_nl" valid_values="" >
Do Seifert and Behang (2001) autoconversion and accretion physics when set to true.
Default: .false.
</entry>

<entry id="micro_mg_warm_rain" type="char*16" category="microphys"
group="micro_mg_nl" valid_values="kk2000,sb2001,tau,emulated" >
Warm rain process
sb2001 turns on alternative autoconversion and accretion scheme for liquid in microphysics (Seifert and Behang 2001)
kk2000 uses original autoconversion and accretion scheme for liquid in microphysics
tau replaces autoconversion and accretion with a faster emulator to generate machine learning training data
emulated turns on use of machine learning for warm rain
Default: set in namelist_defaults
</entry>

<entry id="stochastic_emulated_filename_quantile" type="char*256" input_pathname="abs" category="microphys"
group="stochastic_emulated_nl" >
Neural net file for warm_rain machine learning
</entry>

<entry id="stochastic_emulated_filename_input_scale" type="char*256" input_pathname="abs" category="microphys"
group="stochastic_emulated_nl" >
Neural net input scaling values file for warm_rain machine learning
</entry>

<entry id="stochastic_emulated_filename_output_scale" type="char*256" input_pathname="abs" category="microphys"
group="stochastic_emulated_nl" >
Neural net output scaling values file for warm_rain machine learning
</entry>

<entry id="pumas_stochastic_tau_kernel_filename" type="char*256" input_pathname="abs" category="microphys"
group="pumas_stochastic_tau_nl" >
Coefficients for the stochastic collection kernel used by the TAU stochastic collection code, invoked in PUMAS with micro_pumas_warm_rain = 'tau'
</entry>

<entry id="micro_do_massless_droplet_destroyer" type="logical" category="microphys"
group="micro_mg_nl" valid_values="" >
Do destruction of massless droplets
Expand Down
47 changes: 47 additions & 0 deletions cime_config/SystemTests/mgp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""
CIME MGP test. This class inherits from SystemTestsCompareTwo
This is a changing config options test to compare between MG3 and
PUMAS in camdev. The use of MG3 or PUMAS should be bfb.
This is just like an ERC test and it's meant for CAM only
as it only does a single build.
(1) Do an initial run with microphys setup as MG3 (suffix MG3)
(2) Do an initial run with microphys setup as PUMAS (suffix PUMAS)
"""

import sys
from CIME.XML.standard_module_setup import *
from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo

logger = logging.getLogger(__name__)

class MGP(SystemTestsCompareTwo):

def __init__(self, case,
separate_builds=True,
run_one_suffix="mg3",
run_two_suffix="pumas",
run_one_description="MG3 microphysics",
run_two_description="PUMAS microphysics",
multisubmit=False,
**kwargs
):
SystemTestsCompareTwo.__init__(self, case,
separate_builds=separate_builds,
run_one_suffix=run_one_suffix,
run_two_suffix=run_two_suffix,
run_one_description=run_one_description,
run_two_description=run_two_description,
multisubmit=multisubmit,
**kwargs
)
def _case_one_setup(self):
stop_n = self._case1.get_value("STOP_N")
expect(stop_n >= 3, "STOP_N must be at least 3, STOP_N = {}".format(stop_n))
self._case.set_value("CAM_CONFIG_OPTS","-phys cam_dev -microphys mg3")

def _case_two_setup(self):
self._case.set_value("CAM_CONFIG_OPTS","-phys cam_dev -microphys pumas")


10 changes: 10 additions & 0 deletions cime_config/config_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,15 @@ TMC CAM mass conservation test
<HIST_N>$STOP_N</HIST_N>
</test>

<test NAME="MGP">
<DESC>CAM test: Verify mg3 and pumas give identical answers</DESC>
<INFO_DBUG>1</INFO_DBUG>
<DOUT_S>FALSE</DOUT_S>
<CONTINUE_RUN>FALSE</CONTINUE_RUN>
<STOP_OPTION>nsteps</STOP_OPTION>
<STOP_N>7</STOP_N>
<HIST_OPTION>$STOP_OPTION</HIST_OPTION>
<HIST_N>$STOP_N</HIST_N>
</test>

</config_test>
Loading

0 comments on commit 4441ce0

Please sign in to comment.