288 FArrayBox w3_zt, thl_sec_zt, qw_sec_zt, wthl_zt, wqw_zt, qwthl_zt;
289 const auto layout = col.
layout;
290 const Box cell_box(IntVect(0,0,0), IntVect(layout.ncell - 1, layout.nlev - 1, 0));
291 w3_zt.resize(cell_box, 1, The_Async_Arena());
292 thl_sec_zt.resize(cell_box, 1, The_Async_Arena());
293 qw_sec_zt.resize(cell_box, 1, The_Async_Arena());
294 wthl_zt.resize(cell_box, 1, The_Async_Arena());
295 wqw_zt.resize(cell_box, 1, The_Async_Arena());
296 qwthl_zt.resize(cell_box, 1, The_Async_Arena());
299 BL_PROFILE(
"SHOC::advance::pdf::interpolate");
309 auto shoc_ql = col.
shoc_ql.array();
310 auto shoc_ql2 = col.
shoc_ql2.array();
313 auto wqls_sec = col.
wqls_sec.array();
314 auto wthv_sec = col.
wthv_sec.array();
316 const auto thetal = col.
thetal.const_array();
317 const auto qw = col.
qw.const_array();
318 const auto w_field = col.
w.const_array();
319 const auto p_mid = col.
p_mid.const_array();
320 const auto thl_sec = thl_sec_zt.const_array();
321 const auto qw_sec = qw_sec_zt.const_array();
322 const auto qwthl_sec = qwthl_zt.const_array();
323 const auto wthl_sec = wthl_zt.const_array();
324 const auto wqw_sec = wqw_zt.const_array();
325 const auto w_sec = col.
w_sec.const_array();
326 const auto w3 = w3_zt.const_array();
329 BL_PROFILE(
"SHOC::advance::pdf::main_kernel");
330 ParallelFor(cell_box, [=] AMREX_GPU_DEVICE (
int ic,
int k,
int) noexcept
332 const Real thl_first = thetal(ic,k,0);
333 const Real qw_first = qw(ic,k,0);
334 const Real w_first = w_field(ic,k,0);
335 const Real w2sec = amrex::max(w_sec(ic,k,0), 0.0_rt);
336 const Real sqrtw2 = std::sqrt(w2sec);
337 const Real sqrtthl = amrex::max(
shoc_thl_tol(), std::sqrt(amrex::max(thl_sec(ic,k,0), 0.0_rt)));
338 const Real sqrtqt = amrex::max(
shoc_rt_tol(), std::sqrt(amrex::max(qw_sec(ic,k,0), 0.0_rt)));
340 Real skew_w = 0.0, w1_1 = w_first, w1_2 = w_first, w2_1 = 0.0, w2_2 = 0.0, a = 0.5;
341 vv_parameters(w_first, w2sec, w3(ic,k,0), skew_w, w1_1, w1_2, w2_1, w2_2, a);
343 Real thl1_1 = thl_first, thl1_2 = thl_first, thl2_1 = 0.0, thl2_2 = 0.0;
344 Real sqrtthl2_1 = 0.0, sqrtthl2_2 = 0.0;
345 thl_parameters(wthl_sec(ic,k,0), sqrtw2, sqrtthl, amrex::max(thl_sec(ic,k,0), 0.0_rt),
346 thl_first, w1_1, w1_2, skew_w, a,
347 thl1_1, thl1_2, thl2_1, thl2_2, sqrtthl2_1, sqrtthl2_2);
349 Real qw1_1 = qw_first, qw1_2 = qw_first, qw2_1 = 0.0, qw2_2 = 0.0;
350 Real sqrtqw2_1 = 0.0, sqrtqw2_2 = 0.0;
351 qw_parameters(wqw_sec(ic,k,0), sqrtw2, skew_w, sqrtqt, amrex::max(qw_sec(ic,k,0), 0.0_rt),
352 w1_2, w1_1, qw_first, a,
353 qw1_1, qw1_2, qw2_1, qw2_2, sqrtqw2_1, sqrtqw2_2);
355 w1_1 = w1_1 * sqrtw2 + w_first;
356 w1_2 = w1_2 * sqrtw2 + w_first;
359 sqrtqw2_2, sqrtthl2_2,
360 qwthl_sec(ic,k,0), qw1_1, qw_first,
361 thl1_1, thl_first, qw1_2, thl1_2);
365 Real qs1 = 0.0_rt, beta1 = 0.0_rt, qs2 = 0.0_rt, beta2 = 0.0_rt;
369 Real s1 = 0.0_rt, std_s1 = 0.0_rt, qn1 = 0.0_rt,
c1 = 0.0_rt;
370 Real s2 = 0.0_rt, std_s2 = 0.0_rt,
qn2 = 0.0_rt,
c2 = 0.0_rt;
372 sqrtthl2_1, sqrtqw2_1, r_qwthl_1, s1, std_s1, qn1,
c1);
374 if (qw1_1 == qw1_2 && thl2_1 == thl2_2 && qs1 == qs2) {
381 sqrtthl2_2, sqrtqw2_2, r_qwthl_1, s2, std_s2,
qn2,
c2);
384 const Real ql1 = amrex::min(qn1, qw1_1);
385 const Real ql2 = amrex::min(
qn2, qw1_2);
386 const Real old_ql = shoc_ql(ic,k,0);
387 const Real cldfrac = amrex::min(1.0_rt, a *
c1 + (1.0_rt - a) *
c2);
388 const Real ql = amrex::max(0.0_rt, a * ql1 + (1.0_rt - a) * ql2);
389 const Real ql2_var = amrex::max(0.0_rt, a * (s1 * ql1 +
c1 * std_s1 * std_s1)
390 + (1.0_rt - a) * (s2 * ql2 +
c2 * std_s2 * std_s2)
392 const Real wqls = a * ((w1_1 - w_first) * ql1) + (1.0_rt - a) * ((w1_2 - w_first) * ql2);
394 shoc_cldfrac(ic,k,0) =
clamp01(cldfrac);
395 shoc_ql(ic,k,0) = ql;
396 shoc_ql2(ic,k,0) = ql2_var;
397 wqls_sec(ic,k,0) = wqls;
399 p_mid(ic,k,0), wqls);
402 const Real dt =
static_cast<Real
>(dt_d);
403 const Real ql_change = ql - old_ql;
404 shoc_cond(ic,k,0) = amrex::max(0.0_rt, ql_change / amrex::max(dt,
eps()));
405 shoc_evap(ic,k,0) = amrex::max(0.0_rt, -ql_change / amrex::max(dt,
eps()));
407 shoc_cond(ic,k,0) = 0.0_rt;
408 shoc_evap(ic,k,0) = 0.0_rt;
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
@ qn2
Definition: ERF_AdvanceWDM6.cpp:272
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real inplume_correlation(Real sqrtqw2_1, Real sqrtthl2_1, Real a, Real sqrtqw2_2, Real sqrtthl2_2, Real qwthlsec, Real qw1_1, Real qw_first, Real thl1_1, Real thl_first, Real qw1_2, Real thl1_2)
Definition: ERF_ShocPDF.cpp:199
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void vv_parameters(Real w_first, Real w_sec, Real w3var, Real &skew_w, Real &w1_1, Real &w1_2, Real &w2_1, Real &w2_2, Real &a)
Definition: ERF_ShocPDF.cpp:76
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void compute_s_terms(Real qw1, Real qs, Real beta, Real pval, Real thl2, Real qw2, Real sqrtthl2, Real sqrtqw2, Real r_qwthl, Real &s, Real &std_s, Real &qn, Real &cfrac)
Definition: ERF_ShocPDF.cpp:232
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real shoc_rt_tol() noexcept
Definition: ERF_ShocPDF.cpp:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void thl_parameters(Real wthlsec, Real sqrtw2, Real sqrtthl, Real thlsec, Real thl_first, Real w1_1, Real w1_2, Real skew_w, Real a, Real &thl1_1, Real &thl1_2, Real &thl2_1, Real &thl2_2, Real &sqrtthl2_1, Real &sqrtthl2_2)
Definition: ERF_ShocPDF.cpp:104
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real shoc_thl_tol() noexcept
Definition: ERF_ShocPDF.cpp:15
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real eps()
Definition: ERF_ShocPDF.cpp:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void compute_qs_beta(Real temp, Real pval, Real &qs, Real &beta)
Definition: ERF_ShocPDF.cpp:223
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real compute_buoyancy_flux(Real wthlsec, Real wqwsec, Real pval, Real wqls)
Definition: ERF_ShocPDF.cpp:267
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real shoc_large_neg() noexcept
Definition: ERF_ShocPDF.cpp:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void qw_parameters(Real wqwsec, Real sqrtw2, Real skew_w, Real sqrtqt, Real qwsec, Real w1_2, Real w1_1, Real qw_first, Real a, Real &qw1_1, Real &qw1_2, Real &qw2_1, Real &qw2_2, Real &sqrtqw2_1, Real &sqrtqw2_2)
Definition: ERF_ShocPDF.cpp:153
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real clamp01(Real x)
Definition: ERF_ShocPDF.cpp:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real compute_temperature(Real thl1, Real pval)
Definition: ERF_ShocPDF.cpp:216
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real shoc_tl_min() noexcept
Definition: ERF_ShocPDF.cpp:21
void interpolate_iface_to_cc(const ShocColumnData &col, const FArrayBox &iface_in, FArrayBox &cc_out, Real min_thresh)
Definition: ERF_ShocPDF.cpp:54
real(c_double), parameter c2
Definition: ERF_module_model_constants.F90:35
real(c_double), private c1
Definition: ERF_module_mp_morr_two_moment.F90:212
amrex::FArrayBox shoc_cond
Definition: ERF_ShocTypes.H:116
amrex::FArrayBox w_sec
Definition: ERF_ShocTypes.H:128
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:127
amrex::FArrayBox shoc_evap
Definition: ERF_ShocTypes.H:117
amrex::FArrayBox wthv_sec
Definition: ERF_ShocTypes.H:111
amrex::FArrayBox wqw_sec
Definition: ERF_ShocTypes.H:123
amrex::FArrayBox shoc_ql
Definition: ERF_ShocTypes.H:113
amrex::FArrayBox w
Definition: ERF_ShocTypes.H:92
amrex::FArrayBox qw_sec
Definition: ERF_ShocTypes.H:120
ShocColumnLayout layout
Definition: ERF_ShocTypes.H:71
amrex::FArrayBox qw
Definition: ERF_ShocTypes.H:87
amrex::FArrayBox p_mid
Definition: ERF_ShocTypes.H:77
amrex::FArrayBox wqls_sec
Definition: ERF_ShocTypes.H:115
amrex::FArrayBox wthl_sec
Definition: ERF_ShocTypes.H:122
amrex::FArrayBox thl_sec
Definition: ERF_ShocTypes.H:119
amrex::FArrayBox shoc_ql2
Definition: ERF_ShocTypes.H:114
amrex::FArrayBox qwthl_sec
Definition: ERF_ShocTypes.H:121
amrex::FArrayBox shoc_cldfrac
Definition: ERF_ShocTypes.H:112
amrex::FArrayBox thetal
Definition: ERF_ShocTypes.H:83
bool extra_shoc_diags
Definition: ERF_ShocTypes.H:36