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_ddorf = (turbChoice.
les_type == LESType::Deardorff);
98 bool l_use_mynn = (turbChoice.
pbl_type == PBLType::MYNN25);
101 bool l_turb = ( (turbChoice.
les_type == LESType::Smagorinsky) ||
102 (turbChoice.
les_type == LESType::Deardorff ) ||
103 (turbChoice.
pbl_type == PBLType::MYNN25 ) ||
104 (turbChoice.
pbl_type == PBLType::YSU ) );
106 const Box xbx = surroundingNodes(bx,0);
107 const Box ybx = surroundingNodes(bx,1);
108 const Box zbx = surroundingNodes(bx,2);
111 const int end_comp = start_comp + num_comp - 1;
192 Gpu::AsyncVector<Real> alpha_eff_d;
193 Gpu::AsyncVector<int> eddy_diff_idx_d,eddy_diff_idy_d,eddy_diff_idz_d;
194 alpha_eff_d.resize(alpha_eff.size());
195 eddy_diff_idx_d.resize(eddy_diff_idx.size());
196 eddy_diff_idy_d.resize(eddy_diff_idy.size());
197 eddy_diff_idz_d.resize(eddy_diff_idz.size());
199 Gpu::copy(Gpu::hostToDevice, alpha_eff.begin() , alpha_eff.end() , alpha_eff_d.begin());
200 Gpu::copy(Gpu::hostToDevice, eddy_diff_idx.begin(), eddy_diff_idx.end(), eddy_diff_idx_d.begin());
201 Gpu::copy(Gpu::hostToDevice, eddy_diff_idy.begin(), eddy_diff_idy.end(), eddy_diff_idy_d.begin());
202 Gpu::copy(Gpu::hostToDevice, eddy_diff_idz.begin(), eddy_diff_idz.end(), eddy_diff_idz_d.begin());
205 Real* d_alpha_eff = alpha_eff_d.data();
206 int* d_eddy_diff_idx = eddy_diff_idx_d.data();
207 int* d_eddy_diff_idy = eddy_diff_idy_d.data();
208 int* d_eddy_diff_idz = eddy_diff_idz_d.data();
211 if (l_consA && l_turb) {
212 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
214 const int qty_index = start_comp + n;
215 const int prim_index = qty_index - 1;
218 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i-1, j, k,
Rho_comp) );
219 Real rhoAlpha = rhoFace * d_alpha_eff[prim_scal_index];
220 rhoAlpha += 0.5 * ( mu_turb(i , j, k, d_eddy_diff_idx[prim_scal_index])
221 + mu_turb(i-1, j, k, d_eddy_diff_idx[prim_scal_index]) );
224 Real met_h_zeta = ax(i,j,k);
230 bool most_on_zlo = ( use_most && rot_most &&
233 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
234 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
235 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
238 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
239 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
240 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
242 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
245 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
247 const int qty_index = start_comp + n;
248 const int prim_index = qty_index - 1;
251 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j-1, k,
Rho_comp) );
252 Real rhoAlpha = rhoFace * d_alpha_eff[prim_scal_index];
253 rhoAlpha += 0.5 * ( mu_turb(i, j , k, d_eddy_diff_idy[prim_scal_index])
254 + mu_turb(i, j-1, k, d_eddy_diff_idy[prim_scal_index]) );
257 Real met_h_zeta = ay(i,j,k);
262 bool most_on_zlo = ( use_most && rot_most &&
265 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
266 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
267 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
270 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
271 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
272 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
274 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
277 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
279 const int qty_index = start_comp + n;
280 const int prim_index = qty_index - 1;
283 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j, k-1,
Rho_comp) );
284 Real rhoAlpha = rhoFace * d_alpha_eff[prim_scal_index];
285 rhoAlpha += 0.5 * ( mu_turb(i, j, k , d_eddy_diff_idz[prim_scal_index])
286 + mu_turb(i, j, k-1, d_eddy_diff_idz[prim_scal_index]) );
288 Real met_h_zeta = az(i,j,k);
300 bool most_on_zlo = ( use_most && exp_most &&
303 if (ext_dir_on_zlo) {
304 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
305 + 3. * cell_prim(i, j, k , prim_index)
306 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
307 }
else if (ext_dir_on_zhi) {
308 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
309 - 3. * cell_prim(i, j, k-1, prim_index)
310 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
312 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
317 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
318 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
319 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
321 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
326 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
330 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
333 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
338 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
340 const int qty_index = start_comp + n;
341 const int prim_index = qty_index - 1;
343 Real rhoAlpha = d_alpha_eff[prim_index];
344 rhoAlpha += 0.5 * ( mu_turb(i , j, k, d_eddy_diff_idx[prim_index])
345 + mu_turb(i-1, j, k, d_eddy_diff_idx[prim_index]) );
348 Real met_h_zeta = ax(i,j,k);
353 bool most_on_zlo = ( use_most && rot_most &&
356 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
357 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
358 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
361 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
362 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
363 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
365 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
368 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
370 const int qty_index = start_comp + n;
371 const int prim_index = qty_index - 1;
373 Real rhoAlpha = d_alpha_eff[prim_index];
374 rhoAlpha += 0.5 * ( mu_turb(i, j , k, d_eddy_diff_idy[prim_index])
375 + mu_turb(i, j-1, k, d_eddy_diff_idy[prim_index]) );
378 Real met_h_zeta = ay(i,j,k);
383 bool most_on_zlo = ( use_most && rot_most &&
386 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
387 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
388 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
391 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
392 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
393 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
395 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
398 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
400 const int qty_index = start_comp + n;
401 const int prim_index = qty_index - 1;
403 Real rhoAlpha = d_alpha_eff[prim_index];
405 rhoAlpha += 0.5 * ( mu_turb(i, j, k , d_eddy_diff_idz[prim_index])
406 + mu_turb(i, j, k-1, d_eddy_diff_idz[prim_index]) );
408 Real met_h_zeta = az(i,j,k);
420 bool most_on_zlo = ( use_most && exp_most &&
423 if (ext_dir_on_zlo) {
424 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
425 + 3. * cell_prim(i, j, k , prim_index)
426 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
427 }
else if (ext_dir_on_zhi) {
428 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
429 - 3. * cell_prim(i, j, k-1, prim_index)
430 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
432 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
437 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
438 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
439 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
441 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
446 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
450 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
453 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
458 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
460 const int qty_index = start_comp + n;
461 const int prim_index = qty_index - 1;
463 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i-1, j, k,
Rho_comp) );
464 Real rhoAlpha = rhoFace * d_alpha_eff[prim_index];
467 Real met_h_zeta = ax(i,j,k);
472 bool most_on_zlo = ( use_most && rot_most &&
475 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
476 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
477 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
480 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
481 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
482 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
484 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
487 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
489 const int qty_index = start_comp + n;
490 const int prim_index = qty_index - 1;
492 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j-1, k,
Rho_comp) );
493 Real rhoAlpha = rhoFace * d_alpha_eff[prim_index];
496 Real met_h_zeta = ay(i,j,k);
501 bool most_on_zlo = ( use_most && rot_most &&
504 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
505 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
506 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
509 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
510 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
511 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
513 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
516 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
518 const int qty_index = start_comp + n;
519 const int prim_index = qty_index - 1;
521 Real rhoFace = 0.5 * ( cell_data(i, j, k,
Rho_comp) + cell_data(i, j, k-1,
Rho_comp) );
522 Real rhoAlpha = rhoFace * d_alpha_eff[prim_index];
524 Real met_h_zeta = az(i,j,k);
536 bool most_on_zlo = ( use_most && exp_most &&
539 if (ext_dir_on_zlo) {
540 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
541 + 3. * cell_prim(i, j, k , prim_index)
542 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
543 }
else if (ext_dir_on_zhi) {
544 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
545 - 3. * cell_prim(i, j, k-1, prim_index)
546 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
548 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
553 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
554 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
555 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
557 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
562 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
566 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
569 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
574 ParallelFor(xbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
576 const int qty_index = start_comp + n;
577 const int prim_index = qty_index - 1;
579 Real rhoAlpha = d_alpha_eff[prim_index];
581 Real met_h_xi,met_h_zeta;
588 bool most_on_zlo = ( use_most && rot_most &&
591 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i-1, j, k+1, prim_index)
592 - cell_prim(i, j, k-1, prim_index) - cell_prim(i-1, j, k-1, prim_index) );
593 Real GradCx = dx_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i-1, j, k , prim_index) );
596 xflux(i,j,k,qty_index) = hfx_x(i,j,0);
597 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
598 xflux(i,j,k,qty_index) = qfx1_x(i,j,0);
600 xflux(i,j,k,qty_index) = -rhoAlpha * mf_u(i,j,0) * ( GradCx - (met_h_xi/met_h_zeta)*GradCz );
603 ParallelFor(ybx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
605 const int qty_index = start_comp + n;
606 const int prim_index = qty_index - 1;
608 Real rhoAlpha = d_alpha_eff[prim_index];
610 Real met_h_eta,met_h_zeta;
617 bool most_on_zlo = ( use_most && rot_most &&
620 Real GradCz = 0.25 * dz_inv * ( cell_prim(i, j, k+1, prim_index) + cell_prim(i, j-1, k+1, prim_index)
621 - cell_prim(i, j, k-1, prim_index) - cell_prim(i, j-1, k-1, prim_index) );
622 Real GradCy = dy_inv * ( cell_prim(i, j, k , prim_index) - cell_prim(i, j-1, k , prim_index) );
625 yflux(i,j,k,qty_index) = hfx_y(i,j,0);
626 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
627 yflux(i,j,k,qty_index) = qfx1_y(i,j,0);
629 yflux(i,j,k,qty_index) = -rhoAlpha * mf_v(i,j,0) * ( GradCy - (met_h_eta/met_h_zeta)*GradCz );
632 ParallelFor(zbx, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
634 const int qty_index = start_comp + n;
635 const int prim_index = qty_index - 1;
637 Real rhoAlpha = d_alpha_eff[prim_index];
652 bool most_on_zlo = ( use_most && exp_most &&
655 if (ext_dir_on_zlo) {
656 GradCz = dz_inv * ( -(8./3.) * cell_prim(i, j, k-1, prim_index)
657 + 3. * cell_prim(i, j, k , prim_index)
658 - (1./3.) * cell_prim(i, j, k+1, prim_index) );
659 }
else if (ext_dir_on_zhi) {
660 GradCz = dz_inv * ( (8./3.) * cell_prim(i, j, k , prim_index)
661 - 3. * cell_prim(i, j, k-1, prim_index)
662 + (1./3.) * cell_prim(i, j, k-2, prim_index) );
664 GradCz = dz_inv * ( cell_prim(i, j, k, prim_index) - cell_prim(i, j, k-1, prim_index) );
669 zflux(i,j,k,qty_index) = hfx_z(i,j,0);
670 }
else if (most_on_zlo && (qty_index ==
RhoQ1_comp)) {
671 zflux(i,j,k,qty_index) = qfx1_z(i,j,0);
673 zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
678 hfx_z(i,j,k) = zflux(i,j,k,qty_index);
682 qfx1_z(i,j,k) = zflux(i,j,k,qty_index);
685 qfx2_z(i,j,k) = zflux(i,j,k,qty_index);
694 Box planexy = zbx; planexy.setBig(2, planexy.smallEnd(2) );
695 int k_lo = zbx.smallEnd(2);
int k_hi = zbx.bigEnd(2);
696 zbx3.growLo(2,-1); zbx3.growHi(2,-1);
697 ParallelFor(planexy, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int ,
int n) noexcept
699 const int qty_index = start_comp + n;
700 Real met_h_xi,met_h_eta;
706 Real xfluxlo = 0.5 * ( xflux(i , j , k_lo , qty_index) + xflux(i+1, j , k_lo , qty_index) );
707 Real xfluxhi = 0.5 * ( xflux(i , j , k_lo+1, qty_index) + xflux(i+1, j , k_lo+1, qty_index) );
708 Real xfluxbar = 1.5*xfluxlo - 0.5*xfluxhi;
710 Real yfluxlo = 0.5 * ( yflux(i , j , k_lo , qty_index) + yflux(i , j+1, k_lo , qty_index) );
711 Real yfluxhi = 0.5 * ( yflux(i , j , k_lo+1, qty_index) + yflux(i , j+1, k_lo+1, qty_index) );
712 Real yfluxbar = 1.5*yfluxlo - 0.5*yfluxhi;
714 zflux(i,j,k_lo,qty_index) -= met_h_xi*xfluxbar + met_h_eta*yfluxbar;
721 Real xfluxlo = 0.5 * ( xflux(i , j , k_hi-2, qty_index) + xflux(i+1, j , k_hi-2, qty_index) );
722 Real xfluxhi = 0.5 * ( xflux(i , j , k_hi-1, qty_index) + xflux(i+1, j , k_hi-1, qty_index) );
723 Real xfluxbar = 1.5*xfluxhi - 0.5*xfluxlo;
725 Real yfluxlo = 0.5 * ( yflux(i , j , k_hi-2, qty_index) + yflux(i , j+1, k_hi-2, qty_index) );
726 Real yfluxhi = 0.5 * ( yflux(i , j , k_hi-1, qty_index) + yflux(i , j+1, k_hi-1, qty_index) );
727 Real yfluxbar = 1.5*yfluxhi - 0.5*yfluxlo;
729 zflux(i,j,k_hi,qty_index) -= met_h_xi*xfluxbar + met_h_eta*yfluxbar;
734 ParallelFor(zbx3, num_comp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
736 const int qty_index = start_comp + n;
738 Real met_h_xi,met_h_eta;
742 Real xfluxbar = 0.25 * ( xflux(i , j , k , qty_index) + xflux(i+1, j , k , qty_index)
743 + xflux(i , j , k-1, qty_index) + xflux(i+1, j , k-1, qty_index) );
744 Real yfluxbar = 0.25 * ( yflux(i , j , k , qty_index) + yflux(i , j+1, k , qty_index)
745 + yflux(i , j , k-1, qty_index) + yflux(i , j+1, k-1, qty_index) );
747 zflux(i,j,k,qty_index) -= met_h_xi*xfluxbar + met_h_eta*yfluxbar;
750 ParallelFor(xbx, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
752 const int qty_index = start_comp + n;
754 xflux(i,j,k,qty_index) *= met_h_zeta;
756 ParallelFor(ybx, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
758 const int qty_index = start_comp + n;
760 yflux(i,j,k,qty_index) *= met_h_zeta;
766 for (
int n(0); n < num_comp; ++n)
768 int qty_index = start_comp + n;
769 ParallelFor(bx,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
771 Real stateContrib = (xflux(i+1,j ,k ,qty_index) - xflux(i, j, k, qty_index)) * dx_inv * mf_m(i,j,0)
772 +(yflux(i ,j+1,k ,qty_index) - yflux(i, j, k, qty_index)) * dy_inv * mf_m(i,j,0)
773 +(zflux(i ,j ,k+1,qty_index) - zflux(i, j, k, qty_index)) * dz_inv;
775 stateContrib /= detJ(i,j,k);
777 cell_rhs(i,j,k,qty_index) -= stateContrib;
795 ParallelFor(bx,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
808 cell_rhs(i,j,k,qty_index) += l_abs_g * l_inv_theta0 * hfx_z(i,j,k);
814 cell_rhs(i,j,k,qty_index) += 2.0*mu_turb(i,j,k,
EddyDiff::Mom_v) * SmnSmn_a(i,j,k);
817 cell_rhs(i,j,k,qty_index) -= diss(i,j,k);
822 if (l_use_mynn && start_comp <= RhoKE_comp && end_comp >=
RhoKE_comp) {
826 const int rhoqv_comp = solverChoice.
RhoQv_comp;
827 const int rhoqc_comp = solverChoice.
RhoQc_comp;
828 const int rhoqr_comp = solverChoice.
RhoQr_comp;
830 ParallelFor(bx,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
840 cell_rhs(i, j, k, qty_index) +=
ComputeQKESourceTerms(i,j,k,u,v,cell_data,cell_prim,
841 mu_turb,cellSizeInv,domain,
842 pbl_mynn_B1_l,tm_arr(i,j,0),
843 rhoqv_comp, rhoqc_comp, rhoqr_comp,
844 c_ext_dir_on_zlo, c_ext_dir_on_zhi,
845 u_ext_dir_on_zlo, u_ext_dir_on_zhi,
846 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:687
DiffChoice diffChoice
Definition: ERF_DataStruct.H:579
int RhoQc_comp
Definition: ERF_DataStruct.H:681
int RhoQv_comp
Definition: ERF_DataStruct.H:680
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:581
Definition: ERF_TurbStruct.H:31
MYNNLevel25 pbl_mynn
Definition: ERF_TurbStruct.H:203
PBLType pbl_type
Definition: ERF_TurbStruct.H:201
LESType les_type
Definition: ERF_TurbStruct.H:175
amrex::Real theta_ref
Definition: ERF_TurbStruct.H:195