Line data Source code
1 : !-----------------------------------------------------------------------
2 : ! $Id$
3 : !===============================================================================
4 : module parameters_tunable
5 :
6 : ! Description:
7 : ! This module contains tunable model parameters. The purpose of the module is to make it
8 : ! easier for the clubb_tuner code to use the params vector without "knowing" any information
9 : ! about the individual parameters contained in the vector itself. It makes it easier to add
10 : ! new parameters to be tuned for, but does not make the CLUBB_core code itself any simpler.
11 : ! The parameters within the vector do not need to be the same variables used in the rest of
12 : ! CLUBB_core (see for e.g. nu1_vert_res_dep or lmin_coef).
13 : ! The parameters in the params vector only need to be those parameters for which we're not
14 : ! sure the correct value and we'd like to tune for.
15 : !
16 : ! References:
17 : ! None
18 : !
19 : ! Notes:
20 : ! To make it easier to verify of code correctness, please keep the omp threadprivate
21 : ! directives just after the variable declaration. All parameters in this
22 : ! module should be declared threadprivate because of the CLUBB tuner.
23 : !-----------------------------------------------------------------------
24 :
25 : use constants_clubb, only: eps ! Epsilon
26 :
27 : use parameter_indices, only: nparams ! Variable(s)
28 :
29 : use clubb_precision, only: &
30 : core_rknd ! Variable(s)
31 :
32 : implicit none
33 :
34 : ! Default to private
35 : private
36 :
37 : public :: set_default_parameters, setup_parameters, read_parameters, &
38 : read_param_minmax, read_param_constraints, &
39 : adj_low_res_nu, nu_vertical_res_dep
40 :
41 : type nu_vertical_res_dep
42 : real( kind = core_rknd ), allocatable, dimension(:) :: &
43 : nu1, & ! Background Coefficient of Eddy Diffusion: wp2 [m^2/s]
44 : nu2, & ! Background Coefficient of Eddy Diffusion: xp2 [m^2/s]
45 : nu6, & ! Background Coefficient of Eddy Diffusion: wpxp [m^2/s]
46 : nu8, & ! Background Coefficient of Eddy Diffusion: wp3 [m^2/s]
47 : nu9, & ! Background Coefficient of Eddy Diffusion: up2/vp2 [m^2/s]
48 : nu10, & ! Background Coefficient of Eddy Diffusion: edsclrm [m^2/s]
49 : nu_hm ! Background Coefficient of Eddy Diffusion: hydromet [m^2/s]
50 : end type nu_vertical_res_dep
51 :
52 : ! These are referenced together often enough that it made sense to
53 : ! make a list of them. Note that lmin_coef is the input parameter,
54 : ! while the actual lmin model constant is computed from this.
55 : !***************************************************************
56 : ! ***** IMPORTANT *****
57 : ! If you change the order of the parameters in the parameter_indices,
58 : ! you will need to change the order of this list as well or the
59 : ! tuner will break!
60 : ! ***** IMPORTANT *****
61 : !***************************************************************
62 : character(len=28), dimension(nparams), parameter, public :: &
63 : params_list = &
64 : (/"C1 ", "C1b ", &
65 : "C1c ", &
66 : "C2rt ", "C2thl ", &
67 : "C2rtthl ", "C4 ", &
68 : "C_uu_shr ", "C_uu_buoy ", &
69 : "C6rt ", &
70 : "C6rtb ", "C6rtc ", &
71 : "C6thl ", "C6thlb ", &
72 : "C6thlc ", "C7 ", &
73 : "C7b ", "C7c ", &
74 : "C8 ", "C8b ", &
75 : "C10 ", "C11 ", &
76 : "C11b ", "C11c ", &
77 : "C12 ", "C13 ", &
78 : "C14 ", "C_wp2_pr_dfsn ", &
79 : "C_wp3_pr_tp ", "C_wp3_pr_turb ", &
80 : "C_wp3_pr_dfsn ", "C_wp2_splat ", &
81 : "C6rt_Lscale0 ", "C6thl_Lscale0 ", &
82 : "C7_Lscale0 ", "wpxp_L_thresh ", &
83 : "c_K ", "c_K1 ", &
84 : "nu1 ", "c_K2 ", &
85 : "nu2 ", "c_K6 ", &
86 : "nu6 ", "c_K8 ", &
87 : "nu8 ", "c_K9 ", &
88 : "nu9 ", "nu10 ", &
89 : "c_K_hm ", "c_K_hmb ", &
90 : "K_hm_min_coef ", "nu_hm ", &
91 : "slope_coef_spread_DG_means_w", "pdf_component_stdev_factor_w", &
92 : "coef_spread_DG_means_rt ", "coef_spread_DG_means_thl ", &
93 : "gamma_coef ", "gamma_coefb ", &
94 : "gamma_coefc ", "mu ", &
95 : "beta ", "lmin_coef ", &
96 : "omicron ", "zeta_vrnce_rat ", &
97 : "upsilon_precip_frac_rat ", "lambda0_stability_coef ", &
98 : "mult_coef ", "taumin ", &
99 : "taumax ", "Lscale_mu_coef ", &
100 : "Lscale_pert_coef ", "alpha_corr ", &
101 : "Skw_denom_coef ", "c_K10 ", &
102 : "c_K10h ", "thlp2_rad_coef ", &
103 : "thlp2_rad_cloud_frac_thresh ", "up2_sfc_coef ", &
104 : "Skw_max_mag ", "C_invrs_tau_bkgnd ", &
105 : "C_invrs_tau_sfc ", "C_invrs_tau_shear ", &
106 : "C_invrs_tau_N2 ", "C_invrs_tau_N2_wp2 ", &
107 : "C_invrs_tau_N2_xp2 ", "C_invrs_tau_N2_wpxp ", &
108 : "C_invrs_tau_N2_clear_wp3 ", "C_invrs_tau_wpxp_Ri ", &
109 : "C_invrs_tau_wpxp_N2_thresh ", "xp3_coef_base ", &
110 : "xp3_coef_slope ", "altitude_threshold ", &
111 : "rtp2_clip_coef ", "Cx_min ", &
112 : "Cx_max ", "Richardson_num_min ", &
113 : "Richardson_num_max ", "a3_coef_min ", &
114 : "a_const ", "bv_efold ", &
115 : "wpxp_Ri_exp ", "z_displace "/)
116 :
117 : real( kind = core_rknd ), parameter, private :: &
118 : init_value = -999._core_rknd ! Initial value for the parameters, used to detect missing values
119 :
120 :
121 : contains
122 :
123 : !=============================================================================
124 1536 : subroutine set_default_parameters( &
125 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
126 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, &
127 : C6thl, C6thlb, C6thlc, C7, C7b, C7c, C8, C8b, C10, &
128 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
129 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
130 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
131 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
132 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
133 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
134 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
135 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
136 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
137 : lambda0_stability_coef, mult_coef, taumin, taumax, &
138 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, &
139 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, &
140 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
141 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, &
142 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, &
143 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, &
144 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, &
145 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
146 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
147 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
148 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace )
149 :
150 : implicit none
151 :
152 : ! Output variables
153 : real( kind = core_rknd ), intent(out) :: &
154 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
155 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
156 : C7, C7b, C7c, C8, C8b, C10, &
157 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
158 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
159 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
160 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
161 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
162 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
163 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
164 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
165 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
166 : lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, &
167 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
168 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
169 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
170 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
171 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
172 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
173 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
174 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
175 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
176 :
177 :
178 : ! NOTE: In CLUBB standalone, as well as some host models, the hardcoded
179 : ! default values of some or all of the parameters below have no
180 : ! effect, as the values are simply read in using a namelist or set in
181 : ! host model specific code.
182 :
183 : ! Model tunable parameters
184 : ! WARNING: THE DEFAULT VALUES OF THE PARAMETERS BELOW MAY BE OVERWRITTEN
185 : ! BY NAMELIST VALUES FROM, E.G., clubb_params_nl!!!
186 1536 : C1 = 1.000000_core_rknd ! Low Skewness in C1 Skw. Function [-]
187 1536 : C1b = 1.000000_core_rknd ! High Skewness in C1 Skw. Function [-]
188 1536 : C1c = 1.000000_core_rknd ! Degree of Slope of C1 Skw. Function [-]
189 1536 : C2rt = 2.000000_core_rknd ! C2 coef. for the rtp2_dp1 term [-]
190 1536 : C2thl = 2.000000_core_rknd ! C2 coef. for the thlp2_dp1 term [-]
191 1536 : C2rtthl = 2.000000_core_rknd ! C2 coef. for the rtpthlp_dp1 term [-]
192 1536 : C4 = 2.000000_core_rknd ! Used only when l_tke_aniso is true [-]
193 1536 : C_uu_shr = 0.400000_core_rknd ! Coef. in pressure terms (shear): w'^2 eqn [-]
194 1536 : C_uu_buoy = 0.300000_core_rknd ! Coef. in pressure terms (buoyancy): w'^2 eqn [-]
195 1536 : C6rt = 2.000000_core_rknd ! Low Skewness in C6rt Skw. Function [-]
196 1536 : C6rtb = 2.000000_core_rknd ! High Skewness in C6rt Skw. Function [-]
197 1536 : C6rtc = 1.000000_core_rknd ! Degree of Slope of C6rt Skw. Fnct. [-]
198 1536 : C6thl = 2.000000_core_rknd ! Low Skewness in C6thl Skw. Function [-]
199 1536 : C6thlb = 2.000000_core_rknd ! High Skewness in C6thl Skw. Fnct. [-]
200 1536 : C6thlc = 1.000000_core_rknd ! Degree of Slope of C6thl Skw. Fnct. [-]
201 1536 : C7 = 0.500000_core_rknd ! Low Skewness in C7 Skw. Function [-]
202 1536 : C7b = 0.500000_core_rknd ! High Skewness in C7 Skw. Function [-]
203 1536 : C7c = 0.500000_core_rknd ! Degree of Slope of C7 Skw. Function [-]
204 1536 : C8 = 0.500000_core_rknd ! Coef. #1 in C8 Skewness Equation [-]
205 1536 : C8b = 0.020000_core_rknd ! Coef. #2 in C8 Skewness Equation [-]
206 1536 : C10 = 3.300000_core_rknd ! Currently Not Used in the Model [-]
207 1536 : C11 = 0.400000_core_rknd ! Low Skewness in C11 Skw. Function [-]
208 1536 : C11b = 0.400000_core_rknd ! High Skewness in C11 Skw. Function [-]
209 1536 : C11c = 0.500000_core_rknd ! Degree of Slope of C11 Skw. Fnct. [-]
210 1536 : C12 = 1.000000_core_rknd ! Constant in w'^3 Crank-Nich. diff. [-]
211 1536 : C13 = 0.100000_core_rknd ! Not currently used in model [-]
212 1536 : C14 = 1.000000_core_rknd ! Constant for u'^2 and v'^2 terms [-]
213 1536 : C_wp2_pr_dfsn = 0.000000_core_rknd ! Coefficient for the wp2_pr_dfsn term [-]
214 1536 : C_wp3_pr_tp = 0.000000_core_rknd ! Coefficient for the wp3_pr_tp term [-]
215 1536 : C_wp3_pr_turb = 0.000000_core_rknd ! Coefficient for the wp3_pr_turb term [-]
216 1536 : C_wp3_pr_dfsn = 0.000000_core_rknd ! Coefficient for the wp3_pr_dfsn term [-]
217 1536 : C_wp2_splat = 2.000000_core_rknd ! Coefficient for gustiness near ground [-]
218 1536 : C6rt_Lscale0 = 14.0_core_rknd ! Damp C6rt as a fnct. of Lscale [-]
219 1536 : C6thl_Lscale0 = 14.0_core_rknd ! Damp C6thl as a fnct. of Lscale [-]
220 1536 : C7_Lscale0 = 0.8500000_core_rknd ! Damp C7 as a fnct. of Lscale [-]
221 1536 : wpxp_L_thresh = 60.0_core_rknd ! Lscale threshold: damp C6 & C7 [m]
222 1536 : c_K = 0.200000_core_rknd ! Constant C_mu^(1/4) in DD 1987 [m^2/s]
223 1536 : c_K1 = 0.200000_core_rknd ! Coef. of Eddy Diffusion: wp2 [m^2/s]
224 1536 : c_K2 = 0.025000_core_rknd ! Coef. of Eddy Diffusion: xp2 [m^2/s]
225 1536 : c_K6 = 0.375000_core_rknd ! Coef. of Eddy Diffusion: wpxp [m^2/s]
226 1536 : c_K8 = 5.000000_core_rknd ! Coef. of Eddy Diffusion: wp3 [m^2/s]
227 1536 : c_K9 = 0.100000_core_rknd ! Coef. of Eddy Diff.: up2/vp2 [m^2/s]
228 1536 : c_K_hm = 0.750000_core_rknd ! Coef. of Eddy Diffusion: hmm [m^2/s]
229 1536 : c_K_hmb = 0.750000_core_rknd ! Coef. of Non-Local Factor, Eddy Diffusion: hmm [m^2/s]
230 1536 : K_hm_min_coef = 0.10000_core_rknd ! Min. of Non-Local Factor, Eddy Diffusion: hmm [m^2/s]
231 1536 : gamma_coef = 0.250000_core_rknd ! Low Skw.: gamma coef. Skw. Fnct. [-]
232 1536 : gamma_coefb = 0.250000_core_rknd ! High Skw.: gamma coef. Skw. Fnct. [-]
233 1536 : gamma_coefc = 5.000000_core_rknd ! Deg. Slope: gamma coef. Skw. Fnct. [-]
234 1536 : mu = 1.000E-3_core_rknd ! Fract entrain rate per unit alt [1/m]
235 1536 : mult_coef = 0.500000_core_rknd ! Coef. applied to log(avg dz/thresh)[-]
236 1536 : taumin = 90.00000_core_rknd ! Min. allow. value: time-scale tau [s]
237 1536 : taumax = 3600.000_core_rknd ! Max. allow. value: time-scale tau [s]
238 1536 : Lscale_mu_coef = 2.0_core_rknd ! Coef perturb mu: av calc Lscale [-]
239 1536 : Lscale_pert_coef = 0.1_core_rknd ! Coef pert thlm/rtm: av calc Lscale [-]
240 1536 : alpha_corr = 0.15_core_rknd ! Coef. for the corr. diagnosis algorithm [-]
241 1536 : nu1 = 20.00000_core_rknd ! Bg. Coef. Eddy Diffusion: wp2 [m^2/s]
242 1536 : nu2 = 1.000000_core_rknd ! Bg. Coef. Eddy Diffusion: xp2 [m^2/s]
243 1536 : nu6 = 5.000000_core_rknd ! Bg. Coef. Eddy Diffusion: wpxp [m^2/s]
244 1536 : nu8 = 20.00000_core_rknd ! Bg. Coef. Eddy Diffusion: wp3 [m^2/s]
245 1536 : nu9 = 10.00000_core_rknd ! Bg. Coef. Eddy Diffusion: up2/vp2 [m^2/s]
246 1536 : nu10 = 0.000000_core_rknd ! Bg. Coef. Eddy Diffusion: edsclrm [m^2/s]
247 1536 : nu_hm = 1.500000_core_rknd ! Bg. Coef. Eddy Diffusion: hmm [m^2/s]
248 :
249 : ! Vince Larson added a constant to set plume widths for theta_l and rt
250 : ! beta should vary between 0 and 3.
251 1536 : beta = 1.000000_core_rknd ! Beta coefficient [-]
252 1536 : lmin_coef = 0.500000_core_rknd ! Coefficient of lmin [-]
253 1536 : Skw_max_mag = 10.0_core_rknd ! Max magnitude of skewness [-]
254 :
255 1536 : C_invrs_tau_bkgnd = 1.1_core_rknd
256 1536 : C_invrs_tau_sfc = 0.1_core_rknd
257 1536 : C_invrs_tau_shear = 0.15_core_rknd
258 1536 : C_invrs_tau_N2 = 0.4_core_rknd
259 1536 : C_invrs_tau_N2_wp2 = 0.2_core_rknd
260 1536 : C_invrs_tau_N2_xp2 = 0.05_core_rknd
261 1536 : C_invrs_tau_N2_wpxp = 0.0_core_rknd
262 1536 : C_invrs_tau_N2_clear_wp3 = 1.0_core_rknd
263 1536 : C_invrs_tau_wpxp_Ri = 0.35_core_rknd
264 1536 : C_invrs_tau_wpxp_N2_thresh = 3.3e-4_core_rknd
265 :
266 : ! Parameters for the new PDF (w, rt, and theta-l).
267 : !
268 : ! Brian Griffin added a tunable parameter for the PDF of w,
269 : ! slope_coef_spread_DG_means_w, to increase or decrease the spread between
270 : ! the two PDF component means of w. When the value of this slope parameter
271 : ! is larger, F_w is smaller and the PDF component means of w are closer
272 : ! together.
273 : ! Valid values are slope_coef_spread_DG_means_w > 0.
274 : !
275 : ! A second parameter for the PDF of w, pdf_component_stdev_factor_w, is used
276 : ! to adjust the standard deviations of the 1st PDF component against the 2nd
277 : ! PDF component for w. This parameter is related to zeta_w, where:
278 : !
279 : ! 1 + zeta_w = ( mixt_frac * sigma_w_1^2 )
280 : ! / ( ( 1 - mixt_frac ) * sigma_w_2^2 );
281 : !
282 : ! The pdf_component_stdev_factor_w is set such that:
283 : !
284 : ! pdf_component_stdev_factor_w = zeta_w + 1.
285 : !
286 : ! Valid values are pdf_component_stdev_factor_w > 0.
287 : !
288 : ! The parameter for the PDF of rt is coef_spread_DG_means_rt. Valid values
289 : ! are 0 <= coef_spread_DG_means_rt < 1. When coef_spread_DG_means_rt
290 : ! approaches 0, F_rt approaches min_F_rt, and the two PDF component means
291 : ! become closer together. When coef_spread_DG_means_rt approaches 1, F_rt
292 : ! approaches max_F_rt, and the two PDF component means are spread farther
293 : ! apart.
294 : !
295 : ! The parameter for the PDF of theta-l is coef_spread_DG_means_thl.
296 : ! Valid values are 0 <= coef_spread_DG_means_thl < 1. When
297 : ! coef_spread_DG_means_thl approaches 0, F_thl approaches min_F_thl, and the
298 : ! two PDF component means become closer together. When
299 : ! coef_spread_DG_means_thl approaches 1, F_thl approaches max_F_thl, and the
300 : ! two PDF component means are spread farther apart.
301 : ! Slope coefficient for the spread between the PDF component means of w.
302 1536 : slope_coef_spread_DG_means_w = 21.0_core_rknd
303 : ! Parameter to adjust the PDF component standard deviations of w.
304 1536 : pdf_component_stdev_factor_w = 1.0_core_rknd
305 : ! Coefficient for the spread between the PDF component means of rt.
306 1536 : coef_spread_DG_means_rt = 0.8_core_rknd
307 : ! Coefficient for the spread between the PDF component means of thl.
308 1536 : coef_spread_DG_means_thl = 0.8_core_rknd
309 :
310 : ! Parameters for the hydrometeor portion of the PDF.
311 : !
312 : ! Brian Griffin added a parameter for hydrometeors, omicron, to increase the
313 : ! standard deviation of each component and decrease the spread between the
314 : ! component means as the value of omicron inreases. Valid value are
315 : ! 0 < omicron <= 1.
316 : ! A second parameter for hydrometeors, zeta, increases the standard
317 : ! deviation of component 1 at the expense of the standard deviation of
318 : ! component 2 when the value of zeta > 0 (and increasingly so as zeta
319 : ! increases). Valid values are zeta > -1.
320 1536 : omicron = 0.5_core_rknd ! Hydromet width/spread-of-means param [-]
321 1536 : zeta_vrnce_rat = 0.0_core_rknd ! Ratio sigma^2/mu^2 comp. 1 / comp. 2 [-]
322 : ! ratio mixt_frac*precip_frac_1/precip_frac (precip_frac_calc_type=2) [-]
323 1536 : upsilon_precip_frac_rat = 0.55_core_rknd
324 :
325 : ! Intensity of stability correction applied to C1 and C6 [-]
326 1536 : lambda0_stability_coef = 0.03_core_rknd
327 : ! Factor to decrease sensitivity in the denominator of Skw calculation
328 1536 : Skw_denom_coef = 4.0_core_rknd
329 :
330 : ! Momentum coefficient of Kh_zm
331 1536 : c_K10 = 1.0_core_rknd
332 : ! Thermodynamic coefficient of Kh_zm
333 1536 : c_K10h = 1.0_core_rknd
334 :
335 1536 : thlp2_rad_coef = 1.0_core_rknd ! Coefficient of thlp2_rad [-]
336 1536 : thlp2_rad_cloud_frac_thresh = 0.1_core_rknd ! Minimum cloud fraction for
337 : ! computation of thlp2_rad [-]
338 :
339 1536 : up2_sfc_coef = 4.0_core_rknd ! Coefficients of up2 and vp2 [-]
340 :
341 1536 : xp3_coef_base = 0.25_core_rknd ! "Base" value of xp3_coef in simple eqn
342 1536 : xp3_coef_slope = 0.01_core_rknd ! Slope in regards to Brunt-Vaisla freq.
343 :
344 1536 : altitude_threshold = 100.0_core_rknd ! Altitude above which damping should occur for wpxp
345 1536 : rtp2_clip_coef = 0.5_core_rknd ! Coef. appled the clipping threshold on rtp2
346 :
347 1536 : Cx_min = 0.33_core_rknd ! Threshold on Cx_fnc_Richardson
348 1536 : Cx_max = 0.95_core_rknd ! Threshold on Cx_fnc_Richardson
349 1536 : Richardson_num_min = 0.25_core_rknd ! Threshold on Richardson number
350 1536 : Richardson_num_max = 400.0_core_rknd ! Threshold on Richardson number
351 :
352 1536 : a3_coef_min = 1.0_core_rknd ! Minimum threshold on the a3 coefficient
353 1536 : a_const = 1.8_core_rknd ! Used in sfc_varnce_module.F90 to set surface values
354 1536 : bv_efold = 5._core_rknd ! Control parameter for inverse e-folding of
355 : ! cloud fraction in the mixed Brunt Vaisala frequency
356 1536 : wpxp_Ri_exp = .5_core_rknd ! Exponent determining the influence of
357 : ! the Richardson number on invrs_tau_wpxp
358 1536 : z_displace = 25.0_core_rknd ! displacement of log law profile above ground [m]
359 1536 : return
360 :
361 : end subroutine set_default_parameters
362 :
363 : !=============================================================================
364 176472 : subroutine setup_parameters( &
365 176472 : deltaz, params, gr, ngrdcol, grid_type, &
366 : l_prescribed_avg_deltaz, &
367 : lmin, nu_vert_res_dep, err_code_out )
368 :
369 : ! Description:
370 : ! Subroutine to setup model parameters
371 :
372 : ! References:
373 : ! None
374 : !-----------------------------------------------------------------------
375 :
376 :
377 : use constants_clubb, only: &
378 : three, & ! Variable(s)
379 : one, &
380 : zero, &
381 : fstderr
382 :
383 : use grid_class, only: &
384 : grid ! Type(s)
385 :
386 : use clubb_precision, only: &
387 : core_rknd ! Variable(s)
388 :
389 : use error_code, only: &
390 : err_code, & ! Error Indicator
391 : clubb_fatal_error ! Constant
392 :
393 : use parameter_indices, only: &
394 : izeta_vrnce_rat
395 :
396 : implicit none
397 :
398 : ! Constant Parameters
399 : real( kind = core_rknd ), parameter :: &
400 : lmin_deltaz = 40.0_core_rknd ! Fixed value for minimum value for the length scale.
401 :
402 : ! Input Variables
403 :
404 : ! Grid definition
405 : type(grid), target, intent(in) :: &
406 : gr
407 :
408 : integer, intent(in) :: &
409 : ngrdcol ! Number of grid columns [#]
410 :
411 : real( kind = core_rknd ), dimension(ngrdcol), intent(in) :: &
412 : deltaz ! Change per height level [m]
413 :
414 : real( kind = core_rknd ), intent(in), dimension(nparams) :: &
415 : params ! Tuneable model parameters [-]
416 :
417 : ! If CLUBB is running on its own, this option determines
418 : ! if it is using:
419 : ! 1) an evenly-spaced grid,
420 : ! 2) a stretched (unevenly-spaced) grid entered on the
421 : ! thermodynamic grid levels (with momentum levels set
422 : ! halfway between thermodynamic levels), or
423 : ! 3) a stretched (unevenly-spaced) grid entered on the
424 : ! momentum grid levels (with thermodynamic levels set
425 : ! halfway between momentum levels).
426 : integer, intent(in) :: grid_type
427 :
428 : logical, intent(in) :: &
429 : l_prescribed_avg_deltaz ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz
430 :
431 : real( kind = core_rknd ), intent(out) :: &
432 : lmin ! Min. value for the length scale [m]
433 :
434 : type(nu_vertical_res_dep), intent(out) :: &
435 : nu_vert_res_dep ! Vertical resolution dependent nu values
436 :
437 : integer, intent(out) :: &
438 : err_code_out ! Error code indicator
439 :
440 : integer :: k, i ! loop variable
441 :
442 : real( kind = core_rknd ) :: &
443 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
444 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
445 : C7, C7b, C7c, C8, C8b, C10, &
446 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
447 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
448 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
449 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
450 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
451 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
452 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
453 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
454 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
455 : lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, &
456 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
457 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
458 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
459 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
460 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
461 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
462 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
463 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
464 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
465 :
466 : !-------------------- Begin code --------------------
467 :
468 : ! Ensure all variables are greater than 0, and zeta_vrnce_rat is greater than -1
469 18176616 : do k = 1, nparams
470 :
471 18176616 : if ( k /= izeta_vrnce_rat .and. params(k) < zero ) then
472 :
473 0 : write(fstderr,*) params_list(k), " = ", params(k)
474 0 : write(fstderr,*) params_list(k), " must satisfy 0.0 <= ", params_list(k)
475 0 : err_code = clubb_fatal_error
476 :
477 18000144 : else if ( params(k) < -one ) then
478 :
479 0 : write(fstderr,*) "zeta_vrnce_rat = ", zeta_vrnce_rat
480 0 : write(fstderr,*) "zeta_vrnce_rat must satisfy -1.0 <= zeta_vrnce_rat"
481 0 : err_code = clubb_fatal_error
482 :
483 : end if
484 :
485 : end do
486 :
487 : call unpack_parameters &
488 : ( params, & ! intent(in)
489 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, & ! intent(out)
490 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, & ! intent(out)
491 : C7, C7b, C7c, C8, C8b, C10, & ! intent(out)
492 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, & ! intent(out)
493 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, & ! intent(out)
494 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, & ! intent(out)
495 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, & ! intent(out)
496 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, & ! intent(out)
497 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, & ! intent(out)
498 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, & ! intent(out)
499 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, & ! intent(out)
500 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, & ! intent(out)
501 : lambda0_stability_coef, mult_coef, taumin, taumax, & ! intent(out)
502 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, & ! intent(out)
503 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, & ! intent(out)
504 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, & ! intent(out)
505 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, & ! intent(out)
506 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, & ! intent(out)
507 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, & ! intent(out)
508 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, & ! intent(out)
509 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, & ! intent(out)
510 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, & ! intent(out)
511 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, & ! intent(out)
512 176472 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace ) ! intent(out)
513 :
514 :
515 : ! It was decided after some experimentation, that the best
516 : ! way to produce grid independent results is to set lmin to be
517 : ! some fixed value. -dschanen 21 May 2007
518 : !lmin = lmin_coef * deltaz ! Old
519 176472 : lmin = lmin_coef * lmin_deltaz ! New fixed value
520 :
521 : ! ### Adjust Constant Diffusivity Coefficients Based On Grid Spacing ###
522 : call adj_low_res_nu( &
523 : gr, ngrdcol, grid_type, deltaz, & ! Intent(in)
524 : l_prescribed_avg_deltaz, mult_coef, & ! Intent(in)
525 : nu1, nu2, nu6, nu8, nu9, nu10, nu_hm, & ! Intent(in)
526 176472 : nu_vert_res_dep ) ! Intent(out)
527 :
528 176472 : if ( beta < zero .or. beta > three ) then
529 :
530 : ! Constraints on beta
531 0 : write(fstderr,*) "beta = ", beta
532 0 : write(fstderr,*) "beta cannot be < 0 or > 3"
533 0 : err_code = clubb_fatal_error
534 :
535 : endif ! beta < 0 or beta > 3
536 :
537 176472 : if ( slope_coef_spread_DG_means_w <= zero ) then
538 :
539 : ! Constraint on slope_coef_spread_DG_means_w
540 0 : write(fstderr,*) "slope_coef_spread_DG_means_w = ", &
541 0 : slope_coef_spread_DG_means_w
542 0 : write(fstderr,*) "slope_coef_spread_DG_means_w cannot be <= 0"
543 0 : err_code = clubb_fatal_error
544 :
545 : endif ! slope_coef_spread_DG_means_w <= 0
546 :
547 176472 : if ( pdf_component_stdev_factor_w <= zero ) then
548 :
549 : ! Constraint on pdf_component_stdev_factor_w
550 0 : write(fstderr,*) "pdf_component_stdev_factor_w = ", &
551 0 : pdf_component_stdev_factor_w
552 0 : write(fstderr,*) "pdf_component_stdev_factor_w cannot be <= 0"
553 0 : err_code = clubb_fatal_error
554 :
555 : endif ! pdf_component_stdev_factor_w <= 0
556 :
557 : if ( coef_spread_DG_means_rt < zero &
558 176472 : .or. coef_spread_DG_means_rt >= one ) then
559 :
560 : ! Constraint on coef_spread_DG_means_rt
561 0 : write(fstderr,*) "coef_spread_DG_means_rt = ", coef_spread_DG_means_rt
562 0 : write(fstderr,*) "coef_spread_DG_means_rt cannot be < 0 or >= 1"
563 0 : err_code = clubb_fatal_error
564 :
565 : endif ! coef_spread_DG_means_rt < 0 or coef_spread_DG_means_rt >= 1
566 :
567 : if ( coef_spread_DG_means_thl < zero &
568 176472 : .or. coef_spread_DG_means_thl >= one ) then
569 :
570 : ! Constraint on coef_spread_DG_means_thl
571 0 : write(fstderr,*) "coef_spread_DG_means_thl = ", coef_spread_DG_means_thl
572 0 : write(fstderr,*) "coef_spread_DG_means_thl cannot be < 0 or >= 1"
573 0 : err_code = clubb_fatal_error
574 :
575 : endif ! coef_spread_DG_means_thl < 0 or coef_spread_DG_means_thl >= 1
576 :
577 176472 : if ( omicron <= zero .or. omicron > one ) then
578 :
579 : ! Constraints on omicron
580 0 : write(fstderr,*) "omicron = ", omicron
581 0 : write(fstderr,*) "omicron cannot be <= 0 or > 1"
582 0 : err_code = clubb_fatal_error
583 :
584 : endif ! omicron <= 0 or omicron > 1
585 :
586 176472 : if ( zeta_vrnce_rat <= -one ) then
587 :
588 : ! Constraints on zeta_vrnce_rat
589 0 : write(fstderr,*) "zeta_vrnce_rat = ", zeta_vrnce_rat
590 0 : write(fstderr,*) "zeta_vrnce_rat cannot be <= -1"
591 0 : err_code = clubb_fatal_error
592 :
593 : endif ! zeta_vrnce_rat <= -1
594 :
595 : if ( upsilon_precip_frac_rat < zero &
596 176472 : .or. upsilon_precip_frac_rat > one ) then
597 :
598 : ! Constraints on upsilon_precip_frac_rat
599 0 : write(fstderr,*) "upsilon_precip_frac_rat = ", upsilon_precip_frac_rat
600 0 : write(fstderr,*) "upsilon_precip_frac_rat cannot be < 0 or > 1"
601 0 : err_code = clubb_fatal_error
602 :
603 : endif ! upsilon_precip_frac_rat < 0 or upsilon_precip_frac_rat > 1
604 :
605 176472 : if ( mu < zero ) then
606 :
607 : ! Constraints on entrainment rate, mu.
608 0 : write(fstderr,*) "mu = ", mu
609 0 : write(fstderr,*) "mu cannot be < 0"
610 0 : err_code = clubb_fatal_error
611 :
612 : endif ! mu < 0.0
613 :
614 176472 : if ( lmin < 1.0_core_rknd ) then
615 :
616 : ! Constraints on mixing length
617 0 : write(fstderr,*) "lmin = ", lmin
618 0 : write(fstderr,*) "lmin is < 1.0_core_rknd"
619 0 : err_code = clubb_fatal_error
620 :
621 : endif ! lmin < 1.0
622 :
623 : ! The C6rt parameters must be set equal to the C6thl parameters.
624 : ! Otherwise, the wpthlp pr1 term will be calculated inconsistently.
625 :
626 176472 : if ( abs(C6rt - C6thl) > abs(C6rt + C6thl) / 2 * eps ) then
627 0 : write(fstderr,*) "C6rt = ", C6rt
628 0 : write(fstderr,*) "C6thl = ", C6thl
629 0 : write(fstderr,*) "C6rt and C6thl must be equal."
630 0 : err_code = clubb_fatal_error
631 : endif ! C6rt /= C6thl
632 :
633 176472 : if ( abs(C6rtb - C6thlb) > abs(C6rtb + C6thlb) / 2 * eps ) then
634 0 : write(fstderr,*) "C6rtb = ", C6rtb
635 0 : write(fstderr,*) "C6thlb = ", C6thlb
636 0 : write(fstderr,*) "C6rtb and C6thlb must be equal."
637 0 : err_code = clubb_fatal_error
638 : endif ! C6rtb /= C6thlb
639 :
640 176472 : if ( abs(C6rtc - C6thlc) > abs(C6rtc + C6thlc) / 2 * eps ) then
641 0 : write(fstderr,*) "C6rtc = ", C6rtc
642 0 : write(fstderr,*) "C6thlc = ", C6thlc
643 0 : write(fstderr,*) "C6rtc and C6thlc must be equal."
644 0 : err_code = clubb_fatal_error
645 : endif ! C6rtc /= C6thlc
646 :
647 176472 : if ( abs(C6rt_Lscale0 - C6thl_Lscale0) > abs(C6rt_Lscale0 + C6thl_Lscale0) / 2 * eps ) then
648 0 : write(fstderr,*) "C6rt_Lscale0 = ", C6rt_Lscale0
649 0 : write(fstderr,*) "C6thl_Lscale0 = ", C6thl_Lscale0
650 0 : write(fstderr,*) "C6rt_Lscale0 and C6thl_Lscale0 must be equal."
651 0 : err_code = clubb_fatal_error
652 : endif ! C6rt_Lscale0 /= C6thl_Lscale0
653 :
654 :
655 :
656 :
657 176472 : if ( C1 < zero ) then
658 0 : write(fstderr,*) "C1 = ", C1
659 0 : write(fstderr,*) "C1 must satisfy 0.0 <= C1"
660 0 : err_code = clubb_fatal_error
661 : end if
662 :
663 176472 : if ( C7 > one .or. C7 < zero ) then
664 0 : write(fstderr,*) "C7 = ", C7
665 0 : write(fstderr,*) "C7 must satisfy 0.0 <= C7 <= 1.0"
666 0 : err_code = clubb_fatal_error
667 : end if
668 :
669 176472 : if ( C7b > one .or. C7b < zero ) then
670 0 : write(fstderr,*) "C7b = ", C7b
671 0 : write(fstderr,*) "C7b must satisfy 0.0 <= C7b <= 1.0"
672 0 : err_code = clubb_fatal_error
673 : end if
674 :
675 176472 : if ( C11 > one .or. C11 < zero ) then
676 0 : write(fstderr,*) "C11 = ", C11
677 0 : write(fstderr,*) "C11 must satisfy 0.0 <= C11 <= 1.0"
678 0 : err_code = clubb_fatal_error
679 : end if
680 :
681 176472 : if ( C11b > one .or. C11b < zero ) then
682 0 : write(fstderr,*) "C11b = ", C11b
683 0 : write(fstderr,*) "C11b must satisfy 0.0 <= C11b <= 1.0"
684 0 : err_code = clubb_fatal_error
685 : end if
686 :
687 176472 : if ( C_wp2_splat < zero ) then
688 0 : write(fstderr,*) "C_wp2_splat = ", C_wp2_splat
689 0 : write(fstderr,*) "C_wp2_splat must satisfy C_wp2_splat >= 0"
690 0 : err_code = clubb_fatal_error
691 : end if
692 :
693 176472 : err_code_out = err_code
694 :
695 176472 : return
696 :
697 : end subroutine setup_parameters
698 :
699 : !=============================================================================
700 176472 : subroutine adj_low_res_nu( &
701 176472 : gr, ngrdcol, grid_type, deltaz, & ! Intent(in)
702 : l_prescribed_avg_deltaz, mult_coef, & ! Intent(in)
703 : nu1, nu2, nu6, nu8, nu9, nu10, nu_hm, & ! Intent(out)
704 : nu_vert_res_dep ) ! Intent(out)
705 :
706 : ! Description:
707 : ! Adjust the values of background eddy diffusivity based on
708 : ! vertical grid spacing.
709 : ! This code was made into a public subroutine so that it may be
710 : ! called multiple times per model run in scenarios where grid
711 : ! altitudes, and hence average grid spacing, change through space
712 : ! and/or time. This occurs, for example, when CLUBB is
713 : ! implemented in WRF. --ldgrant Jul 2010
714 : !----------------------------------------------------------------------
715 :
716 : use constants_clubb, only: &
717 : fstderr ! Constant(s)
718 :
719 : use grid_class, only: &
720 : grid ! Type(s)
721 :
722 : use clubb_precision, only: &
723 : core_rknd ! Variable(s)
724 :
725 : implicit none
726 :
727 : ! Flag for adjusting the values of the constant background eddy diffusivity
728 : ! coefficients based on the average vertical grid spacing. If this flag is
729 : ! turned off, the values of the various nu coefficients will remain as they
730 : ! are declared in the tunable_parameters.in file.
731 : logical, parameter :: l_adj_low_res_nu = .true.
732 :
733 : ! The size of the average vertical grid spacing that serves as a threshold
734 : ! for when to increase the size of the background eddy diffusivity
735 : ! coefficients (nus) by a certain factor above what the background
736 : ! coefficients are specified to be in tunable_parameters.in. At any average
737 : ! grid spacing at or below this value, the values of the background
738 : ! diffusivities remain the same. However, at any average vertical grid
739 : ! spacing above this value, the values of the background eddy diffusivities
740 : ! are increased. Traditionally, the threshold grid spacing has been set to
741 : ! 40.0 meters. This is only relevant if l_adj_low_res_nu is turned on.
742 : real( kind = core_rknd ), parameter :: &
743 : grid_spacing_thresh = 40.0_core_rknd ! grid spacing threshold [m]
744 :
745 : ! Input Variables
746 :
747 : ! Grid definition
748 : type(grid), target, intent(in) :: &
749 : gr
750 :
751 : integer, intent(in) :: &
752 : ngrdcol
753 :
754 : ! If CLUBB is running on it's own, this option determines
755 : ! if it is using:
756 : ! 1) an evenly-spaced grid,
757 : ! 2) a stretched (unevenly-spaced) grid entered on the
758 : ! thermodynamic grid levels (with momentum levels set
759 : ! halfway between thermodynamic levels), or
760 : ! 3) a stretched (unevenly-spaced) grid entered on the
761 : ! momentum grid levels (with thermodynamic levels set
762 : ! halfway between momentum levels).
763 : integer, intent(in) :: grid_type
764 :
765 : real( kind = core_rknd ), dimension(ngrdcol), intent(in) :: &
766 : deltaz ! Change per height level [m]
767 :
768 : logical, intent(in) :: &
769 : l_prescribed_avg_deltaz ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz
770 :
771 : real( kind = core_rknd ), intent(in) :: &
772 : mult_coef, & ! CLUBB tunable parameter mult_coef
773 : nu1, & ! CLUBB tunable parameter nu1
774 : nu2, & ! CLUBB tunable parameter nu2
775 : nu6, & ! CLUBB tunable parameter nu6
776 : nu8, & ! CLUBB tunable parameter nu8
777 : nu9, & ! CLUBB tunable parameter nu9
778 : nu10, & ! CLUBB tunable parameter nu10
779 : nu_hm ! CLUBB tunable parameter nu_hm
780 :
781 : ! Output Variables
782 : type(nu_vertical_res_dep), intent(out) :: &
783 : nu_vert_res_dep ! Vertical resolution dependent nu values
784 :
785 : ! Local Variables
786 : real( kind = core_rknd ) :: avg_deltaz ! Average grid box height [m]
787 :
788 : ! The factor by which to multiply the coefficients of background eddy
789 : ! diffusivity if the grid spacing threshold is exceeded and l_adj_low_res_nu
790 : ! is turned on.
791 : real( kind = core_rknd ) :: &
792 : mult_factor_zt, & ! Uses gr%dzt(1,:) for nu values on zt levels
793 : mult_factor_zm ! Uses gr%dzm(1,:) for nu values on zm levels
794 :
795 : integer :: i
796 :
797 : !--------------- Begin code -------------------------
798 :
799 0 : allocate( nu_vert_res_dep%nu1(1:ngrdcol), &
800 0 : nu_vert_res_dep%nu2(1:ngrdcol), &
801 0 : nu_vert_res_dep%nu6(1:ngrdcol), &
802 0 : nu_vert_res_dep%nu8(1:ngrdcol), &
803 0 : nu_vert_res_dep%nu9(1:ngrdcol), &
804 0 : nu_vert_res_dep%nu10(1:ngrdcol), &
805 1764720 : nu_vert_res_dep%nu_hm(1:ngrdcol) )
806 :
807 2946672 : do i = 1, ngrdcol
808 :
809 : ! Flag for adjusting the values of the constant diffusivity coefficients
810 : ! based on the grid spacing. If this flag is turned off, the values of the
811 : ! various nu coefficients will remain as they are declared in the
812 : ! parameters.in file.
813 176472 : if ( l_adj_low_res_nu ) then
814 :
815 : ! ### Adjust Constant Diffusivity Coefficients Based On Grid Spacing ###
816 :
817 : ! All of the background coefficients of eddy diffusivity, as well as the
818 : ! constant coefficient for 4th-order hyper-diffusion, must be adjusted
819 : ! based on the size of the grid spacing. For a case that uses an
820 : ! evenly-spaced grid, the adjustment is based on the constant grid
821 : ! spacing deltaz. For a case that uses a stretched grid, the adjustment
822 : ! is based on avg_deltaz, which is the average grid spacing over the
823 : ! vertical domain.
824 :
825 2770200 : if ( l_prescribed_avg_deltaz ) then
826 :
827 0 : avg_deltaz = deltaz(i)
828 :
829 2770200 : else if ( grid_type == 3 ) then
830 :
831 : ! CLUBB is implemented in a host model, or is using grid_type = 3
832 :
833 : ! Find the average deltaz over the grid based on momentum level
834 : ! inputs.
835 2770200 : avg_deltaz = ( gr%zm(i,gr%nz) - gr%zm(i,1) ) &
836 5540400 : / real( gr%nz - 1, kind = core_rknd )
837 :
838 0 : else if ( grid_type == 1 ) then
839 :
840 : ! Evenly-spaced grid.
841 :
842 0 : avg_deltaz = deltaz(i)
843 :
844 0 : else if ( grid_type == 2 ) then
845 :
846 : ! Stretched (unevenly-spaced) grid: stretched thermodynamic level
847 : ! input.
848 :
849 : ! Find the average deltaz over the stretched grid based on
850 : ! thermodynamic level inputs.
851 0 : avg_deltaz = ( gr%zt(i,gr%nz) - gr%zt(i,1) ) &
852 0 : / real( gr%nz - 1, kind = core_rknd )
853 :
854 : else
855 :
856 : ! Eric Raut added to remove compiler warning. (Obviously, this value is not used)
857 0 : avg_deltaz = 0.0_core_rknd
858 0 : write(fstderr,*) "Invalid grid_type:", grid_type
859 0 : error stop "Fatal error"
860 :
861 : end if ! grid_type
862 :
863 : ! The nu's are chosen for deltaz <= 40 m. Looks like they must
864 : ! be adjusted for larger grid spacings (Vince Larson)
865 :
866 : ! Use a constant mult_factor so nu does not depend on grid spacing
867 2770200 : if( avg_deltaz > grid_spacing_thresh ) then
868 2770200 : mult_factor_zt = 1.0_core_rknd + mult_coef * log( avg_deltaz / grid_spacing_thresh )
869 2770200 : mult_factor_zm = mult_factor_zt
870 : else
871 : mult_factor_zt = 1.0_core_rknd
872 : mult_factor_zm = 1.0_core_rknd
873 : end if
874 :
875 : !mult_factor = 1.0_core_rknd + mult_coef * log( avg_deltaz / grid_spacing_thresh )
876 2770200 : nu_vert_res_dep%nu1(i) = nu1 * mult_factor_zm
877 2770200 : nu_vert_res_dep%nu2(i) = nu2 * mult_factor_zm
878 2770200 : nu_vert_res_dep%nu6(i) = nu6 * mult_factor_zm
879 2770200 : nu_vert_res_dep%nu8(i) = nu8 * mult_factor_zt
880 2770200 : nu_vert_res_dep%nu9(i) = nu9 * mult_factor_zm
881 2770200 : nu_vert_res_dep%nu10(i) = nu10 * mult_factor_zt !We're unsure of the grid
882 2770200 : nu_vert_res_dep%nu_hm(i) = nu_hm * mult_factor_zt
883 :
884 : else ! nu values are not adjusted
885 :
886 : nu_vert_res_dep%nu1(i) = nu1
887 : nu_vert_res_dep%nu2(i) = nu2
888 : nu_vert_res_dep%nu6(i) = nu6
889 : nu_vert_res_dep%nu8(i) = nu8
890 : nu_vert_res_dep%nu9(i) = nu9
891 : nu_vert_res_dep%nu10(i) = nu10
892 : nu_vert_res_dep%nu_hm(i) = nu_hm
893 :
894 : end if ! l_adj_low_res_nu
895 :
896 : end do
897 :
898 176472 : return
899 : end subroutine adj_low_res_nu
900 :
901 : !=============================================================================
902 1536 : subroutine read_parameters( iunit, filename, &
903 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
904 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, &
905 : C6thl, C6thlb, C6thlc, C7, C7b, C7c, C8, C8b, C10, &
906 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
907 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
908 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
909 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
910 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
911 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
912 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
913 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
914 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
915 : lambda0_stability_coef, mult_coef, taumin, taumax, &
916 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, &
917 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, &
918 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
919 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, &
920 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, &
921 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, &
922 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, &
923 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
924 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
925 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
926 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace, &
927 : params )
928 :
929 : ! Description:
930 : ! Read a namelist containing the model parameters
931 :
932 : ! References:
933 : ! None
934 : !-----------------------------------------------------------------------
935 : ! use constants_clubb, only: fstderr ! Constant
936 :
937 : implicit none
938 :
939 : ! Input variables
940 : integer, intent(in) :: iunit
941 :
942 : character(len=*), intent(in) :: filename
943 :
944 : ! Input/Output variables
945 : real( kind = core_rknd ), intent(inout) :: &
946 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
947 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
948 : C7, C7b, C7c, C8, C8b, C10, &
949 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
950 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
951 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
952 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
953 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
954 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
955 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
956 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
957 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
958 : lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, &
959 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
960 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
961 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
962 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
963 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
964 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
965 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
966 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
967 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
968 :
969 : ! Output variables
970 : real( kind = core_rknd ), intent(out), dimension(nparams) :: params
971 :
972 : ! Local variables
973 : ! integer :: i
974 :
975 : ! logical :: l_error
976 :
977 : ! Since we lack a devious way to do this just once, this namelist
978 : ! must be changed as well when a new parameter is added.
979 : namelist /clubb_params_nl/ &
980 : C1, C1b, C1c, &
981 : C2rt, C2thl, C2rtthl, C4, C_uu_shr, C_uu_buoy, &
982 : C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
983 : C7, C7b, C7c, C8, C8b, C10, C11, C11b, C11c, &
984 : C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
985 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
986 : C6rt_Lscale0, C6thl_Lscale0, &
987 : C7_Lscale0, wpxp_L_thresh, c_K, c_K1, nu1, c_K2, nu2, &
988 : c_K6, nu6, c_K8, nu8, c_K9, nu9, nu10, &
989 : c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
990 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
991 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
992 : beta, gamma_coef, gamma_coefb, gamma_coefc, lmin_coef, &
993 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
994 : lambda0_stability_coef, mult_coef, taumin, taumax, mu, Lscale_mu_coef, &
995 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
996 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
997 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
998 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
999 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
1000 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
1001 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
1002 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
1003 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
1004 :
1005 : ! ---- Begin Code ----
1006 :
1007 : ! If the filename is empty, assume we're using a `working' set of
1008 : ! parameters that are set statically here (handy for host models).
1009 : ! Read the namelist
1010 1536 : if ( filename /= "" ) then
1011 : ! Read the namelist
1012 0 : open(unit=iunit, file=filename, status='old', action='read')
1013 :
1014 0 : read(unit=iunit, nml=clubb_params_nl)
1015 :
1016 0 : close(unit=iunit)
1017 :
1018 : end if
1019 :
1020 : ! Put the variables in the output array
1021 : call pack_parameters &
1022 : ( C1, C1b, C1c, C2rt, C2thl, C2rtthl, & ! intent(in)
1023 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, & ! intent(in)
1024 : C7, C7b, C7c, C8, C8b, C10, & ! intent(in)
1025 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, & ! intent(in)
1026 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, & ! intent(in)
1027 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, & ! intent(in)
1028 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, & ! intent(in)
1029 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, & ! intent(in)
1030 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, & ! intent(in)
1031 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, & ! intent(in)
1032 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, & ! intent(in)
1033 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, & ! intent(in)
1034 : lambda0_stability_coef, mult_coef, taumin, taumax, & ! intent(in)
1035 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, & ! intent(in)
1036 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, & ! intent(in)
1037 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, & ! intent(in)
1038 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, & ! intent(in)
1039 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, & ! intent(in)
1040 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, & ! intent(in)
1041 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, & ! intent(in)
1042 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, & ! intent(in)
1043 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, & ! intent(in)
1044 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, & ! intent(in)
1045 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace, & ! intent(in)
1046 1536 : params ) ! intent(out)
1047 :
1048 : ! l_error = .false.
1049 :
1050 : ! This error check is currently broken since we are not initializing the
1051 : ! parameters to -999 ( = init_value).
1052 : ! do i = 1, nparams
1053 : ! if ( abs(params(i)-init_value) < abs(params(i)+init_value) / 2 * eps) then
1054 : ! write(fstderr,*) "Tuning parameter "//trim( params_list(i) )// &
1055 : ! " was missing from "//trim( filename )
1056 : ! l_error = .true.
1057 : ! end if
1058 : ! end do
1059 :
1060 : ! if ( l_error ) error stop "Fatal error."
1061 :
1062 1536 : return
1063 :
1064 : end subroutine read_parameters
1065 :
1066 : !=============================================================================
1067 0 : subroutine read_param_minmax &
1068 : ( iunit, filename, nindex, params_minmax, ndim )
1069 :
1070 : ! Description:
1071 : ! Read a namelist containing the amount to vary model parameters.
1072 : ! Used by the downhill simplex / simulated annealing algorithm.
1073 :
1074 : ! References:
1075 : ! None
1076 : !-----------------------------------------------------------------------
1077 : use constants_clubb, only: fstderr ! Constant
1078 :
1079 : use clubb_precision, only: &
1080 : core_rknd ! Variable(s)
1081 :
1082 : use parameter_indices, only: &
1083 : iC1, & ! Variable(s)
1084 : iC1b, &
1085 : iC1c, &
1086 : iC2rt, &
1087 : iC2thl, &
1088 : iC2rtthl, &
1089 : iC4, &
1090 : iC_uu_shr, &
1091 : iC_uu_buoy, &
1092 : iC6rt, &
1093 : iC6rtb, &
1094 : iC6rtc, &
1095 : iC6thl, &
1096 : iC6thlb, &
1097 : iC6thlc, &
1098 : iC7, &
1099 : iC7b, &
1100 : iC7c, &
1101 : iC8, &
1102 : iC8b, &
1103 : iC10, &
1104 : iC11, &
1105 : iC11b, &
1106 : iC11c, &
1107 : iC12, &
1108 : iC13, &
1109 : iC14, &
1110 : iC_wp2_pr_dfsn, &
1111 : iC_wp3_pr_tp, &
1112 : iC_wp3_pr_turb, &
1113 : iC_wp3_pr_dfsn, &
1114 : iC_wp2_splat
1115 :
1116 : use parameter_indices, only: &
1117 : iC6rt_Lscale0, &
1118 : iC6thl_Lscale0, &
1119 : iC7_Lscale0, &
1120 : iwpxp_L_thresh
1121 :
1122 : use parameter_indices, only: &
1123 : ic_K, &
1124 : ic_K1, &
1125 : inu1, &
1126 : ic_K2, &
1127 : inu2, &
1128 : ic_K6, &
1129 : inu6, &
1130 : ic_K8, &
1131 : inu8, &
1132 : ic_K9, &
1133 : inu9, &
1134 : inu10, &
1135 : ic_K_hm, &
1136 : ic_K_hmb, &
1137 : iK_hm_min_coef, &
1138 : inu_hm, &
1139 : islope_coef_spread_DG_means_w, &
1140 : ipdf_component_stdev_factor_w, &
1141 : icoef_spread_DG_means_rt, &
1142 : icoef_spread_DG_means_thl, &
1143 : igamma_coef, &
1144 : igamma_coefb, &
1145 : igamma_coefc, &
1146 : imu, &
1147 : ibeta, &
1148 : ilmin_coef, &
1149 : iomicron, &
1150 : izeta_vrnce_rat, &
1151 : iupsilon_precip_frac_rat, &
1152 : ilambda0_stability_coef, &
1153 : imult_coef, &
1154 : itaumin, &
1155 : itaumax, &
1156 : iLscale_mu_coef, &
1157 : iLscale_pert_coef, &
1158 : ialpha_corr, &
1159 : iSkw_denom_coef, &
1160 : ic_K10, &
1161 : ic_K10h, &
1162 : ithlp2_rad_coef, &
1163 : ithlp2_rad_cloud_frac_thresh, &
1164 : iup2_sfc_coef, &
1165 : iSkw_max_mag, &
1166 : ixp3_coef_base, &
1167 : ixp3_coef_slope, &
1168 : ialtitude_threshold, &
1169 : irtp2_clip_coef, &
1170 : iC_invrs_tau_bkgnd, &
1171 : iC_invrs_tau_sfc, &
1172 : iC_invrs_tau_shear, &
1173 : iC_invrs_tau_N2, &
1174 : iC_invrs_tau_N2_wp2, &
1175 : iC_invrs_tau_N2_xp2, &
1176 : iC_invrs_tau_N2_wpxp, &
1177 : iC_invrs_tau_N2_clear_wp3, &
1178 : iC_invrs_tau_wpxp_Ri, &
1179 : iC_invrs_tau_wpxp_N2_thresh, &
1180 : iCx_min, &
1181 : iCx_max, &
1182 : iRichardson_num_min, &
1183 : iRichardson_num_max, &
1184 : ia3_coef_min, &
1185 : ia_const, &
1186 : ibv_efold, &
1187 : iwpxp_Ri_exp, &
1188 : iz_displace
1189 :
1190 : implicit none
1191 :
1192 : ! Input variables
1193 : integer, intent(in) :: iunit
1194 :
1195 : character(len=*), intent(in) :: filename
1196 :
1197 : ! Output variables
1198 :
1199 : ! An array of array indices (i.e. which elements of the array `params'
1200 : ! are contained within the simplex and the max variable)
1201 : integer, intent(out), dimension(nparams) :: nindex
1202 :
1203 : real( kind = core_rknd ), intent(out), dimension(2,nparams) :: &
1204 : params_minmax ! Amount to vary the parameter in the initial simplex
1205 :
1206 : integer, intent(out) :: &
1207 : ndim ! Number of variables, e.g. rcm, to be tuned. Dimension of the init simplex
1208 :
1209 : ! Local variables
1210 : integer :: i
1211 :
1212 : ! Amount to change each parameter for the initial simplex
1213 : ! This MUST be changed to match the clubb_params_nl namelist if parameters are added.
1214 : real ( kind = core_rknd ), dimension(2) :: &
1215 : C1_minmax, C1b_minmax, C1c_minmax, C2rt_minmax, C2thl_minmax, C2rtthl_minmax, C4_minmax, &
1216 : C_uu_shr_minmax, C_uu_buoy_minmax, C6rt_minmax, C6rtb_minmax, C6rtc_minmax, C6thl_minmax, &
1217 : C6thlb_minmax, C6thlc_minmax, C7_minmax, C7b_minmax, C7c_minmax, C8_minmax, C8b_minmax, &
1218 : C10_minmax, C11_minmax, C11b_minmax, C11c_minmax, C12_minmax, C13_minmax, C14_minmax, &
1219 : C_wp2_pr_dfsn_minmax, C_wp3_pr_tp_minmax, C_wp3_pr_turb_minmax, C_wp3_pr_dfsn_minmax, &
1220 : C_wp2_splat_minmax, C6rt_Lscale0_minmax, C6thl_Lscale0_minmax, C7_Lscale0_minmax, &
1221 : wpxp_L_thresh_minmax, c_K_minmax, c_K1_minmax, nu1_minmax, c_K2_minmax, nu2_minmax, &
1222 : c_K6_minmax, nu6_minmax, c_K8_minmax, nu8_minmax, c_K9_minmax, nu9_minmax, nu10_minmax, &
1223 : c_K_hm_minmax, c_K_hmb_minmax, K_hm_min_coef_minmax, nu_hm_minmax, &
1224 : slope_coef_spread_DG_means_w_minmax, pdf_component_stdev_factor_w_minmax, &
1225 : coef_spread_DG_means_rt_minmax, coef_spread_DG_means_thl_minmax, &
1226 : beta_minmax, gamma_coef_minmax, gamma_coefb_minmax, gamma_coefc_minmax, lmin_coef_minmax, &
1227 : omicron_minmax, zeta_vrnce_rat_minmax, upsilon_precip_frac_rat_minmax, &
1228 : lambda0_stability_coef_minmax, mult_coef_minmax, taumin_minmax, taumax_minmax, &
1229 : mu_minmax, Lscale_mu_coef_minmax, Lscale_pert_coef_minmax, alpha_corr_minmax, &
1230 : Skw_denom_coef_minmax, c_K10_minmax, c_K10h_minmax, thlp2_rad_coef_minmax, &
1231 : thlp2_rad_cloud_frac_thresh_minmax, up2_sfc_coef_minmax, Skw_max_mag_minmax, &
1232 : xp3_coef_base_minmax, xp3_coef_slope_minmax, altitude_threshold_minmax, &
1233 : rtp2_clip_coef_minmax, C_invrs_tau_bkgnd_minmax, C_invrs_tau_sfc_minmax, &
1234 : C_invrs_tau_shear_minmax, C_invrs_tau_N2_minmax, C_invrs_tau_N2_wp2_minmax, &
1235 : C_invrs_tau_N2_xp2_minmax, C_invrs_tau_N2_wpxp_minmax, C_invrs_tau_N2_clear_wp3_minmax, &
1236 : C_invrs_tau_wpxp_Ri_minmax, C_invrs_tau_wpxp_N2_thresh_minmax, Cx_min_minmax, &
1237 : Cx_max_minmax, Richardson_num_min_minmax, Richardson_num_max_minmax, &
1238 : wpxp_Ri_exp_minmax, a3_coef_min_minmax, a_const_minmax, bv_efold_minmax, &
1239 : z_displace_minmax
1240 :
1241 : namelist /init_minmax/ &
1242 : C1_minmax, C1b_minmax, C1c_minmax, C2rt_minmax, C2thl_minmax, C2rtthl_minmax, C4_minmax, &
1243 : C_uu_shr_minmax, C_uu_buoy_minmax, C6rt_minmax, C6rtb_minmax, C6rtc_minmax, C6thl_minmax, &
1244 : C6thlb_minmax, C6thlc_minmax, C7_minmax, C7b_minmax, C7c_minmax, C8_minmax, C8b_minmax, &
1245 : C10_minmax, C11_minmax, C11b_minmax, C11c_minmax, C12_minmax, C13_minmax, C14_minmax, &
1246 : C_wp2_pr_dfsn_minmax, C_wp3_pr_tp_minmax, C_wp3_pr_turb_minmax, C_wp3_pr_dfsn_minmax, &
1247 : C_wp2_splat_minmax, C6rt_Lscale0_minmax, C6thl_Lscale0_minmax, C7_Lscale0_minmax, &
1248 : wpxp_L_thresh_minmax, c_K_minmax, c_K1_minmax, nu1_minmax, c_K2_minmax, nu2_minmax, &
1249 : c_K6_minmax, nu6_minmax, c_K8_minmax, nu8_minmax, c_K9_minmax, nu9_minmax, nu10_minmax, &
1250 : c_K_hm_minmax, c_K_hmb_minmax, K_hm_min_coef_minmax, nu_hm_minmax, &
1251 : slope_coef_spread_DG_means_w_minmax, pdf_component_stdev_factor_w_minmax, &
1252 : coef_spread_DG_means_rt_minmax, coef_spread_DG_means_thl_minmax, &
1253 : beta_minmax, gamma_coef_minmax, gamma_coefb_minmax, gamma_coefc_minmax, lmin_coef_minmax, &
1254 : omicron_minmax, zeta_vrnce_rat_minmax, upsilon_precip_frac_rat_minmax, &
1255 : lambda0_stability_coef_minmax, mult_coef_minmax, taumin_minmax, taumax_minmax, &
1256 : mu_minmax, Lscale_mu_coef_minmax, Lscale_pert_coef_minmax, alpha_corr_minmax, &
1257 : Skw_denom_coef_minmax, c_K10_minmax, c_K10h_minmax, thlp2_rad_coef_minmax, &
1258 : thlp2_rad_cloud_frac_thresh_minmax, up2_sfc_coef_minmax, Skw_max_mag_minmax, &
1259 : xp3_coef_base_minmax, xp3_coef_slope_minmax, altitude_threshold_minmax, &
1260 : rtp2_clip_coef_minmax, C_invrs_tau_bkgnd_minmax, C_invrs_tau_sfc_minmax, &
1261 : C_invrs_tau_shear_minmax, C_invrs_tau_N2_minmax, C_invrs_tau_N2_wp2_minmax, &
1262 : C_invrs_tau_N2_xp2_minmax, C_invrs_tau_N2_wpxp_minmax, C_invrs_tau_N2_clear_wp3_minmax, &
1263 : C_invrs_tau_wpxp_Ri_minmax, C_invrs_tau_wpxp_N2_thresh_minmax, Cx_min_minmax, &
1264 : Cx_max_minmax, Richardson_num_min_minmax, Richardson_num_max_minmax, a3_coef_min_minmax, &
1265 : a_const_minmax, bv_efold_minmax, wpxp_Ri_exp_minmax, z_displace_minmax
1266 :
1267 :
1268 : ! ----- Begin code -------------
1269 :
1270 : ! Read the namelist
1271 0 : open(unit=iunit, file=filename, status='old', action='read')
1272 0 : read(unit=iunit, nml=init_minmax)
1273 0 : close(unit=iunit)
1274 :
1275 : ! Put min/max values into params_minmax output array
1276 0 : params_minmax(:,iC1) = C1_minmax
1277 0 : params_minmax(:,iC1b) = C1b_minmax
1278 0 : params_minmax(:,iC1c) = C1c_minmax
1279 0 : params_minmax(:,iC2rt) = C2rt_minmax
1280 0 : params_minmax(:,iC2thl) = C2thl_minmax
1281 0 : params_minmax(:,iC2rtthl) = C2rtthl_minmax
1282 0 : params_minmax(:,iC4) = C4_minmax
1283 0 : params_minmax(:,iC_uu_shr) = C_uu_shr_minmax
1284 0 : params_minmax(:,iC_uu_buoy) = C_uu_buoy_minmax
1285 0 : params_minmax(:,iC6rt) = C6rt_minmax
1286 0 : params_minmax(:,iC6rtb) = C6rtb_minmax
1287 0 : params_minmax(:,iC6rtc) = C6rtc_minmax
1288 0 : params_minmax(:,iC6thl) = C6thl_minmax
1289 0 : params_minmax(:,iC6thlb) = C6thlb_minmax
1290 0 : params_minmax(:,iC6thlc) = C6thlc_minmax
1291 0 : params_minmax(:,iC7) = C7_minmax
1292 0 : params_minmax(:,iC7b) = C7b_minmax
1293 0 : params_minmax(:,iC7c) = C7c_minmax
1294 0 : params_minmax(:,iC8) = C8_minmax
1295 0 : params_minmax(:,iC8b) = C8b_minmax
1296 0 : params_minmax(:,iC10) = C10_minmax
1297 0 : params_minmax(:,iC11) = C11_minmax
1298 0 : params_minmax(:,iC11b) = C11b_minmax
1299 0 : params_minmax(:,iC11c) = C11c_minmax
1300 0 : params_minmax(:,iC12) = C12_minmax
1301 0 : params_minmax(:,iC13) = C13_minmax
1302 0 : params_minmax(:,iC14) = C14_minmax
1303 0 : params_minmax(:,iC_wp2_pr_dfsn) = C_wp2_pr_dfsn_minmax
1304 0 : params_minmax(:,iC_wp3_pr_tp) = C_wp3_pr_tp_minmax
1305 0 : params_minmax(:,iC_wp3_pr_turb) = C_wp3_pr_turb_minmax
1306 0 : params_minmax(:,iC_wp3_pr_dfsn) = C_wp3_pr_dfsn_minmax
1307 0 : params_minmax(:,iC_wp2_splat) = C_wp2_splat_minmax
1308 0 : params_minmax(:,iC6rt_Lscale0) = C6rt_Lscale0_minmax
1309 0 : params_minmax(:,iC6thl_Lscale0) = C6thl_Lscale0_minmax
1310 0 : params_minmax(:,iC7_Lscale0) = C7_Lscale0_minmax
1311 0 : params_minmax(:,iwpxp_L_thresh) = wpxp_L_thresh_minmax
1312 0 : params_minmax(:,ic_K) = c_K_minmax
1313 0 : params_minmax(:,ic_K1) = c_K1_minmax
1314 0 : params_minmax(:,inu1) = nu1_minmax
1315 0 : params_minmax(:,ic_K2) = c_K2_minmax
1316 0 : params_minmax(:,inu2) = nu2_minmax
1317 0 : params_minmax(:,ic_K6) = c_K6_minmax
1318 0 : params_minmax(:,inu6) = nu6_minmax
1319 0 : params_minmax(:,ic_K8) = c_K8_minmax
1320 0 : params_minmax(:,inu8) = nu8_minmax
1321 0 : params_minmax(:,ic_K9) = c_K9_minmax
1322 0 : params_minmax(:,inu9) = nu9_minmax
1323 0 : params_minmax(:,inu10) = nu10_minmax
1324 0 : params_minmax(:,ic_K_hm) = c_K_hm_minmax
1325 0 : params_minmax(:,ic_K_hmb) = c_K_hmb_minmax
1326 0 : params_minmax(:,iK_hm_min_coef) = K_hm_min_coef_minmax
1327 0 : params_minmax(:,inu_hm) = nu_hm_minmax
1328 0 : params_minmax(:,islope_coef_spread_DG_means_w) = slope_coef_spread_DG_means_w_minmax
1329 0 : params_minmax(:,ipdf_component_stdev_factor_w) = pdf_component_stdev_factor_w_minmax
1330 0 : params_minmax(:,icoef_spread_DG_means_rt) = coef_spread_DG_means_rt_minmax
1331 0 : params_minmax(:,icoef_spread_DG_means_thl) = coef_spread_DG_means_thl_minmax
1332 0 : params_minmax(:,igamma_coef) = gamma_coef_minmax
1333 0 : params_minmax(:,igamma_coefb) = gamma_coefb_minmax
1334 0 : params_minmax(:,igamma_coefc) = gamma_coefc_minmax
1335 0 : params_minmax(:,imu) = mu_minmax
1336 0 : params_minmax(:,ibeta) = beta_minmax
1337 0 : params_minmax(:,ilmin_coef) = lmin_coef_minmax
1338 0 : params_minmax(:,iomicron) = omicron_minmax
1339 0 : params_minmax(:,izeta_vrnce_rat) = zeta_vrnce_rat_minmax
1340 0 : params_minmax(:,iupsilon_precip_frac_rat) = upsilon_precip_frac_rat_minmax
1341 0 : params_minmax(:,ilambda0_stability_coef) = lambda0_stability_coef_minmax
1342 0 : params_minmax(:,imult_coef) = mult_coef_minmax
1343 0 : params_minmax(:,itaumin) = taumin_minmax
1344 0 : params_minmax(:,itaumax) = taumax_minmax
1345 0 : params_minmax(:,iLscale_mu_coef) = Lscale_mu_coef_minmax
1346 0 : params_minmax(:,iLscale_pert_coef) = Lscale_pert_coef_minmax
1347 0 : params_minmax(:,ialpha_corr) = alpha_corr_minmax
1348 0 : params_minmax(:,iSkw_denom_coef) = Skw_denom_coef_minmax
1349 0 : params_minmax(:,ic_K10) = c_K10_minmax
1350 0 : params_minmax(:,ic_K10h) = c_K10h_minmax
1351 0 : params_minmax(:,ithlp2_rad_coef) = thlp2_rad_coef_minmax
1352 0 : params_minmax(:,ithlp2_rad_cloud_frac_thresh) = thlp2_rad_cloud_frac_thresh_minmax
1353 0 : params_minmax(:,iup2_sfc_coef) = up2_sfc_coef_minmax
1354 0 : params_minmax(:,iSkw_max_mag) = Skw_max_mag_minmax
1355 0 : params_minmax(:,ixp3_coef_base) = xp3_coef_base_minmax
1356 0 : params_minmax(:,ixp3_coef_slope) = xp3_coef_slope_minmax
1357 0 : params_minmax(:,ialtitude_threshold) = altitude_threshold_minmax
1358 0 : params_minmax(:,irtp2_clip_coef) = rtp2_clip_coef_minmax
1359 0 : params_minmax(:,iC_invrs_tau_bkgnd) = C_invrs_tau_bkgnd_minmax
1360 0 : params_minmax(:,iC_invrs_tau_sfc) = C_invrs_tau_sfc_minmax
1361 0 : params_minmax(:,iC_invrs_tau_shear) = C_invrs_tau_shear_minmax
1362 0 : params_minmax(:,iC_invrs_tau_N2) = C_invrs_tau_N2_minmax
1363 0 : params_minmax(:,iC_invrs_tau_N2_wp2) = C_invrs_tau_N2_wp2_minmax
1364 0 : params_minmax(:,iC_invrs_tau_N2_xp2) = C_invrs_tau_N2_xp2_minmax
1365 0 : params_minmax(:,iC_invrs_tau_N2_wpxp) = C_invrs_tau_N2_wpxp_minmax
1366 0 : params_minmax(:,iC_invrs_tau_N2_clear_wp3) = C_invrs_tau_N2_clear_wp3_minmax
1367 0 : params_minmax(:,iC_invrs_tau_wpxp_Ri) = C_invrs_tau_wpxp_Ri_minmax
1368 0 : params_minmax(:,iC_invrs_tau_wpxp_N2_thresh) = C_invrs_tau_wpxp_N2_thresh_minmax
1369 0 : params_minmax(:,iRichardson_num_min) = Richardson_num_min_minmax
1370 0 : params_minmax(:,iRichardson_num_max) = Richardson_num_max_minmax
1371 0 : params_minmax(:,iCx_min) = Cx_min_minmax
1372 0 : params_minmax(:,iCx_max) = Cx_max_minmax
1373 0 : params_minmax(:,ia3_coef_min) = a3_coef_min_minmax
1374 0 : params_minmax(:,ia_const) = a_const_minmax
1375 0 : params_minmax(:,ibv_efold) = bv_efold_minmax
1376 0 : params_minmax(:,iwpxp_Ri_exp) = wpxp_Ri_exp_minmax
1377 0 : params_minmax(:,iz_displace) = z_displace_minmax
1378 :
1379 : ! Error checks: if a minimum value is entered, it must have a
1380 : ! corresponding maximum value of greater value; the min and max values
1381 : ! should not be equal or too close together (current threshold 0.01,
1382 : ! although there may be circumstances where the user might want to adjust
1383 : ! this); and neither min or max should be less than zero.
1384 0 : do i = 1, nparams, 1
1385 0 : if ( params_minmax(1,i) > params_minmax(2,i) ) then
1386 : write(fstderr,*) "Check init_minmax namelist: " // trim(params_list(i)) // &
1387 0 : " has a minimum value greater than its maximum value."
1388 0 : error stop
1389 0 : elseif ( params_minmax(1,i) > 0.0_core_rknd .and. &
1390 : abs( params_minmax(2,i) - params_minmax(1,i) ) < 0.01_core_rknd ) then
1391 : write(fstderr,*) "Check init_minmax namelist: " // trim(params_list(i)) // &
1392 0 : " has a minimum value too close to its maximum value."
1393 0 : error stop
1394 0 : elseif (params_minmax(1,i) < 0.0_core_rknd .or. params_minmax(2,i) < 0.0_core_rknd ) then
1395 : write(fstderr,*) "Check init_minmax namelist: " // trim(params_list(i)) // &
1396 0 : " has a minimum and/or maximum value less than zero."
1397 0 : error stop
1398 : end if
1399 : end do
1400 :
1401 : ! Initialize to zero
1402 0 : nindex(1:nparams) = 0
1403 0 : ndim = 0
1404 :
1405 : ! Determine how many variables are being changed
1406 0 : do i = 1, nparams, 1
1407 0 : if ( abs(params_minmax(2,i)) > eps) then
1408 0 : ndim = ndim + 1 ! Increase the total
1409 0 : nindex(ndim) = i ! Set the next array index
1410 : endif
1411 : enddo
1412 :
1413 0 : return
1414 :
1415 : end subroutine read_param_minmax
1416 :
1417 : !=============================================================================
1418 0 : subroutine read_param_constraints &
1419 : ( iunit, filename, param_constraints )
1420 :
1421 : ! Description:
1422 : ! For the tuner. While tuning it can be useful to keep certain parameters
1423 : ! equal to each other. This subroutine reads in a namelist that specifies
1424 : ! which parameters should be kept equal to another.
1425 :
1426 : ! References:
1427 : ! None
1428 : !-----------------------------------------------------------------------
1429 :
1430 : use constants_clubb, only: fstderr ! Constant
1431 :
1432 : use parameter_indices, only: &
1433 : iC1, &
1434 : iC1b, &
1435 : iC6rt, &
1436 : iC6rtb, &
1437 : iC6rtc, &
1438 : iC6thl, &
1439 : iC6thlb, &
1440 : iC6thlc, &
1441 : iC7, &
1442 : iC7b, &
1443 : iC11, &
1444 : iC11b, &
1445 : iC14, &
1446 : iC6rt_Lscale0, &
1447 : iC6thl_Lscale0, &
1448 : igamma_coef, &
1449 : igamma_coefb
1450 :
1451 : implicit none
1452 :
1453 : ! Input variables
1454 : integer, intent(in) :: iunit
1455 :
1456 : character(len=*), intent(in) :: filename
1457 :
1458 : ! Output variables
1459 : character(len=28), dimension(nparams), intent(out) :: &
1460 : param_constraints ! Which variables should be kept equal to others
1461 :
1462 : ! Local variables
1463 : character(len=28) :: &
1464 : C1_equals, C1b_equals, C6rt_equals, C6rtb_equals, C6rtc_equals, &
1465 : C6thl_equals, C6thlb_equals, C6thlc_equals, C7_equals, C7b_equals, &
1466 : C11_equals, C11b_equals, C14_equals, C6rt_Lscale0_equals, &
1467 : C6thl_Lscale0_equals, gamma_coef_equals, gamma_coefb_equals
1468 :
1469 : integer :: i
1470 :
1471 : ! This namelist specifies if a variable should be kept equal to another.
1472 : namelist /parameter_constraints/ &
1473 : C1_equals, C1b_equals, C6rt_equals, C6rtb_equals, C6rtc_equals, &
1474 : C6thl_equals, C6thlb_equals, C6thlc_equals, C7_equals, C7b_equals, &
1475 : C11_equals, C11b_equals, C14_equals, C6rt_Lscale0_equals, &
1476 : C6thl_Lscale0_equals, gamma_coef_equals, gamma_coefb_equals
1477 :
1478 : ! Initialize output array
1479 0 : param_constraints = ""
1480 :
1481 : ! Read the namelist
1482 0 : open(unit=iunit, file=filename, status='old', action='read')
1483 :
1484 0 : read(unit=iunit, nml=parameter_constraints)
1485 :
1486 0 : close(unit=iunit)
1487 :
1488 : ! Put the variables in the output array
1489 0 : param_constraints(iC1) = C1_equals
1490 0 : param_constraints(iC1b) = C1b_equals
1491 0 : param_constraints(iC6rt) = C6rt_equals
1492 0 : param_constraints(iC6rtb) = C6rtb_equals
1493 0 : param_constraints(iC6rtc) = C6rtc_equals
1494 0 : param_constraints(iC6thl) = C6thl_equals
1495 0 : param_constraints(iC6thlb) = C6thlb_equals
1496 0 : param_constraints(iC6thlc) = C6thlc_equals
1497 0 : param_constraints(iC7) = C7_equals
1498 0 : param_constraints(iC7b) = C7b_equals
1499 0 : param_constraints(iC11) = C11_equals
1500 0 : param_constraints(iC11b) = C11b_equals
1501 0 : param_constraints(iC14) = C14_equals
1502 0 : param_constraints(iC6rt_Lscale0) = C6rt_Lscale0_equals
1503 0 : param_constraints(iC6thl_Lscale0) = C6thl_Lscale0_equals
1504 0 : param_constraints(igamma_coef) = gamma_coef_equals
1505 0 : param_constraints(igamma_coefb) = gamma_coefb_equals
1506 :
1507 : ! Error check to make sure no constraint parameter is set equal to itself.
1508 0 : do i = 1, nparams, 1
1509 0 : if ( params_list(i) == param_constraints(i) ) then
1510 : write(fstderr,*) "Check parameter_constraints namelist: "//trim( params_list(i) )// &
1511 0 : " was set equal to itself."
1512 0 : error stop
1513 : end if
1514 : end do
1515 :
1516 0 : return
1517 :
1518 : end subroutine read_param_constraints
1519 :
1520 : !=============================================================================
1521 1536 : subroutine pack_parameters &
1522 : ( C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
1523 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
1524 : C7, C7b, C7c, C8, C8b, C10, &
1525 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
1526 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
1527 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
1528 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
1529 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
1530 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
1531 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
1532 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
1533 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
1534 : lambda0_stability_coef, mult_coef, taumin, taumax, &
1535 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, &
1536 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, &
1537 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
1538 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, &
1539 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, &
1540 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, &
1541 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, &
1542 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
1543 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
1544 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
1545 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace, params )
1546 :
1547 : ! Description:
1548 : ! Takes the list of scalar variables and puts them into a 1D vector.
1549 : ! It is here for the purpose of keeping the code generalized
1550 : ! when new variables are added.
1551 :
1552 : ! References:
1553 : ! None
1554 : !-----------------------------------------------------------------------
1555 :
1556 : use parameter_indices, only: &
1557 : iC1, & ! Variable(s)
1558 : iC1b, &
1559 : iC1c, &
1560 : iC2rt, &
1561 : iC2thl, &
1562 : iC2rtthl, &
1563 : iC4, &
1564 : iC_uu_shr, &
1565 : iC_uu_buoy, &
1566 : iC6rt, &
1567 : iC6rtb, &
1568 : iC6rtc, &
1569 : iC6thl, &
1570 : iC6thlb, &
1571 : iC6thlc, &
1572 : iC7, &
1573 : iC7b, &
1574 : iC7c, &
1575 : iC8, &
1576 : iC8b, &
1577 : iC10, &
1578 : iC11, &
1579 : iC11b, &
1580 : iC11c, &
1581 : iC12, &
1582 : iC13, &
1583 : iC14, &
1584 : iC_wp2_pr_dfsn, &
1585 : iC_wp3_pr_tp, &
1586 : iC_wp3_pr_turb, &
1587 : iC_wp3_pr_dfsn, &
1588 : iC_wp2_splat
1589 :
1590 : use parameter_indices, only: &
1591 : iC6rt_Lscale0, &
1592 : iC6thl_Lscale0, &
1593 : iC7_Lscale0, &
1594 : iwpxp_L_thresh
1595 :
1596 : use parameter_indices, only: &
1597 : ic_K, &
1598 : ic_K1, &
1599 : inu1, &
1600 : ic_K2, &
1601 : inu2, &
1602 : ic_K6, &
1603 : inu6, &
1604 : ic_K8, &
1605 : inu8, &
1606 : ic_K9, &
1607 : inu9, &
1608 : inu10, &
1609 : ic_K_hm, &
1610 : ic_K_hmb, &
1611 : iK_hm_min_coef, &
1612 : inu_hm, &
1613 : islope_coef_spread_DG_means_w, &
1614 : ipdf_component_stdev_factor_w, &
1615 : icoef_spread_DG_means_rt, &
1616 : icoef_spread_DG_means_thl, &
1617 : igamma_coef, &
1618 : igamma_coefb, &
1619 : igamma_coefc, &
1620 : imu, &
1621 : ibeta, &
1622 : ilmin_coef, &
1623 : iomicron, &
1624 : izeta_vrnce_rat, &
1625 : iupsilon_precip_frac_rat, &
1626 : ilambda0_stability_coef, &
1627 : imult_coef, &
1628 : itaumin, &
1629 : itaumax, &
1630 : iLscale_mu_coef, &
1631 : iLscale_pert_coef, &
1632 : ialpha_corr, &
1633 : iSkw_denom_coef, &
1634 : ic_K10, &
1635 : ic_K10h, &
1636 : ithlp2_rad_coef, &
1637 : ithlp2_rad_cloud_frac_thresh, &
1638 : iup2_sfc_coef, &
1639 : iSkw_max_mag, &
1640 : ixp3_coef_base, &
1641 : ixp3_coef_slope, &
1642 : ialtitude_threshold, &
1643 : irtp2_clip_coef, &
1644 : iC_invrs_tau_bkgnd, &
1645 : iC_invrs_tau_sfc, &
1646 : iC_invrs_tau_shear, &
1647 : iC_invrs_tau_N2, &
1648 : iC_invrs_tau_N2_wp2, &
1649 : iC_invrs_tau_N2_xp2, &
1650 : iC_invrs_tau_N2_wpxp, &
1651 : iC_invrs_tau_N2_clear_wp3, &
1652 : iC_invrs_tau_wpxp_Ri, &
1653 : iC_invrs_tau_wpxp_N2_thresh, &
1654 : iCx_min, &
1655 : iCx_max, &
1656 : iRichardson_num_min, &
1657 : iRichardson_num_max, &
1658 : ia3_coef_min, &
1659 : ia_const, &
1660 : ibv_efold, &
1661 : iwpxp_Ri_exp, &
1662 : iz_displace
1663 :
1664 : implicit none
1665 :
1666 : ! Input variables
1667 : real( kind = core_rknd ), intent(in) :: &
1668 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
1669 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
1670 : C7, C7b, C7c, C8, C8b, C10, &
1671 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
1672 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
1673 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
1674 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
1675 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
1676 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
1677 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
1678 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
1679 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
1680 : lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, &
1681 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
1682 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
1683 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
1684 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
1685 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
1686 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
1687 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
1688 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
1689 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
1690 :
1691 : ! Output variables
1692 : real( kind = core_rknd ), intent(out), dimension(nparams) :: params
1693 :
1694 1536 : params(iC1) = C1
1695 1536 : params(iC1b) = C1b
1696 1536 : params(iC1c) = C1c
1697 1536 : params(iC2rt) = C2rt
1698 1536 : params(iC2thl) = C2thl
1699 1536 : params(iC2rtthl) = C2rtthl
1700 1536 : params(iC4) = C4
1701 1536 : params(iC_uu_shr) = C_uu_shr
1702 1536 : params(iC_uu_buoy) = C_uu_buoy
1703 1536 : params(iC6rt) = C6rt
1704 1536 : params(iC6rtb) = C6rtb
1705 1536 : params(iC6rtc) = C6rtc
1706 1536 : params(iC6thl) = C6thl
1707 1536 : params(iC6thlb) = C6thlb
1708 1536 : params(iC6thlc) = C6thlc
1709 1536 : params(iC7) = C7
1710 1536 : params(iC7b) = C7b
1711 1536 : params(iC7c) = C7c
1712 1536 : params(iC8) = C8
1713 1536 : params(iC8b) = C8b
1714 1536 : params(iC10) = C10
1715 1536 : params(iC11) = C11
1716 1536 : params(iC11b) = C11b
1717 1536 : params(iC11c) = C11c
1718 1536 : params(iC12) = C12
1719 1536 : params(iC13) = C13
1720 1536 : params(iC14) = C14
1721 1536 : params(iC_wp2_pr_dfsn) = C_wp2_pr_dfsn
1722 1536 : params(iC_wp3_pr_tp) = C_wp3_pr_tp
1723 1536 : params(iC_wp3_pr_turb) = C_wp3_pr_turb
1724 1536 : params(iC_wp3_pr_dfsn) = C_wp3_pr_dfsn
1725 1536 : params(iC_wp2_splat) = C_wp2_splat
1726 1536 : params(iC6rt_Lscale0) = C6rt_Lscale0
1727 1536 : params(iC6thl_Lscale0) = C6thl_Lscale0
1728 1536 : params(iC7_Lscale0) = C7_Lscale0
1729 1536 : params(iwpxp_L_thresh) = wpxp_L_thresh
1730 1536 : params(ic_K) = c_K
1731 1536 : params(ic_K1) = c_K1
1732 1536 : params(inu1) = nu1
1733 1536 : params(ic_K2) = c_K2
1734 1536 : params(inu2) = nu2
1735 1536 : params(ic_K6) = c_K6
1736 1536 : params(inu6) = nu6
1737 1536 : params(ic_K8) = c_K8
1738 1536 : params(inu8) = nu8
1739 1536 : params(ic_K9) = c_K9
1740 1536 : params(inu9) = nu9
1741 1536 : params(inu10) = nu10
1742 1536 : params(ic_K_hm) = c_K_hm
1743 1536 : params(ic_K_hmb) = c_K_hmb
1744 1536 : params(iK_hm_min_coef) = K_hm_min_coef
1745 1536 : params(inu_hm) = nu_hm
1746 1536 : params(islope_coef_spread_DG_means_w) = slope_coef_spread_DG_means_w
1747 1536 : params(ipdf_component_stdev_factor_w) = pdf_component_stdev_factor_w
1748 1536 : params(icoef_spread_DG_means_rt) = coef_spread_DG_means_rt
1749 1536 : params(icoef_spread_DG_means_thl) = coef_spread_DG_means_thl
1750 1536 : params(igamma_coef) = gamma_coef
1751 1536 : params(igamma_coefb) = gamma_coefb
1752 1536 : params(igamma_coefc) = gamma_coefc
1753 1536 : params(imu) = mu
1754 1536 : params(ibeta) = beta
1755 1536 : params(ilmin_coef) = lmin_coef
1756 1536 : params(iomicron) = omicron
1757 1536 : params(izeta_vrnce_rat) = zeta_vrnce_rat
1758 1536 : params(iupsilon_precip_frac_rat) = upsilon_precip_frac_rat
1759 1536 : params(ilambda0_stability_coef) = lambda0_stability_coef
1760 1536 : params(imult_coef) = mult_coef
1761 1536 : params(itaumin) = taumin
1762 1536 : params(itaumax) = taumax
1763 1536 : params(iLscale_mu_coef) = Lscale_mu_coef
1764 1536 : params(iLscale_pert_coef) = Lscale_pert_coef
1765 1536 : params(ialpha_corr) = alpha_corr
1766 1536 : params(iSkw_denom_coef) = Skw_denom_coef
1767 1536 : params(ic_K10) = c_K10
1768 1536 : params(ic_K10h) = c_K10h
1769 1536 : params(ithlp2_rad_coef) = thlp2_rad_coef
1770 1536 : params(ithlp2_rad_cloud_frac_thresh) = thlp2_rad_cloud_frac_thresh
1771 1536 : params(iup2_sfc_coef) = up2_sfc_coef
1772 1536 : params(iSkw_max_mag) = Skw_max_mag
1773 1536 : params(ixp3_coef_base) = xp3_coef_base
1774 1536 : params(ixp3_coef_slope) = xp3_coef_slope
1775 1536 : params(ialtitude_threshold) = altitude_threshold
1776 1536 : params(irtp2_clip_coef) = rtp2_clip_coef
1777 1536 : params(iC_invrs_tau_bkgnd) = C_invrs_tau_bkgnd
1778 1536 : params(iC_invrs_tau_sfc) = C_invrs_tau_sfc
1779 1536 : params(iC_invrs_tau_shear) = C_invrs_tau_shear
1780 1536 : params(iC_invrs_tau_N2) = C_invrs_tau_N2
1781 1536 : params(iC_invrs_tau_N2_wp2) = C_invrs_tau_N2_wp2
1782 1536 : params(iC_invrs_tau_N2_xp2) = C_invrs_tau_N2_xp2
1783 1536 : params(iC_invrs_tau_N2_wpxp) = C_invrs_tau_N2_wpxp
1784 1536 : params(iC_invrs_tau_N2_clear_wp3) = C_invrs_tau_N2_clear_wp3
1785 1536 : params(iC_invrs_tau_wpxp_Ri) = C_invrs_tau_wpxp_Ri
1786 1536 : params(iC_invrs_tau_wpxp_N2_thresh) = C_invrs_tau_wpxp_N2_thresh
1787 1536 : params(iCx_min) = Cx_min
1788 1536 : params(iCx_max) = Cx_max
1789 1536 : params(iRichardson_num_min) = Richardson_num_min
1790 1536 : params(iRichardson_num_max) = Richardson_num_max
1791 1536 : params(ia3_coef_min) = a3_coef_min
1792 1536 : params(ia_const) = a_const
1793 1536 : params(ibv_efold) = bv_efold
1794 1536 : params(iwpxp_Ri_exp) = wpxp_Ri_exp
1795 1536 : params(iz_displace) = z_displace
1796 :
1797 1536 : return
1798 : end subroutine pack_parameters
1799 :
1800 : !=============================================================================
1801 176472 : subroutine unpack_parameters &
1802 : ( params, &
1803 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
1804 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
1805 : C7, C7b, C7c, C8, C8b, C10, &
1806 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
1807 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
1808 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
1809 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
1810 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
1811 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
1812 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
1813 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
1814 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
1815 : lambda0_stability_coef, mult_coef, taumin, taumax, &
1816 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, &
1817 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, &
1818 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
1819 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, &
1820 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, &
1821 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, &
1822 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, &
1823 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
1824 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
1825 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
1826 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace )
1827 :
1828 : ! Description:
1829 : ! Takes the 1D vector and returns the list of scalar variables.
1830 : ! Here for the purposes of keeping the code generalized
1831 : ! when new variables are added.
1832 :
1833 : ! References:
1834 : ! None
1835 : !-----------------------------------------------------------------------
1836 :
1837 : use parameter_indices, only: &
1838 : iC1, & ! Variable(s)
1839 : iC1b, &
1840 : iC1c, &
1841 : iC2rt, &
1842 : iC2thl, &
1843 : iC2rtthl, &
1844 : iC4, &
1845 : iC_uu_shr, &
1846 : iC_uu_buoy, &
1847 : iC6rt, &
1848 : iC6rtb, &
1849 : iC6rtc, &
1850 : iC6thl, &
1851 : iC6thlb, &
1852 : iC6thlc, &
1853 : iC7, &
1854 : iC7b, &
1855 : iC7c, &
1856 : iC8, &
1857 : iC8b, &
1858 : iC10, &
1859 : iC11, &
1860 : iC11b, &
1861 : iC11c, &
1862 : iC12, &
1863 : iC13, &
1864 : iC14, &
1865 : iC_wp2_pr_dfsn, &
1866 : iC_wp3_pr_tp, &
1867 : iC_wp3_pr_turb, &
1868 : iC_wp3_pr_dfsn, &
1869 : iC_wp2_splat
1870 :
1871 : use parameter_indices, only: &
1872 : iC6rt_Lscale0, &
1873 : iC6thl_Lscale0, &
1874 : iC7_Lscale0, &
1875 : iwpxp_L_thresh
1876 :
1877 : use parameter_indices, only: &
1878 : ic_K, &
1879 : ic_K1, &
1880 : inu1, &
1881 : ic_K2, &
1882 : inu2, &
1883 : ic_K6, &
1884 : inu6, &
1885 : ic_K8, &
1886 : inu8, &
1887 : ic_K9, &
1888 : inu9, &
1889 : inu10, &
1890 : ic_K_hm, &
1891 : ic_K_hmb, &
1892 : iK_hm_min_coef, &
1893 : inu_hm, &
1894 : islope_coef_spread_DG_means_w, &
1895 : ipdf_component_stdev_factor_w, &
1896 : icoef_spread_DG_means_rt, &
1897 : icoef_spread_DG_means_thl, &
1898 : igamma_coef, &
1899 : igamma_coefb, &
1900 : igamma_coefc, &
1901 : imu, &
1902 : ibeta, &
1903 : ilmin_coef, &
1904 : iomicron, &
1905 : izeta_vrnce_rat, &
1906 : iupsilon_precip_frac_rat, &
1907 : ilambda0_stability_coef, &
1908 : imult_coef, &
1909 : itaumin, &
1910 : itaumax, &
1911 : iLscale_mu_coef, &
1912 : iLscale_pert_coef, &
1913 : ialpha_corr, &
1914 : iSkw_denom_coef, &
1915 : ic_K10, &
1916 : ic_K10h, &
1917 : ithlp2_rad_coef, &
1918 : ithlp2_rad_cloud_frac_thresh, &
1919 : iup2_sfc_coef, &
1920 : iSkw_max_mag, &
1921 : ixp3_coef_base, &
1922 : ixp3_coef_slope, &
1923 : ialtitude_threshold, &
1924 : irtp2_clip_coef, &
1925 : iC_invrs_tau_bkgnd, &
1926 : iC_invrs_tau_sfc, &
1927 : iC_invrs_tau_shear, &
1928 : iC_invrs_tau_N2, &
1929 : iC_invrs_tau_N2_wp2, &
1930 : iC_invrs_tau_N2_xp2, &
1931 : iC_invrs_tau_N2_wpxp, &
1932 : iC_invrs_tau_N2_clear_wp3, &
1933 : iC_invrs_tau_wpxp_Ri, &
1934 : iC_invrs_tau_wpxp_N2_thresh, &
1935 : iCx_min, &
1936 : iCx_max, &
1937 : iRichardson_num_min, &
1938 : iRichardson_num_max, &
1939 : ia3_coef_min, &
1940 : ia_const, &
1941 : ibv_efold, &
1942 : iwpxp_Ri_exp, &
1943 : iz_displace, &
1944 : nparams
1945 :
1946 : implicit none
1947 :
1948 : ! Input variables
1949 : real( kind = core_rknd ), intent(in), dimension(nparams) :: params
1950 :
1951 : ! Output variables
1952 : real( kind = core_rknd ), intent(out) :: &
1953 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
1954 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
1955 : C7, C7b, C7c, C8, C8b, C10, &
1956 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
1957 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
1958 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
1959 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
1960 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
1961 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
1962 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
1963 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
1964 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
1965 : lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, &
1966 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
1967 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
1968 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
1969 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
1970 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
1971 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
1972 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
1973 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
1974 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
1975 :
1976 176472 : C1 = params(iC1)
1977 176472 : C1b = params(iC1b)
1978 176472 : C1c = params(iC1c)
1979 176472 : C2rt = params(iC2rt)
1980 176472 : C2thl = params(iC2thl)
1981 176472 : C2rtthl = params(iC2rtthl)
1982 176472 : C4 = params(iC4)
1983 176472 : C_uu_shr = params(iC_uu_shr)
1984 176472 : C_uu_buoy = params(iC_uu_buoy)
1985 176472 : C6rt = params(iC6rt)
1986 176472 : C6rtb = params(iC6rtb)
1987 176472 : C6rtc = params(iC6rtc)
1988 176472 : C6thl = params(iC6thl)
1989 176472 : C6thlb = params(iC6thlb)
1990 176472 : C6thlc = params(iC6thlc)
1991 176472 : C7 = params(iC7)
1992 176472 : C7b = params(iC7b)
1993 176472 : C7c = params(iC7c)
1994 176472 : C8 = params(iC8)
1995 176472 : C8b = params(iC8b)
1996 176472 : C10 = params(iC10)
1997 176472 : C11 = params(iC11)
1998 176472 : C11b = params(iC11b)
1999 176472 : C11c = params(iC11c)
2000 176472 : C12 = params(iC12)
2001 176472 : C13 = params(iC13)
2002 176472 : C14 = params(iC14)
2003 :
2004 176472 : C_wp2_pr_dfsn = params(iC_wp2_pr_dfsn)
2005 176472 : C_wp3_pr_tp = params(iC_wp3_pr_tp)
2006 176472 : C_wp3_pr_turb = params(iC_wp3_pr_turb)
2007 176472 : C_wp3_pr_dfsn = params(iC_wp3_pr_dfsn)
2008 176472 : C_wp2_splat = params(iC_wp2_splat)
2009 :
2010 176472 : C6rt_Lscale0 = params(iC6rt_Lscale0)
2011 176472 : C6thl_Lscale0 = params(iC6thl_Lscale0)
2012 176472 : C7_Lscale0 = params(iC7_Lscale0)
2013 176472 : wpxp_L_thresh = params(iwpxp_L_thresh)
2014 :
2015 176472 : c_K = params(ic_K)
2016 176472 : c_K1 = params(ic_K1)
2017 176472 : nu1 = params(inu1)
2018 176472 : c_K2 = params(ic_K2)
2019 176472 : nu2 = params(inu2)
2020 176472 : c_K6 = params(ic_K6)
2021 176472 : nu6 = params(inu6)
2022 176472 : c_K8 = params(ic_K8)
2023 176472 : nu8 = params(inu8)
2024 176472 : c_K9 = params(ic_K9)
2025 176472 : nu9 = params(inu9)
2026 176472 : nu10 = params(inu10)
2027 176472 : c_K_hm = params(ic_K_hm)
2028 176472 : c_K_hmb = params(ic_K_hmb)
2029 176472 : K_hm_min_coef = params(iK_hm_min_coef)
2030 176472 : nu_hm = params(inu_hm)
2031 :
2032 176472 : slope_coef_spread_DG_means_w = params(islope_coef_spread_DG_means_w)
2033 176472 : pdf_component_stdev_factor_w = params(ipdf_component_stdev_factor_w)
2034 176472 : coef_spread_DG_means_rt = params(icoef_spread_DG_means_rt)
2035 176472 : coef_spread_DG_means_thl = params(icoef_spread_DG_means_thl)
2036 :
2037 176472 : gamma_coef = params(igamma_coef)
2038 176472 : gamma_coefb = params(igamma_coefb)
2039 176472 : gamma_coefc = params(igamma_coefc)
2040 :
2041 176472 : mu = params(imu)
2042 :
2043 176472 : beta = params(ibeta)
2044 :
2045 176472 : lmin_coef = params(ilmin_coef)
2046 :
2047 176472 : omicron = params(iomicron)
2048 176472 : zeta_vrnce_rat = params(izeta_vrnce_rat)
2049 :
2050 176472 : upsilon_precip_frac_rat = params(iupsilon_precip_frac_rat)
2051 176472 : lambda0_stability_coef = params(ilambda0_stability_coef)
2052 176472 : mult_coef = params(imult_coef)
2053 :
2054 176472 : taumin = params(itaumin)
2055 176472 : taumax = params(itaumax)
2056 :
2057 176472 : Lscale_mu_coef = params(iLscale_mu_coef)
2058 176472 : Lscale_pert_coef = params(iLscale_pert_coef)
2059 176472 : alpha_corr = params(ialpha_corr)
2060 176472 : Skw_denom_coef = params(iSkw_denom_coef)
2061 176472 : c_K10 = params(ic_K10)
2062 176472 : c_K10h = params(ic_K10h)
2063 :
2064 176472 : thlp2_rad_coef = params(ithlp2_rad_coef)
2065 176472 : thlp2_rad_cloud_frac_thresh = params(ithlp2_rad_cloud_frac_thresh)
2066 176472 : up2_sfc_coef = params(iup2_sfc_coef)
2067 176472 : Skw_max_mag = params(iSkw_max_mag)
2068 176472 : xp3_coef_base = params(ixp3_coef_base)
2069 176472 : xp3_coef_slope = params(ixp3_coef_slope)
2070 176472 : altitude_threshold = params(ialtitude_threshold)
2071 176472 : rtp2_clip_coef = params(irtp2_clip_coef)
2072 176472 : C_invrs_tau_bkgnd = params(iC_invrs_tau_bkgnd)
2073 176472 : C_invrs_tau_sfc = params(iC_invrs_tau_sfc )
2074 176472 : C_invrs_tau_shear = params(iC_invrs_tau_shear)
2075 176472 : C_invrs_tau_N2 = params(iC_invrs_tau_N2)
2076 176472 : C_invrs_tau_N2_wp2 = params(iC_invrs_tau_N2_wp2)
2077 176472 : C_invrs_tau_N2_xp2 = params(iC_invrs_tau_N2_xp2)
2078 176472 : C_invrs_tau_N2_wpxp = params(iC_invrs_tau_N2_wpxp)
2079 176472 : C_invrs_tau_N2_clear_wp3 = params(iC_invrs_tau_N2_clear_wp3)
2080 176472 : C_invrs_tau_wpxp_Ri = params(iC_invrs_tau_wpxp_Ri)
2081 176472 : C_invrs_tau_wpxp_N2_thresh = params(iC_invrs_tau_wpxp_N2_thresh)
2082 176472 : Cx_min = params(iCx_min)
2083 176472 : Cx_max = params(iCx_max)
2084 176472 : Richardson_num_min = params(iRichardson_num_min)
2085 176472 : Richardson_num_max = params(iRichardson_num_max)
2086 176472 : a3_coef_min = params(ia3_coef_min)
2087 176472 : a_const = params(ia_const)
2088 176472 : bv_efold = params(ibv_efold)
2089 176472 : wpxp_Ri_exp = params(iwpxp_Ri_exp)
2090 176472 : z_displace = params(iz_displace)
2091 :
2092 176472 : return
2093 : end subroutine unpack_parameters
2094 :
2095 : !=============================================================================
2096 : subroutine init_parameters_999( &
2097 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
2098 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, &
2099 : C6thl, C6thlb, C6thlc, C7, C7b, C7c, C8, C8b, C10, &
2100 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
2101 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
2102 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
2103 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
2104 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
2105 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
2106 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
2107 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
2108 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
2109 : lambda0_stability_coef, mult_coef, taumin, taumax, &
2110 : Lscale_mu_coef, Lscale_pert_coef, alpha_corr, &
2111 : Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, &
2112 : thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
2113 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, &
2114 : altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, &
2115 : C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, &
2116 : C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, &
2117 : C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
2118 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
2119 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
2120 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace )
2121 :
2122 : ! Description:
2123 : ! Set all tunable parameters to NaN
2124 :
2125 : ! References:
2126 : ! None
2127 : !-----------------------------------------------------------------------
2128 :
2129 : implicit none
2130 :
2131 : ! Output variables
2132 : real( kind = core_rknd ), intent(out) :: &
2133 : C1, C1b, C1c, C2rt, C2thl, C2rtthl, &
2134 : C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, &
2135 : C7, C7b, C7c, C8, C8b, C10, &
2136 : C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, &
2137 : C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, &
2138 : C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, &
2139 : c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, &
2140 : c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, &
2141 : slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, &
2142 : coef_spread_DG_means_rt, coef_spread_DG_means_thl, &
2143 : gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, &
2144 : omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, &
2145 : lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, &
2146 : Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, &
2147 : thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, &
2148 : Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, &
2149 : rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, &
2150 : C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, &
2151 : C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, &
2152 : C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, &
2153 : Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, &
2154 : wpxp_Ri_exp, a3_coef_min, a_const, bv_efold, z_displace
2155 :
2156 : ! --- Begin Code ---
2157 :
2158 : C1 = init_value
2159 : C1b = init_value
2160 : C1c = init_value
2161 : C2rt = init_value
2162 : C2thl = init_value
2163 : C2rtthl = init_value
2164 : C4 = init_value
2165 : C_uu_shr = init_value
2166 : C_uu_buoy = init_value
2167 : C6rt = init_value
2168 : C6rtb = init_value
2169 : C6rtc = init_value
2170 : C6thl = init_value
2171 : C6thlb = init_value
2172 : C6thlc = init_value
2173 : C7 = init_value
2174 : C7b = init_value
2175 : C7c = init_value
2176 : C8 = init_value
2177 : C8b = init_value
2178 : C10 = init_value
2179 : C11 = init_value
2180 : C11b = init_value
2181 : C11c = init_value
2182 : C12 = init_value
2183 : C13 = init_value
2184 : C14 = init_value
2185 : C_wp2_pr_dfsn = init_value
2186 : C_wp3_pr_tp = init_value
2187 : C_wp3_pr_turb = init_value
2188 : C_wp3_pr_dfsn = init_value
2189 : C_wp2_splat = init_value
2190 : C6rt_Lscale0 = init_value
2191 : C6thl_Lscale0 = init_value
2192 : C7_Lscale0 = init_value
2193 : wpxp_L_thresh = init_value
2194 : c_K = init_value
2195 : c_K1 = init_value
2196 : nu1 = init_value
2197 : c_K2 = init_value
2198 : nu2 = init_value
2199 : c_K6 = init_value
2200 : nu6 = init_value
2201 : c_K8 = init_value
2202 : nu8 = init_value
2203 : c_K9 = init_value
2204 : nu9 = init_value
2205 : nu10 = init_value
2206 : c_K_hm = init_value
2207 : c_K_hmb = init_value
2208 : K_hm_min_coef = init_value
2209 : nu_hm = init_value
2210 : slope_coef_spread_DG_means_w = init_value
2211 : pdf_component_stdev_factor_w = init_value
2212 : coef_spread_DG_means_rt = init_value
2213 : coef_spread_DG_means_thl = init_value
2214 : beta = init_value
2215 : gamma_coef = init_value
2216 : gamma_coefb = init_value
2217 : gamma_coefc = init_value
2218 : mult_coef = init_value
2219 : taumin = init_value
2220 : taumax = init_value
2221 : lmin_coef = init_value
2222 : omicron = init_value
2223 : zeta_vrnce_rat = init_value
2224 : upsilon_precip_frac_rat = init_value
2225 : lambda0_stability_coef = init_value
2226 : mu = init_value
2227 : Lscale_mu_coef = init_value
2228 : Lscale_pert_coef = init_value
2229 : alpha_corr = init_value
2230 : Skw_denom_coef = init_value
2231 : c_K10 = init_value
2232 : c_K10h = init_value
2233 : thlp2_rad_coef = init_value
2234 : thlp2_rad_cloud_frac_thresh = init_value
2235 : up2_sfc_coef = init_value
2236 : Skw_max_mag = init_value
2237 : xp3_coef_base = init_value
2238 : xp3_coef_slope = init_value
2239 : altitude_threshold = init_value
2240 : rtp2_clip_coef = init_value
2241 : C_invrs_tau_bkgnd = init_value
2242 : C_invrs_tau_sfc = init_value
2243 : C_invrs_tau_shear = init_value
2244 : C_invrs_tau_N2 = init_value
2245 : C_invrs_tau_N2_xp2 = init_value
2246 : C_invrs_tau_N2_wp2 = init_value
2247 : C_invrs_tau_N2_wpxp = init_value
2248 : C_invrs_tau_N2_clear_wp3 = init_value
2249 : C_invrs_tau_wpxp_Ri = init_value
2250 : C_invrs_tau_wpxp_N2_thresh = init_value
2251 : Cx_min = init_value
2252 : Cx_max = init_value
2253 : Richardson_num_min = init_value
2254 : Richardson_num_max = init_value
2255 : a3_coef_min = init_value
2256 : a_const = init_value
2257 : bv_efold = init_value
2258 : wpxp_Ri_exp = init_value
2259 : z_displace = init_value
2260 : return
2261 :
2262 : end subroutine init_parameters_999
2263 :
2264 : !===============================================================================
2265 :
2266 0 : end module parameters_tunable
|