171 static_cast<void>(opts);
178 const Box iface_box(IntVect(0,0,0), IntVect(col.
layout.
ncell - 1, nlev, 0));
179 const Box tri_box(IntVect(0,0,0), IntVect(col.
layout.
ncell - 1, 0, nlev - 1));
180 FArrayBox rho_zi_fab(iface_box, 1, The_Async_Arena());
181 FArrayBox tk_zi_fab(iface_box, 1, The_Async_Arena());
182 FArrayBox tkh_zi_fab(iface_box, 1, The_Async_Arena());
183 FArrayBox tmpi_fab(iface_box, 1, The_Async_Arena());
184 FArrayBox rdp_zt_fab(Box(IntVect(0,0,0), IntVect(col.
layout.
ncell - 1, nlev - 1, 0)), 1, The_Async_Arena());
185 FArrayBox rhs_fab(tri_box, 1, The_Async_Arena());
186 FArrayBox soln_fab(tri_box, 1, The_Async_Arena());
187 FArrayBox coeffA_fab(tri_box, 1, The_Async_Arena());
188 FArrayBox coeffB_fab(tri_box, 1, The_Async_Arena());
189 FArrayBox inv_coeffB_fab(tri_box, 1, The_Async_Arena());
190 FArrayBox coeffC_fab(tri_box, 1, The_Async_Arena());
192 interpolate_cc_to_iface(col, col.
rho, rho_zi_fab);
193 interpolate_cc_to_iface(col, col.
tk, tk_zi_fab);
194 interpolate_cc_to_iface(col, col.
tkh, tkh_zi_fab);
196 auto thetal = col.
thetal.array();
197 auto qw = col.
qw.array();
198 auto tke = col.
tke.array();
199 auto u = col.
u.array();
200 auto v = col.
v.array();
202 const auto surf_tau_u = col.
surf_tau_u.const_array();
203 const auto surf_tau_v = col.
surf_tau_v.const_array();
206 const auto rho = col.
rho.const_array();
207 const auto dz = col.
dz.const_array();
208 const auto zt = col.
zt.const_array();
209 const auto zi = col.
zi.const_array();
210 const auto rho_zi = rho_zi_fab.const_array();
211 const auto tk_zi = tk_zi_fab.const_array();
212 const auto tkh_zi = tkh_zi_fab.const_array();
213 const auto layout = col.
layout;
214 auto tmpi = tmpi_fab.array();
215 auto rdp_zt = rdp_zt_fab.array();
216 auto rhs = rhs_fab.array();
217 auto soln = soln_fab.array();
218 auto coeffA = coeffA_fab.array();
219 auto coeffB = coeffB_fab.array();
220 auto inv_coeffB = inv_coeffB_fab.array();
221 auto coeffC = coeffC_fab.array();
223 const Box col_box(IntVect(0,0,0), IntVect(layout.ncell - 1, 0, 0));
224 ParallelFor(col_box, [=] AMREX_GPU_DEVICE (
int ic,
int,
int) noexcept
226 for (
int k = 0; k <= nlev; ++k) {
227 tmpi(ic,k,0) = dt *
CONST_GRAV * amrex::max(rho_zi(ic,k,0), 1.0e-12_rt) /
228 interface_spacing(zt,
zi, layout, ic, k);
230 rdp_zt(ic,k,0) = 1.0_rt / amrex::max(
CONST_GRAV *
rho(ic,k,0) *
dz(ic,k,0), 1.0e-12_rt);
238 const Real cmnfac = dt *
CONST_GRAV * amrex::max(rho_zi(ic,0,0), 1.0e-12_rt) * rdp_zt(ic,0,0);
240 const Real uw_sfc = surf_tau_u(ic,0,0);
241 const Real vw_sfc = surf_tau_v(ic,0,0);
242 const Real stress_mag = std::sqrt(uw_sfc * uw_sfc + vw_sfc * vw_sfc);
244 Real wtke_sfc = 0.0_rt;
245 if (stress_mag > 1.0e-12_rt) {
246 const Real ws = amrex::max(std::sqrt(u(ic,0,0) * u(ic,0,0) + v(ic,0,0) * v(ic,0,0)), shoc_u_ws_min());
247 const Real rho_zi_sfc = amrex::max(rho_zi(ic,0,0), 1.0e-12_rt);
248 const Real tau_u = rho_zi_sfc * uw_sfc;
249 const Real tau_v = rho_zi_sfc * vw_sfc;
250 const Real tau = std::sqrt(tau_u * tau_u + tau_v * tau_v);
251 ksrf = amrex::max(tau / ws, shoc_ksrf_min());
252 const Real ustar = amrex::max(std::sqrt(stress_mag), shoc_ustar_min());
253 wtke_sfc = ustar * ustar * ustar;
256 for (
int k = 0; k < nlev; ++k) {
257 rhs(ic,0,k) = u(ic,k,0);
258 coeffA(ic,0,k) = (k > 0) ? -tk_zi(ic,k,0) * tmpi(ic,k,0) * rdp_zt(ic,k,0) : 0.0_rt;
259 coeffC(ic,0,k) = (k < nlev - 1) ? -tk_zi(ic,k+1,0) * tmpi(ic,k+1,0) * rdp_zt(ic,k,0) : 0.0_rt;
260 coeffB(ic,0,k) = 1.0_rt - coeffA(ic,0,k) - coeffC(ic,0,k);
262 coeffB(ic,0,0) += ksrf * dt *
CONST_GRAV * rdp_zt(ic,0,0);
263 SolveTridiag(ic, 0, 0, nlev - 1, soln, coeffA, coeffB, inv_coeffB, coeffC, rhs);
264 for (
int k = 0; k < nlev; ++k) {
265 u(ic,k,0) = soln(ic,0,k);
268 for (
int k = 0; k < nlev; ++k) {
269 rhs(ic,0,k) = v(ic,k,0);
270 coeffA(ic,0,k) = (k > 0) ? -tk_zi(ic,k,0) * tmpi(ic,k,0) * rdp_zt(ic,k,0) : 0.0_rt;
271 coeffC(ic,0,k) = (k < nlev - 1) ? -tk_zi(ic,k+1,0) * tmpi(ic,k+1,0) * rdp_zt(ic,k,0) : 0.0_rt;
272 coeffB(ic,0,k) = 1.0_rt - coeffA(ic,0,k) - coeffC(ic,0,k);
274 coeffB(ic,0,0) += ksrf * dt *
CONST_GRAV * rdp_zt(ic,0,0);
275 SolveTridiag(ic, 0, 0, nlev - 1, soln, coeffA, coeffB, inv_coeffB, coeffC, rhs);
276 for (
int k = 0; k < nlev; ++k) {
277 v(ic,k,0) = soln(ic,0,k);
280 for (
int k = 0; k < nlev; ++k) {
281 rhs(ic,0,k) = thetal(ic,k,0);
282 coeffA(ic,0,k) = (k > 0) ? -tkh_zi(ic,k,0) * tmpi(ic,k,0) * rdp_zt(ic,k,0) : 0.0_rt;
283 coeffC(ic,0,k) = (k < nlev - 1) ? -tkh_zi(ic,k+1,0) * tmpi(ic,k+1,0) * rdp_zt(ic,k,0) : 0.0_rt;
284 coeffB(ic,0,k) = 1.0_rt - coeffA(ic,0,k) - coeffC(ic,0,k);
286 rhs(ic,0,0) += cmnfac * surf_sens_flux(ic,0,0);
287 SolveTridiag(ic, 0, 0, nlev - 1, soln, coeffA, coeffB, inv_coeffB, coeffC, rhs);
288 for (
int k = 0; k < nlev; ++k) {
289 thetal(ic,k,0) = soln(ic,0,k);
292 for (
int k = 0; k < nlev; ++k) {
293 rhs(ic,0,k) = qw(ic,k,0);
294 coeffA(ic,0,k) = (k > 0) ? -tkh_zi(ic,k,0) * tmpi(ic,k,0) * rdp_zt(ic,k,0) : 0.0_rt;
295 coeffC(ic,0,k) = (k < nlev - 1) ? -tkh_zi(ic,k+1,0) * tmpi(ic,k+1,0) * rdp_zt(ic,k,0) : 0.0_rt;
296 coeffB(ic,0,k) = 1.0_rt - coeffA(ic,0,k) - coeffC(ic,0,k);
298 rhs(ic,0,0) += cmnfac * surf_lat_flux(ic,0,0);
299 SolveTridiag(ic, 0, 0, nlev - 1, soln, coeffA, coeffB, inv_coeffB, coeffC, rhs);
300 for (
int k = 0; k < nlev; ++k) {
301 qw(ic,k,0) = amrex::max(soln(ic,0,k), shoc_min_qw());
304 for (
int k = 0; k < nlev; ++k) {
305 rhs(ic,0,k) =
shoc_clamp(tke(ic,k,0), shoc_min_tke(), shoc_max_tke());
306 coeffA(ic,0,k) = (k > 0) ? -tkh_zi(ic,k,0) * tmpi(ic,k,0) * rdp_zt(ic,k,0) : 0.0_rt;
307 coeffC(ic,0,k) = (k < nlev - 1) ? -tkh_zi(ic,k+1,0) * tmpi(ic,k+1,0) * rdp_zt(ic,k,0) : 0.0_rt;
308 coeffB(ic,0,k) = 1.0_rt - coeffA(ic,0,k) - coeffC(ic,0,k);
310 rhs(ic,0,0) += cmnfac * wtke_sfc;
311 SolveTridiag(ic, 0, 0, nlev - 1, soln, coeffA, coeffB, inv_coeffB, coeffC, rhs);
312 for (
int k = 0; k < nlev; ++k) {
313 tke(ic,k,0) =
shoc_clamp(soln(ic,0,k), shoc_min_tke(), shoc_max_tke());
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:53
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
rho
Definition: ERF_InitCustomPert_Bubble.H:106
ParallelFor(grown_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);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T shoc_clamp(T value, T lo, T hi)
Definition: ERF_ShocTypes.H:382
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SolveTridiag(int i, int j, int klo, int khi, const amrex::Array4< amrex::Real > &soln_a, const amrex::Array4< const amrex::Real > &coeffA_a, const amrex::Array4< amrex::Real > &coeffB_a, const amrex::Array4< amrex::Real > &inv_coeffB_a, const amrex::Array4< const amrex::Real > &coeffC_a, const amrex::Array4< const amrex::Real > &RHS_a)
Definition: ERF_SolveTridiag.H:6
@ dz
Definition: ERF_AdvanceWSM6.cpp:104
@ zi
Definition: ERF_AdvanceWSM6.cpp:133
amrex::FArrayBox dz
Definition: ERF_ShocTypes.H:210
amrex::FArrayBox tk
Definition: ERF_ShocTypes.H:236
amrex::FArrayBox surf_lat_flux
Definition: ERF_ShocTypes.H:277
amrex::FArrayBox rho
Definition: ERF_ShocTypes.H:213
amrex::FArrayBox surf_tau_v
Definition: ERF_ShocTypes.H:279
amrex::FArrayBox tke
Definition: ERF_ShocTypes.H:223
amrex::FArrayBox tkh
Definition: ERF_ShocTypes.H:237
ShocColumnLayout layout
Definition: ERF_ShocTypes.H:205
amrex::FArrayBox zi
Definition: ERF_ShocTypes.H:209
amrex::FArrayBox surf_sens_flux
Definition: ERF_ShocTypes.H:276
amrex::FArrayBox qw
Definition: ERF_ShocTypes.H:221
amrex::FArrayBox v
Definition: ERF_ShocTypes.H:225
amrex::FArrayBox zt
Definition: ERF_ShocTypes.H:208
amrex::FArrayBox u
Definition: ERF_ShocTypes.H:224
amrex::FArrayBox surf_tau_u
Definition: ERF_ShocTypes.H:278
amrex::FArrayBox thetal
Definition: ERF_ShocTypes.H:217
int nlev
Definition: ERF_ShocTypes.H:196
int ncell
Definition: ERF_ShocTypes.H:195