Function for computing the scalar RHS for diffusion operator without terrain.
86 amrex::ignore_unused(use_most);
88 const Real dx_inv = cellSizeInv[0];
89 const Real dy_inv = cellSizeInv[1];
90 const Real dz_inv = cellSizeInv[2];
92 const auto& dom_hi = ubound(domain);
94 Real l_inv_theta0 = 1.0 / turbChoice.
theta_ref;
95 Real l_abs_g = std::abs(grav_gpu[2]);
97 bool l_use_keqn = ( (turbChoice.
les_type == LESType::Deardorff) ||
98 (turbChoice.
rans_type == RANSType::kEqn) );
99 bool l_use_mynn = (turbChoice.
pbl_type == PBLType::MYNN25);
102 bool l_turb = ( (turbChoice.
les_type == LESType::Smagorinsky) ||
103 (turbChoice.
les_type == LESType::Deardorff ) ||
104 (turbChoice.
rans_type == RANSType::kEqn ) ||
105 (turbChoice.
pbl_type == PBLType::MYNN25 ) ||
106 (turbChoice.
pbl_type == PBLType::YSU ) );
108 const Box xbx = surroundingNodes(bx,0);
109 const Box ybx = surroundingNodes(bx,1);
110 const Box zbx = surroundingNodes(bx,2);
113 const int end_comp = start_comp + num_comp - 1;
194 Gpu::AsyncVector<Real> alpha_eff_d;
195 Gpu::AsyncVector<int> eddy_diff_idx_d,eddy_diff_idy_d,eddy_diff_idz_d;
196 alpha_eff_d.resize(alpha_eff.size());
197 eddy_diff_idx_d.resize(eddy_diff_idx.size());
198 eddy_diff_idy_d.resize(eddy_diff_idy.size());
199 eddy_diff_idz_d.resize(eddy_diff_idz.size());
201 Gpu::copy(Gpu::hostToDevice, alpha_eff.begin() , alpha_eff.end() , alpha_eff_d.begin());
202 Gpu::copy(Gpu::hostToDevice, eddy_diff_idx.begin(), eddy_diff_idx.end(), eddy_diff_idx_d.begin());
203 Gpu::copy(Gpu::hostToDevice, eddy_diff_idy.begin(), eddy_diff_idy.end(), eddy_diff_idy_d.begin());
204 Gpu::copy(Gpu::hostToDevice, eddy_diff_idz.begin(), eddy_diff_idz.end(), eddy_diff_idz_d.begin());
207 Real* d_alpha_eff = alpha_eff_d.data();
208 int* d_eddy_diff_idx = eddy_diff_idx_d.data();
209 int* d_eddy_diff_idy = eddy_diff_idy_d.data();
210 int* d_eddy_diff_idz = eddy_diff_idz_d.data();
213 if (l_consA && l_turb) {
214 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
216 const int qty_index = start_comp + n;
217 const int prim_index = qty_index - 1;
220 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i-1, j, k,
Rho_comp) );
221 Real rhoAlpha = rhoFace * d_alpha_eff[prim_scal_index];
222 rhoAlpha += 0.5 * ( mu_turb(i , j, k, d_eddy_diff_idx[prim_scal_index])
223 + mu_turb(i-1, j, k, d_eddy_diff_idx[prim_scal_index]) );
226 Real met_h_zeta = ax(i,j,k);
232 bool most_on_zlo = ( use_most && rot_most &&
235 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
236 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
237 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
240 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
241 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
242 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
244 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
247 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
249 const int qty_index = start_comp + n;
250 const int prim_index = qty_index - 1;
253 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j-1, k,
Rho_comp) );
254 Real rhoAlpha = rhoFace * d_alpha_eff[prim_scal_index];
255 rhoAlpha += 0.5 * ( mu_turb(i, j , k, d_eddy_diff_idy[prim_scal_index])
256 + mu_turb(i, j-1, k, d_eddy_diff_idy[prim_scal_index]) );
259 Real met_h_zeta = ay(i,j,k);
264 bool most_on_zlo = ( use_most && rot_most &&
267 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
268 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
269 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
272 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
273 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
274 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
276 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
279 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
281 const int qty_index = start_comp + n;
282 const int prim_index = qty_index - 1;
285 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j, k-1,
Rho_comp) );
286 Real rhoAlpha = rhoFace * d_alpha_eff[prim_scal_index];
287 rhoAlpha += 0.5 * ( mu_turb(i, j, k , d_eddy_diff_idz[prim_scal_index])
288 + mu_turb(i, j, k-1, d_eddy_diff_idz[prim_scal_index]) );
290 Real met_h_zeta = az(i,j,k);
302 bool most_on_zlo = ( use_most && exp_most &&
305 if (ext_dir_on_zlo) {
306 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
307 + 3. * cell_prim(i, j, k , prim_index)
308 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
309 }
else if (ext_dir_on_zhi) {
310 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
311 - 3. * cell_prim(i, j, k-1, prim_index)
312 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
314 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
319 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
320 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
321 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
323 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
328 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
332 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
335 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
340 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
342 const int qty_index = start_comp + n;
343 const int prim_index = qty_index - 1;
345 Real rhoAlpha = d_alpha_eff[prim_index];
346 rhoAlpha += 0.5 * ( mu_turb(i , j, k, d_eddy_diff_idx[prim_index])
347 + mu_turb(i-1, j, k, d_eddy_diff_idx[prim_index]) );
350 Real met_h_zeta = ax(i,j,k);
355 bool most_on_zlo = ( use_most && rot_most &&
358 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
359 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
360 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
363 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
364 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
365 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
367 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
370 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
372 const int qty_index = start_comp + n;
373 const int prim_index = qty_index - 1;
375 Real rhoAlpha = d_alpha_eff[prim_index];
376 rhoAlpha += 0.5 * ( mu_turb(i, j , k, d_eddy_diff_idy[prim_index])
377 + mu_turb(i, j-1, k, d_eddy_diff_idy[prim_index]) );
380 Real met_h_zeta = ay(i,j,k);
385 bool most_on_zlo = ( use_most && rot_most &&
388 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
389 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
390 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
393 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
394 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
395 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
397 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
400 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
402 const int qty_index = start_comp + n;
403 const int prim_index = qty_index - 1;
405 Real rhoAlpha = d_alpha_eff[prim_index];
407 rhoAlpha += 0.5 * ( mu_turb(i, j, k , d_eddy_diff_idz[prim_index])
408 + mu_turb(i, j, k-1, d_eddy_diff_idz[prim_index]) );
410 Real met_h_zeta = az(i,j,k);
422 bool most_on_zlo = ( use_most && exp_most &&
425 if (ext_dir_on_zlo) {
426 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
427 + 3. * cell_prim(i, j, k , prim_index)
428 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
429 }
else if (ext_dir_on_zhi) {
430 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
431 - 3. * cell_prim(i, j, k-1, prim_index)
432 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
434 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
439 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
440 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
441 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
443 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
448 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
452 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
455 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
460 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
462 const int qty_index = start_comp + n;
463 const int prim_index = qty_index - 1;
465 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i-1, j, k,
Rho_comp) );
466 Real rhoAlpha = rhoFace * d_alpha_eff[prim_index];
469 Real met_h_zeta = ax(i,j,k);
474 bool most_on_zlo = ( use_most && rot_most &&
477 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
478 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
479 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
482 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
483 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
484 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
486 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
489 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
491 const int qty_index = start_comp + n;
492 const int prim_index = qty_index - 1;
494 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j-1, k,
Rho_comp) );
495 Real rhoAlpha = rhoFace * d_alpha_eff[prim_index];
498 Real met_h_zeta = ay(i,j,k);
503 bool most_on_zlo = ( use_most && rot_most &&
506 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
507 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
508 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
511 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
512 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
513 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
515 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
518 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
520 const int qty_index = start_comp + n;
521 const int prim_index = qty_index - 1;
523 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j, k-1,
Rho_comp) );
524 Real rhoAlpha = rhoFace * d_alpha_eff[prim_index];
526 Real met_h_zeta = az(i,j,k);
538 bool most_on_zlo = ( use_most && exp_most &&
541 if (ext_dir_on_zlo) {
542 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
543 + 3. * cell_prim(i, j, k , prim_index)
544 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
545 }
else if (ext_dir_on_zhi) {
546 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
547 - 3. * cell_prim(i, j, k-1, prim_index)
548 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
550 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
555 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
556 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
557 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
559 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
564 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
568 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
571 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
576 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
578 const int qty_index = start_comp + n;
579 const int prim_index = qty_index - 1;
581 Real rhoAlpha = d_alpha_eff[prim_index];
583 Real met_h_xi,met_h_zeta;
590 bool most_on_zlo = ( use_most && rot_most &&
593 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
594 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
595 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
598 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
599 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
600 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
602 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
605 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
607 const int qty_index = start_comp + n;
608 const int prim_index = qty_index - 1;
610 Real rhoAlpha = d_alpha_eff[prim_index];
612 Real met_h_eta,met_h_zeta;
619 bool most_on_zlo = ( use_most && rot_most &&
622 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
623 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
624 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
627 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
628 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
629 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
631 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
634 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
636 const int qty_index = start_comp + n;
637 const int prim_index = qty_index - 1;
639 Real rhoAlpha = d_alpha_eff[prim_index];
654 bool most_on_zlo = ( use_most && exp_most &&
657 if (ext_dir_on_zlo) {
658 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
659 + 3. * cell_prim(i, j, k , prim_index)
660 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
661 }
else if (ext_dir_on_zhi) {
662 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
663 - 3. * cell_prim(i, j, k-1, prim_index)
664 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
666 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
671 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
672 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
673 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
675 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
680 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
684 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
687 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
696 Box planexy = zbx; planexy.setBig(2, planexy.smallEnd(2) );
697 int k_lo = zbx.smallEnd(2);
int k_hi = zbx.bigEnd(2);
698 zbx3.growLo(2,-1); zbx3.growHi(2,-1);
699 ParallelFor(planexy, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int ,
int n) noexcept
701 const int qty_index = start_comp + n;
702 Real met_h_xi,met_h_eta;
708 Real xfluxlo = 0.5 * ( xflux(i , j , k_lo , qty_index) + xflux(i+1, j , k_lo , qty_index) );
709 Real xfluxhi = 0.5 * ( xflux(i , j , k_lo+1, qty_index) + xflux(i+1, j , k_lo+1, qty_index) );
710 Real xfluxbar = 1.5*xfluxlo - 0.5*xfluxhi;
712 Real yfluxlo = 0.5 * ( yflux(i , j , k_lo , qty_index) + yflux(i , j+1, k_lo , qty_index) );
713 Real yfluxhi = 0.5 * ( yflux(i , j , k_lo+1, qty_index) + yflux(i , j+1, k_lo+1, qty_index) );
714 Real yfluxbar = 1.5*yfluxlo - 0.5*yfluxhi;
716 zflux(i,j,k_lo,qty_index) -= met_h_xi*xfluxbar + met_h_eta*yfluxbar;
723 Real xfluxlo = 0.5 * ( xflux(i , j , k_hi-2, qty_index) + xflux(i+1, j , k_hi-2, qty_index) );
724 Real xfluxhi = 0.5 * ( xflux(i , j , k_hi-1, qty_index) + xflux(i+1, j , k_hi-1, qty_index) );
725 Real xfluxbar = 1.5*xfluxhi - 0.5*xfluxlo;
727 Real yfluxlo = 0.5 * ( yflux(i , j , k_hi-2, qty_index) + yflux(i , j+1, k_hi-2, qty_index) );
728 Real yfluxhi = 0.5 * ( yflux(i , j , k_hi-1, qty_index) + yflux(i , j+1, k_hi-1, qty_index) );
729 Real yfluxbar = 1.5*yfluxhi - 0.5*yfluxlo;
731 zflux(i,j,k_hi,qty_index) -= met_h_xi*xfluxbar + met_h_eta*yfluxbar;
736 ParallelFor(zbx3, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
738 const int qty_index = start_comp + n;
740 Real met_h_xi,met_h_eta;
744 Real xfluxbar = 0.25 * ( xflux(i , j , k , qty_index) + xflux(i+1, j , k , qty_index)
745 + xflux(i , j , k-1, qty_index) + xflux(i+1, j , k-1, qty_index) );
746 Real yfluxbar = 0.25 * ( yflux(i , j , k , qty_index) + yflux(i , j+1, k , qty_index)
747 + yflux(i , j , k-1, qty_index) + yflux(i , j+1, k-1, qty_index) );
749 zflux(i,j,k,qty_index) -= met_h_xi*xfluxbar + met_h_eta*yfluxbar;
752 ParallelFor(xbx, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
754 const int qty_index = start_comp + n;
756 xflux(i,j,k,qty_index) *= met_h_zeta;
758 ParallelFor(ybx, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
760 const int qty_index = start_comp + n;
762 yflux(i,j,k,qty_index) *= met_h_zeta;
768 for (
int n(0); n < num_comp; ++n)
770 int qty_index = start_comp + n;
771 ParallelFor(bx,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
773 Real stateContrib = (xflux(i+1,j ,k ,qty_index) - xflux(i, j, k, qty_index)) * dx_inv * mf_m(i,j,0)
774 +(yflux(i ,j+1,k ,qty_index) - yflux(i, j, k, qty_index)) * dy_inv * mf_m(i,j,0)
775 +(zflux(i ,j ,k+1,qty_index) - zflux(i, j, k, qty_index)) * dz_inv;
777 stateContrib /= detJ(i,j,k);
779 cell_rhs(i,j,k,qty_index) -= stateContrib;
798 ParallelFor(bx,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
811 cell_rhs(i,j,k,qty_index) += l_abs_g * l_inv_theta0 * hfx_z(i,j,k);
817 cell_rhs(i,j,k,qty_index) += 2.0*mu_turb(i,j,k,
EddyDiff::Mom_v) * SmnSmn_a(i,j,k);
820 cell_rhs(i,j,k,qty_index) -= diss(i,j,k);
825 if (l_use_mynn && start_comp <= RhoKE_comp && end_comp >=
RhoKE_comp) {
829 const int rhoqv_comp = solverChoice.
RhoQv_comp;
830 const int rhoqc_comp = solverChoice.
RhoQc_comp;
831 const int rhoqr_comp = solverChoice.
RhoQr_comp;
833 ParallelFor(bx,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
843 cell_rhs(i, j, k, qty_index) +=
ComputeQKESourceTerms(i,j,k,u,v,cell_data,cell_prim,
844 mu_turb,cellSizeInv,domain,
845 pbl_mynn_B1_l,tm_arr(i,j,0),
846 rhoqv_comp, rhoqc_comp, rhoqr_comp,
847 c_ext_dir_on_zlo, c_ext_dir_on_zhi,
848 u_ext_dir_on_zlo, u_ext_dir_on_zhi,
849 v_ext_dir_on_zlo, v_ext_dir_on_zhi,
void DiffusionSrcForState_T(const Box &bx, const Box &domain, int start_comp, int num_comp, const bool &exp_most, const bool &rot_most, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &cell_data, const Array4< const Real > &cell_prim, const Array4< Real > &cell_rhs, const Array4< Real > &xflux, const Array4< Real > &yflux, const Array4< Real > &zflux, const Array4< const Real > &z_nd, const Array4< const Real > &ax, const Array4< const Real > &ay, const Array4< const Real > &az, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const Array4< const Real > &SmnSmn_a, const Array4< const Real > &mf_m, const Array4< const Real > &mf_u, const Array4< const Real > &mf_v, Array4< Real > &hfx_x, Array4< Real > &hfx_y, Array4< Real > &hfx_z, Array4< Real > &qfx1_x, Array4< Real > &qfx1_y, Array4< Real > &qfx1_z, Array4< Real > &qfx2_z, Array4< Real > &diss, const Array4< const Real > &mu_turb, const SolverChoice &solverChoice, const int level, const Array4< const Real > &tm_arr, const GpuArray< Real, AMREX_SPACEDIM > grav_gpu, const BCRec *bc_ptr, const bool use_most)
Definition: ERF_DiffusionSrcForState_T.cpp:43
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:40
#define PrimQ1_comp
Definition: ERF_IndexDefines.H:53
#define NPRIMVAR_max
Definition: ERF_IndexDefines.H:33
#define PrimQ2_comp
Definition: ERF_IndexDefines.H:54
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define PrimQ4_comp
Definition: ERF_IndexDefines.H:56
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:43
#define PrimQ6_comp
Definition: ERF_IndexDefines.H:58
#define NSCALARS
Definition: ERF_IndexDefines.H:16
#define PrimQ5_comp
Definition: ERF_IndexDefines.H:57
#define PrimTheta_comp
Definition: ERF_IndexDefines.H:50
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
#define PrimScalar_comp
Definition: ERF_IndexDefines.H:52
#define PrimQ3_comp
Definition: ERF_IndexDefines.H:55
#define RhoKE_comp
Definition: ERF_IndexDefines.H:38
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeQKESourceTerms(int i, int j, int k, const amrex::Array4< const amrex::Real > &uvel, const amrex::Array4< const amrex::Real > &vvel, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &K_turb, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Box &domain, amrex::Real pbl_mynn_B1_l, const amrex::Real theta_mean, const int RhoQv_comp, const int RhoQc_comp, const int RhoQr_comp, bool c_ext_dir_on_zlo, bool c_ext_dir_on_zhi, bool u_ext_dir_on_zlo, bool u_ext_dir_on_zhi, bool v_ext_dir_on_zlo, bool v_ext_dir_on_zhi, const bool use_most=false, const amrex::Real met_h_zeta=1.0)
Definition: ERF_PBLModels.H:160
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_xi_AtIface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:101
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtKface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:173
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtIface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:87
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_xi_AtKface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:188
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtJface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:130
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_eta_AtJface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:158
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_eta_AtKface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:202
@ RhoScalar_bc_comp
Definition: ERF_IndexDefines.H:80
@ yvel_bc
Definition: ERF_IndexDefines.H:89
@ cons_bc
Definition: ERF_IndexDefines.H:76
@ xvel_bc
Definition: ERF_IndexDefines.H:88
@ foextrap
Definition: ERF_IndexDefines.H:179
@ ext_dir
Definition: ERF_IndexDefines.H:180
@ ext_dir_prim
Definition: ERF_IndexDefines.H:182
@ Theta_v
Definition: ERF_IndexDefines.H:157
@ Scalar_v
Definition: ERF_IndexDefines.H:159
@ Q_v
Definition: ERF_IndexDefines.H:160
@ Q_h
Definition: ERF_IndexDefines.H:155
@ Mom_v
Definition: ERF_IndexDefines.H:156
@ Scalar_h
Definition: ERF_IndexDefines.H:154
@ KE_v
Definition: ERF_IndexDefines.H:158
@ Theta_h
Definition: ERF_IndexDefines.H:152
@ KE_h
Definition: ERF_IndexDefines.H:153
Definition: ERF_DiffStruct.H:19
amrex::Real rhoAlpha_C
Definition: ERF_DiffStruct.H:95
amrex::Real rhoAlpha_T
Definition: ERF_DiffStruct.H:94
amrex::Real alpha_T
Definition: ERF_DiffStruct.H:87
amrex::Real alpha_C
Definition: ERF_DiffStruct.H:88
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
amrex::Real B1
Definition: ERF_MYNNStruct.H:43
int RhoQr_comp
Definition: ERF_DataStruct.H:700
DiffChoice diffChoice
Definition: ERF_DataStruct.H:592
int RhoQc_comp
Definition: ERF_DataStruct.H:694
int RhoQv_comp
Definition: ERF_DataStruct.H:693
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:594
Definition: ERF_TurbStruct.H:31
MYNNLevel25 pbl_mynn
Definition: ERF_TurbStruct.H:243
PBLType pbl_type
Definition: ERF_TurbStruct.H:241
RANSType rans_type
Definition: ERF_TurbStruct.H:238
LESType les_type
Definition: ERF_TurbStruct.H:205
amrex::Real theta_ref
Definition: ERF_TurbStruct.H:235