@@ -105,23 +105,26 @@ class P3Microphysics : public AtmosphereProcess
105
105
th_atm (icol,ipack) = PF::calculate_theta_from_T (T_atm_pack,pmid_pack);
106
106
// Cloud fraction
107
107
// 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);
111
112
112
113
// 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
+ }
125
128
}
126
129
}
127
130
//
@@ -152,6 +155,8 @@ class P3Microphysics : public AtmosphereProcess
152
155
view_2d cld_frac_i;
153
156
view_2d cld_frac_r;
154
157
view_2d dz;
158
+ // Add runtime_options as a member variable
159
+ P3F::P3Runtime runtime_opts;
155
160
// Assigning local variables
156
161
void set_variables (const int ncol, const int npack,
157
162
const view_2d_const& pmid_, const view_2d_const& pmid_dry_,
@@ -161,7 +166,8 @@ class P3Microphysics : public AtmosphereProcess
161
166
const view_2d& nc_, const view_2d& qr_, const view_2d& nr_, const view_2d& qi_,
162
167
const view_2d& qm_, const view_2d& ni_, const view_2d& bm_, const view_2d& qv_prev_,
163
168
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
165
171
)
166
172
{
167
173
m_ncol = ncol;
@@ -190,6 +196,7 @@ class P3Microphysics : public AtmosphereProcess
190
196
cld_frac_i = cld_frac_i_;
191
197
cld_frac_r = cld_frac_r_;
192
198
dz = dz_;
199
+ runtime_opts = runtime_options;
193
200
} // set_variables
194
201
}; // p3_preamble
195
202
/* --------------------------------------------------------------------------------------------*/
0 commit comments