Skip to content

Commit f4b3269

Browse files
committed
Merge branch 'whannah/emaxx/add-p3-cld-frac-flags' into next (PR #6849)
These flags change the input P3 cloud fraction by setting them to 1 everywhere. Currently they default to False, but we will likely enable them as part of the effort to address the popcorn convection problem. [BFB]
2 parents 1e20ff4 + e5e8caf commit f4b3269

File tree

4 files changed

+34
-17
lines changed

4 files changed

+34
-17
lines changed

components/eamxx/cime_config/namelist_defaults_scream.xml

+4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ be lost if SCREAM_HACK_XML is not enabled.
223223
<deposition_nucleation_exponent type="real" doc="Deposition nucleation exponent factor">0.304</deposition_nucleation_exponent>
224224
<ice_sedimentation_factor type="real" doc="Ice sedimentation fall speed factor">1.0</ice_sedimentation_factor>
225225
<do_ice_production type="logical" doc="Flag to turn on ice production processes (loss processes unaffected)">true</do_ice_production>
226+
<!-- flags to override subgrid coud fraction by setting them to 1 everywhere if true -->
227+
<set_cld_frac_l_to_one type="logical" doc="set P3 input liquid cloud fraction to 1 everywhere">false</set_cld_frac_l_to_one>
228+
<set_cld_frac_r_to_one type="logical" doc="set P3 input rain cloud fraction to 1 everywhere" >false</set_cld_frac_r_to_one>
229+
<set_cld_frac_i_to_one type="logical" doc="set P3 input ice cloud fraction to 1 everywhere" >false</set_cld_frac_i_to_one>
226230
</p3>
227231

228232
<!-- SHOC macrophysics -->

components/eamxx/src/physics/p3/eamxx_p3_process_interface.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void P3Microphysics::initialize_impl (const RunType /* run_type */)
280280
p3_preproc.set_variables(m_num_cols,nk_pack,pmid,pmid_dry,pseudo_density,pseudo_density_dry,
281281
T_atm,cld_frac_t,
282282
qv, qc, nc, qr, nr, qi, qm, ni, bm, qv_prev,
283-
inv_exner, th_atm, cld_frac_l, cld_frac_i, cld_frac_r, dz);
283+
inv_exner, th_atm, cld_frac_l, cld_frac_i, cld_frac_r, dz, runtime_options);
284284
// --Prognostic State Variables:
285285
prog_state.qc = p3_preproc.qc;
286286
prog_state.nc = p3_preproc.nc;

components/eamxx/src/physics/p3/eamxx_p3_process_interface.hpp

+23-16
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,26 @@ class P3Microphysics : public AtmosphereProcess
105105
th_atm(icol,ipack) = PF::calculate_theta_from_T(T_atm_pack,pmid_pack);
106106
// Cloud fraction
107107
// Set minimum cloud fraction - avoids division by zero
108-
cld_frac_l(icol,ipack) = ekat::max(cld_frac_t_pack,mincld);
109-
cld_frac_i(icol,ipack) = ekat::max(cld_frac_t_pack,mincld);
110-
cld_frac_r(icol,ipack) = ekat::max(cld_frac_t_pack,mincld);
108+
// Alternatively set fraction to 1 everywhere to disable subgrid effects
109+
cld_frac_l(icol,ipack) = runtime_opts.set_cld_frac_l_to_one ? 1 : ekat::max(cld_frac_t_pack,mincld);
110+
cld_frac_i(icol,ipack) = runtime_opts.set_cld_frac_i_to_one ? 1 : ekat::max(cld_frac_t_pack,mincld);
111+
cld_frac_r(icol,ipack) = runtime_opts.set_cld_frac_r_to_one ? 1 : ekat::max(cld_frac_t_pack,mincld);
111112

112113
// update rain cloud fraction given neighboring levels using max-overlap approach.
113-
for (int ivec=0;ivec<Spack::n;ivec++)
114-
{
115-
// Hard-coded max-overlap cloud fraction calculation. Cycle through the layers from top to bottom and determine if the rain fraction needs to
116-
// be updated to match the cloud fraction in the layer above. It is necessary to calculate the location of the layer directly above this one,
117-
// labeled ipack_m1 and ivec_m1 respectively. Note, the top layer has no layer above it, which is why we have the kstr index in the loop.
118-
Int lev = ipack*Spack::n + ivec; // Determine the level at this pack/vec location.
119-
Int ipack_m1 = (lev - 1) / Spack::n;
120-
Int ivec_m1 = (lev - 1) % Spack::n;
121-
if (lev != 0) { /* Not applicable at the very top layer */
122-
cld_frac_r(icol,ipack)[ivec] = cld_frac_t(icol,ipack_m1)[ivec_m1]>cld_frac_r(icol,ipack)[ivec] ?
123-
cld_frac_t(icol,ipack_m1)[ivec_m1] :
124-
cld_frac_r(icol,ipack)[ivec];
114+
if ( !runtime_opts.set_cld_frac_r_to_one ) {
115+
for (int ivec=0;ivec<Spack::n;ivec++)
116+
{
117+
// Hard-coded max-overlap cloud fraction calculation. Cycle through the layers from top to bottom and determine if the rain fraction needs to
118+
// be updated to match the cloud fraction in the layer above. It is necessary to calculate the location of the layer directly above this one,
119+
// labeled ipack_m1 and ivec_m1 respectively. Note, the top layer has no layer above it, which is why we have the kstr index in the loop.
120+
Int lev = ipack*Spack::n + ivec; // Determine the level at this pack/vec location.
121+
Int ipack_m1 = (lev - 1) / Spack::n;
122+
Int ivec_m1 = (lev - 1) % Spack::n;
123+
if (lev != 0) { /* Not applicable at the very top layer */
124+
cld_frac_r(icol,ipack)[ivec] = cld_frac_t(icol,ipack_m1)[ivec_m1]>cld_frac_r(icol,ipack)[ivec] ?
125+
cld_frac_t(icol,ipack_m1)[ivec_m1] :
126+
cld_frac_r(icol,ipack)[ivec];
127+
}
125128
}
126129
}
127130
//
@@ -152,6 +155,8 @@ class P3Microphysics : public AtmosphereProcess
152155
view_2d cld_frac_i;
153156
view_2d cld_frac_r;
154157
view_2d dz;
158+
// Add runtime_options as a member variable
159+
P3F::P3Runtime runtime_opts;
155160
// Assigning local variables
156161
void set_variables(const int ncol, const int npack,
157162
const view_2d_const& pmid_, const view_2d_const& pmid_dry_,
@@ -161,7 +166,8 @@ class P3Microphysics : public AtmosphereProcess
161166
const view_2d& nc_, const view_2d& qr_, const view_2d& nr_, const view_2d& qi_,
162167
const view_2d& qm_, const view_2d& ni_, const view_2d& bm_, const view_2d& qv_prev_,
163168
const view_2d& inv_exner_, const view_2d& th_atm_, const view_2d& cld_frac_l_,
164-
const view_2d& cld_frac_i_, const view_2d& cld_frac_r_, const view_2d& dz_
169+
const view_2d& cld_frac_i_, const view_2d& cld_frac_r_, const view_2d& dz_,
170+
const P3F::P3Runtime& runtime_options
165171
)
166172
{
167173
m_ncol = ncol;
@@ -190,6 +196,7 @@ class P3Microphysics : public AtmosphereProcess
190196
cld_frac_i = cld_frac_i_;
191197
cld_frac_r = cld_frac_r_;
192198
dz = dz_;
199+
runtime_opts = runtime_options;
193200
} // set_variables
194201
}; // p3_preamble
195202
/* --------------------------------------------------------------------------------------------*/

components/eamxx/src/physics/p3/p3_functions.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ struct Functions
131131
Scalar deposition_nucleation_exponent = 0.304;
132132
Scalar ice_sedimentation_factor = 1.0;
133133
bool do_ice_production = true;
134+
bool set_cld_frac_l_to_one = false;
135+
bool set_cld_frac_i_to_one = false;
136+
bool set_cld_frac_r_to_one = false;
134137

135138
void load_runtime_options_from_file(ekat::ParameterList& params) {
136139
max_total_ni = params.get<double>("max_total_ni", max_total_ni);
@@ -153,6 +156,9 @@ struct Functions
153156
deposition_nucleation_exponent = params.get<double>("deposition_nucleation_exponent", deposition_nucleation_exponent);
154157
ice_sedimentation_factor = params.get<double>("ice_sedimentation_factor", ice_sedimentation_factor);
155158
do_ice_production = params.get<bool>("do_ice_production", do_ice_production);
159+
set_cld_frac_l_to_one = params.get<bool>("set_cld_frac_l_to_one", set_cld_frac_l_to_one);
160+
set_cld_frac_i_to_one = params.get<bool>("set_cld_frac_i_to_one", set_cld_frac_i_to_one);
161+
set_cld_frac_r_to_one = params.get<bool>("set_cld_frac_r_to_one", set_cld_frac_r_to_one);
156162
}
157163

158164
};

0 commit comments

Comments
 (0)