ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_DiffusionSrcForMom_EB.cpp File Reference
#include <AMReX.H>
#include <AMReX_EB_Slopes_K.H>
#include <ERF_EB.H>
#include <ERF_Diffusion.H>
#include <ERF_IndexDefines.H>
#include <ERF_EBSlopes.H>
#include <ERF_DiffStruct.H>
#include <ERF_EBStruct.H>
Include dependency graph for ERF_DiffusionSrcForMom_EB.cpp:

Functions

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void compute_tangent_vectors (Real nx, Real ny, Real nz, Real &tbx_x, Real &tbx_y, Real &tbx_z, Real &tby_x, Real &tby_y, Real &tby_z)
 
void DiffusionSrcForMom_EB (const MFIter &mfi, [[maybe_unused]] const Box &domain, const Box &bxx, const Box &bxy, const Box &bxz, const Array4< Real > &rho_u_rhs, const Array4< Real > &rho_v_rhs, const Array4< Real > &rho_w_rhs, const Array4< const Real > &u_arr, const Array4< const Real > &v_arr, const Array4< const Real > &w_arr, const Array4< const Real > &tau11, const Array4< const Real > &tau22, const Array4< const Real > &tau33, const Array4< const Real > &tau12, const Array4< const Real > &tau13, const Array4< const Real > &tau23, const Array4< const Real > &u_tau_eb13, const Array4< const Real > &u_tau_eb23, const Array4< const Real > &v_tau_eb13, const Array4< const Real > &v_tau_eb23, const Array4< const Real > &w_tau_eb13, const Array4< const Real > &w_tau_eb23, const Real *dx_arr, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const Array4< const Real > &mf_mx, const Array4< const Real > &mf_ux, const Array4< const Real > &mf_vx, const Array4< const Real > &mf_my, const Array4< const Real > &mf_uy, const Array4< const Real > &mf_vy, const SolverChoice &solverChoice, const eb_ &ebfact, [[maybe_unused]] const BCRec *d_bcrec_ptr)
 

Function Documentation

◆ compute_tangent_vectors()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void compute_tangent_vectors ( Real  nx,
Real  ny,
Real  nz,
Real &  tbx_x,
Real &  tbx_y,
Real &  tbx_z,
Real &  tby_x,
Real &  tby_y,
Real &  tby_z 
)

Compute the tangent directions at an EB boundary given the unit normal vector.

t_bx and t_by are the unit vectors along the projections of e_x and e_y onto the tangent plane. They are the directions in which the stored EB surface stresses tau_eb13 and tau_eb23 act, since those are built from the x- and y-components of the tangential velocity (see ERF_EBMOSTStress.H). For a horizontal surface they are exactly e_x and e_y. Note that they are individually unit but are not orthogonal to each other unless nx*ny is zero – t_bx . t_by = -nx*ny.

e_x has no projection onto the tangent plane when n is parallel to e_x, and likewise for e_y, so one of the two is undefined for an axis-aligned normal such as (1,0,0) (issue #3533). That limit is genuinely two-sided – approaching n = (1,0,0) from nz > 0 and from nz < 0 gives t_bx of -e_z and +e_z – so there is no continuous choice, and the degenerate vector is returned as zero. That keeps the momentum RHS finite, and it keeps the component that does have a limit continuous: the x-component of t_bx is sqrt(1-nx*nx), which tends to zero here as well. It also avoids driving w-momentum with tau_eb13, an x-associated stress, along an arbitrarily signed direction. Only nx and ny can be degenerate, and never both at once.

Parameters
[in]nxx-component of the normal vector
[in]nyy-component of the normal vector
[in]nzz-component of the normal vector
[out]tbx_xx-component of first tangent vector
[out]tbx_yy-component of first tangent vector
[out]tbx_zz-component of first tangent vector
[out]tby_xx-component of second tangent vector
[out]tby_yy-component of second tangent vector
[out]tby_zz-component of second tangent vector
46 {
47  // Below this the projection is all round-off and its direction is meaningless.
48  // The squared norms are formed as ny^2+nz^2 and nx^2+nz^2 rather than as the
49  // algebraically equal 1-nx^2 and 1-ny^2 to avoid cancellation for a near-axis normal
50  // The squared norm of a unit normal carries an absolute roundoff of order
51  // real_eps, so the floor is a (generous) multiple of it: 2.2e-12 in double,
52  // 1.2e-03 in single, i.e. a normal within ~2 degrees of the axis.
53  constexpr Real tol = Real(1.e4)*real_eps;
54 
55  // x-tangential vector: t_bx = (e_x - (e_x · n)n) / ||e_x - (e_x · n)n||
56  // e_x = (1,0,0), so e_x · n = nx
57  Real tbx_norm2 = ny*ny + nz*nz;
58  if (tbx_norm2 > tol) {
59  Real tbx_norm_inv = one / std::sqrt(tbx_norm2);
60  tbx_x = ( one - nx * nx) * tbx_norm_inv;
61  tbx_y = ( - nx * ny) * tbx_norm_inv;
62  tbx_z = ( - nx * nz) * tbx_norm_inv;
63  } else {
64  tbx_x = zero;
65  tbx_y = zero;
66  tbx_z = zero;
67  }
68 
69  // y-tangential vector: t_by = (e_y - (e_y · n)n) / ||e_y - (e_y · n)n||
70  // e_y = (0,1,0), so e_y · n = ny
71  Real tby_norm2 = nx*nx + nz*nz;
72  if (tby_norm2 > tol) {
73  Real tby_norm_inv = one / std::sqrt(tby_norm2);
74  tby_x = ( - ny * nx) * tby_norm_inv;
75  tby_y = ( one - ny * ny) * tby_norm_inv;
76  tby_z = ( - ny * nz) * tby_norm_inv;
77  } else {
78  tby_x = zero;
79  tby_y = zero;
80  tby_z = zero;
81  }
82 }
const int nx
Definition: ERF_InitCustomPertVels_CloudChamber.H:14
const int ny
Definition: ERF_InitCustomPertVels_CloudChamber.H:15
constexpr amrex::Real real_eps
Definition: ERF_NumericalConstants.H:34
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
amrex::Real Real
Definition: ERF_ShocInterface.H:19

◆ DiffusionSrcForMom_EB()

void DiffusionSrcForMom_EB ( const MFIter &  mfi,
[[maybe_unused] ] const Box &  domain,
const Box &  bxx,
const Box &  bxy,
const Box &  bxz,
const Array4< Real > &  rho_u_rhs,
const Array4< Real > &  rho_v_rhs,
const Array4< Real > &  rho_w_rhs,
const Array4< const Real > &  u_arr,
const Array4< const Real > &  v_arr,
const Array4< const Real > &  w_arr,
const Array4< const Real > &  tau11,
const Array4< const Real > &  tau22,
const Array4< const Real > &  tau33,
const Array4< const Real > &  tau12,
const Array4< const Real > &  tau13,
const Array4< const Real > &  tau23,
const Array4< const Real > &  u_tau_eb13,
const Array4< const Real > &  u_tau_eb23,
const Array4< const Real > &  v_tau_eb13,
const Array4< const Real > &  v_tau_eb23,
const Array4< const Real > &  w_tau_eb13,
const Array4< const Real > &  w_tau_eb23,
const Real *  dx_arr,
const GpuArray< Real, AMREX_SPACEDIM > &  dxInv,
const Array4< const Real > &  mf_mx,
const Array4< const Real > &  mf_ux,
const Array4< const Real > &  mf_vx,
const Array4< const Real > &  mf_my,
const Array4< const Real > &  mf_uy,
const Array4< const Real > &  mf_vy,
const SolverChoice &  solverChoice,
const eb_ &  ebfact,
[[maybe_unused] ] const BCRec *  d_bcrec_ptr 
)

Function for computing the momentum RHS for diffusion operator without terrain.

Parameters
[in]mfiMultiFab Iterator
[in]domaincomputational domain
[in]bxxnodal x box for x-mom
[in]bxynodal y box for y-mom
[in]bxznodal z box for z-mom
[out]rho_u_rhsRHS for x-mom
[out]rho_v_rhsRHS for y-mom
[out]rho_w_rhsRHS for z-mom
[in]u_arrx-direction velocity
[in]v_arry-direction velocity
[in]w_arrz-direction velocity
[in]tau1111 stress
[in]tau2222 stress
[in]tau3333 stress
[in]tau1212 stress
[in]tau1313 stress
[in]tau2323 stress
[in]u_tau_eb13EB tangential stress for x-momentum on z-faces
[in]u_tau_eb23EB tangential stress for x-momentum on y-faces
[in]v_tau_eb13EB tangential stress for y-momentum on z-faces
[in]v_tau_eb23EB tangential stress for y-momentum on x-faces
[in]w_tau_eb13EB tangential stress for z-momentum on y-faces
[in]w_tau_eb23EB tangential stress for z-momentum on x-faces
[in]dx_arrcell size array
[in]dxInvinverse cell size array
[in]mf_mxx map factor at cell centers
[in]mf_uxx map factor at x-faces
[in]mf_vxx map factor at y-faces
[in]mf_myy map factor at cell centers
[in]mf_uyy map factor at x-faces
[in]mf_vyy map factor at y-faces
[in]solverChoicecontainer with diffusion parameters
[in]ebfactEB factories for cell- and face-centered variables
[in]d_bcrec_ptrboundary condition records on device
404 {
405  BL_PROFILE_VAR("DiffusionSrcForMom_EB()",DiffusionSrcForMom_EB);
406 
407  DiffChoice dc = solverChoice.diffChoice;
408  const bool l_use_constAlpha = ( dc.molec_diff_type == MolecDiffType::ConstantAlpha );
409  Real mu_eff = (l_use_constAlpha) ? two * dc.dynamic_viscosity / dc.rho0_trans
410  : two * dc.dynamic_viscosity;
411 
412  auto dxinv = dxInv[0], dyinv = dxInv[1], dzinv = dxInv[2];
413  Real dx = dx_arr[0], dy = dx_arr[1], dz = dx_arr[2];
414  Real vol = dx * dy * dz;
415 
416  EBChoice ebChoice = solverChoice.ebChoice;
417  const bool l_no_slip = (ebChoice.eb_boundary_type == EBBoundaryType::NoSlipWall);
418  const bool l_surface_layer = (ebChoice.eb_boundary_type == EBBoundaryType::SurfaceLayer);
419  const bool l_constraint_x = solverChoice.diffChoice.eb_diff_constraint_x;
420  const bool l_constraint_y = solverChoice.diffChoice.eb_diff_constraint_y;
421  const bool l_constraint_z = solverChoice.diffChoice.eb_diff_constraint_z;
422 
423  const auto* u_factory = ebfact.get_u_const_factory();
424  const auto* v_factory = ebfact.get_v_const_factory();
425  const auto* w_factory = ebfact.get_w_const_factory();
426 
427  auto const& u_cut_cells = ebfact.get_u_cut_cells(mfi.index());
428  auto const& v_cut_cells = ebfact.get_v_cut_cells(mfi.index());
429  auto const& w_cut_cells = ebfact.get_w_cut_cells(mfi.index());
430 
431  const auto& u_flagfab = u_factory->getMultiEBCellFlagFab()[mfi];
432  const auto& v_flagfab = v_factory->getMultiEBCellFlagFab()[mfi];
433  const auto& w_flagfab = w_factory->getMultiEBCellFlagFab()[mfi];
434 
435  FabType u_type = u_flagfab.getType();
436  FabType v_type = v_flagfab.getType();
437  FabType w_type = w_flagfab.getType();
438 
439  const bool l_wall_model = l_no_slip || l_surface_layer;
440  const bool l_u_correction = l_wall_model && !l_constraint_x &&
441  u_type == FabType::singlevalued;
442  const bool l_v_correction = l_wall_model && !l_constraint_y &&
443  v_type == FabType::singlevalued;
444  const bool l_w_correction = l_wall_model && !l_constraint_z &&
445  w_type == FabType::singlevalued;
446  const bool l_any_correction = l_u_correction || l_v_correction || l_w_correction;
447 
448  Array4<const Real> u_volfrac = u_factory->getVolFrac().const_array(mfi);
449  Array4<const Real> v_volfrac = v_factory->getVolFrac().const_array(mfi);
450  Array4<const Real> w_volfrac = w_factory->getVolFrac().const_array(mfi);
451 
452  Array4<const EBCellFlag> u_cellflg = u_flagfab.const_array();
453  Array4<const EBCellFlag> v_cellflg = v_flagfab.const_array();
454  Array4<const EBCellFlag> w_cellflg = w_flagfab.const_array();
455  Array4<const Real> u_volcent{};
456  Array4<const Real> v_volcent{};
457  Array4<const Real> w_volcent{};
458 
459  if (l_any_correction) {
460  if (u_type == FabType::singlevalued) {
461  u_volcent = u_factory->getCentroid().const_array(mfi);
462  }
463  if (v_type == FabType::singlevalued) {
464  v_volcent = v_factory->getCentroid().const_array(mfi);
465  }
466  if (w_type == FabType::singlevalued) {
467  w_volcent = w_factory->getCentroid().const_array(mfi);
468  }
469  }
470 
471  Array4<const Real> u_afrac_x{};
472  Array4<const Real> u_afrac_y{};
473  Array4<const Real> u_afrac_z{};
474  Array4<const Real> v_afrac_x{};
475  Array4<const Real> v_afrac_y{};
476  Array4<const Real> v_afrac_z{};
477  Array4<const Real> w_afrac_x{};
478  Array4<const Real> w_afrac_y{};
479  Array4<const Real> w_afrac_z{};
480 
481  if (u_type == FabType::singlevalued) {
482  u_afrac_x = u_factory->getAreaFrac()[0]->const_array(mfi);
483  u_afrac_y = u_factory->getAreaFrac()[1]->const_array(mfi);
484  u_afrac_z = u_factory->getAreaFrac()[2]->const_array(mfi);
485  }
486  if (v_type == FabType::singlevalued) {
487  v_afrac_x = v_factory->getAreaFrac()[0]->const_array(mfi);
488  v_afrac_y = v_factory->getAreaFrac()[1]->const_array(mfi);
489  v_afrac_z = v_factory->getAreaFrac()[2]->const_array(mfi);
490  }
491  if (w_type == FabType::singlevalued) {
492  w_afrac_x = w_factory->getAreaFrac()[0]->const_array(mfi);
493  w_afrac_y = w_factory->getAreaFrac()[1]->const_array(mfi);
494  w_afrac_z = w_factory->getAreaFrac()[2]->const_array(mfi);
495  }
496 
497  Array4<const Real> u_bcent{};
498  Array4<const Real> u_bnorm{};
499  Array4<const Real> v_bcent{};
500  Array4<const Real> v_bnorm{};
501  Array4<const Real> w_bcent{};
502  Array4<const Real> w_bnorm{};
503 
504  if (l_u_correction) {
505  u_bcent = u_factory->getBndryCent().const_array(mfi);
506  u_bnorm = u_factory->getBndryNormal().const_array(mfi);
507  }
508  if (l_v_correction) {
509  v_bcent = v_factory->getBndryCent().const_array(mfi);
510  v_bnorm = v_factory->getBndryNormal().const_array(mfi);
511  }
512  if (l_w_correction) {
513  w_bcent = w_factory->getBndryCent().const_array(mfi);
514  w_bnorm = w_factory->getBndryNormal().const_array(mfi);
515  }
516 
517  const Array4<const Real> unused_real{};
518 
519  // x-momentum
520  if (u_type == FabType::regular) {
521 
522  ParallelFor(bxx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
523 
524  Real mfsq = mf_ux(i,j,0) * mf_uy(i,j,0);
525 
526  rho_u_rhs(i,j,k) -= ( (tau11(i , j , k ) - tau11(i-1, j , k ) ) * dxinv * mfsq
527  + (tau12(i , j+1, k ) - tau12(i , j , k ) ) * dyinv * mfsq
528  + (tau13(i , j , k+1) - tau13(i , j , k ) ) * dzinv );
529  });
530 
531  } else if (u_type == FabType::singlevalued) {
532 
533  ParallelFor(bxx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
534  EBCellFlag const cell_flag = u_cellflg(i,j,k);
535 
536  if (cell_flag.isRegular()) {
537  Real mfsq = mf_ux(i,j,0) * mf_uy(i,j,0);
538 
539  rho_u_rhs(i,j,k) -= ( (tau11(i , j , k ) - tau11(i-1, j , k ) ) * dxinv * mfsq
540  + (tau12(i , j+1, k ) - tau12(i , j , k ) ) * dyinv * mfsq
541  + (tau13(i , j , k+1) - tau13(i , j , k ) ) * dzinv );
542  } else if (cell_flag.isSingleValued()) {
543  Real vfrac = u_volfrac(i,j,k);
544  if (vfrac <= zero) { return; }
545 
546  // Inv Jacobian
547  Real mfsq = mf_ux(i,j,0) * mf_uy(i,j,0);
548 
549  Real diffContrib = ( (tau11(i , j , k ) * u_afrac_x(i+1,j ,k )
550  - tau11(i-1, j , k ) * u_afrac_x(i ,j ,k ) ) * dxinv * mfsq
551  + (tau12(i , j+1, k ) * u_afrac_y(i ,j+1,k )
552  - tau12(i , j , k ) * u_afrac_y(i ,j ,k ) ) * dyinv * mfsq
553  + (tau13(i , j , k+1) * u_afrac_z(i ,j ,k+1)
554  - tau13(i , j , k ) * u_afrac_z(i ,j ,k )) * dzinv );
555  diffContrib /= vfrac;
556 
557  rho_u_rhs(i,j,k) -= diffContrib;
558  }
559  });
560  } // u_type
561 
562  if (l_u_correction) {
563  if (l_no_slip) {
564  launch_eb_wall_correction<0,EBBoundaryType::NoSlipWall>(
565  bxx, u_cut_cells, rho_u_rhs, u_arr, v_arr, w_arr,
566  u_cellflg, v_cellflg, w_cellflg, u_volcent, v_volcent, w_volcent,
567  unused_real, unused_real, unused_real, u_volfrac,
568  u_afrac_x, u_afrac_y, u_afrac_z, u_bcent, u_bnorm,
569  unused_real, unused_real, dx, dy, dz, vol, mu_eff);
570  } else {
571  launch_eb_wall_correction<0,EBBoundaryType::SurfaceLayer>(
572  bxx, u_cut_cells, rho_u_rhs, u_arr, v_arr, w_arr,
573  u_cellflg, v_cellflg, w_cellflg, u_volcent, v_volcent, w_volcent,
574  u_volfrac, v_volfrac, w_volfrac, u_volfrac,
575  u_afrac_x, u_afrac_y, u_afrac_z, u_bcent, u_bnorm,
576  u_tau_eb13, u_tau_eb23, dx, dy, dz, vol, mu_eff);
577  }
578  }
579 
580  // y-momentum
581  if (v_type == FabType::regular) {
582 
583  ParallelFor(bxy, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
584 
585  Real mfsq = mf_vx(i,j,0) * mf_vy(i,j,0);
586 
587  rho_v_rhs(i,j,k) -= ( (tau12(i+1, j , k ) - tau12(i , j , k ) ) * dxinv * mfsq
588  + (tau22(i , j , k ) - tau22(i , j-1, k ) ) * dyinv * mfsq
589  + (tau23(i , j , k+1) - tau23(i , j , k ) ) * dzinv );
590  });
591  } else if (v_type == FabType::singlevalued) {
592 
593  ParallelFor(bxy, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
594  EBCellFlag const cell_flag = v_cellflg(i,j,k);
595 
596  if (cell_flag.isRegular()) {
597  Real mfsq = mf_vx(i,j,0) * mf_vy(i,j,0);
598 
599  rho_v_rhs(i,j,k) -= ( (tau12(i+1, j , k ) - tau12(i , j , k ) ) * dxinv * mfsq
600  + (tau22(i , j , k ) - tau22(i , j-1, k ) ) * dyinv * mfsq
601  + (tau23(i , j , k+1) - tau23(i , j , k ) ) * dzinv );
602  } else if (cell_flag.isSingleValued()) {
603  Real vfrac = v_volfrac(i,j,k);
604  if (vfrac <= zero) { return; }
605 
606  // Inv Jacobian
607  Real mfsq = mf_vx(i,j,0) * mf_vy(i,j,0);
608 
609  Real diffContrib = ( (tau12(i+1, j , k ) * v_afrac_x(i+1,j ,k )
610  - tau12(i , j , k ) * v_afrac_x(i ,j ,k ) ) * dxinv * mfsq
611  + (tau22(i , j , k ) * v_afrac_y(i ,j+1,k )
612  - tau22(i , j-1, k ) * v_afrac_y(i ,j ,k ) ) * dyinv * mfsq
613  + (tau23(i , j , k+1) * v_afrac_z(i ,j ,k+1)
614  - tau23(i , j , k ) * v_afrac_z(i ,j ,k ) ) * dzinv );
615  diffContrib /= vfrac;
616 
617  rho_v_rhs(i,j,k) -= diffContrib;
618  }
619  });
620  } // v_type
621 
622  if (l_v_correction) {
623  if (l_no_slip) {
624  launch_eb_wall_correction<1,EBBoundaryType::NoSlipWall>(
625  bxy, v_cut_cells, rho_v_rhs, u_arr, v_arr, w_arr,
626  u_cellflg, v_cellflg, w_cellflg, u_volcent, v_volcent, w_volcent,
627  unused_real, unused_real, unused_real, v_volfrac,
628  v_afrac_x, v_afrac_y, v_afrac_z, v_bcent, v_bnorm,
629  unused_real, unused_real, dx, dy, dz, vol, mu_eff);
630  } else {
631  launch_eb_wall_correction<1,EBBoundaryType::SurfaceLayer>(
632  bxy, v_cut_cells, rho_v_rhs, u_arr, v_arr, w_arr,
633  u_cellflg, v_cellflg, w_cellflg, u_volcent, v_volcent, w_volcent,
634  u_volfrac, v_volfrac, w_volfrac, v_volfrac,
635  v_afrac_x, v_afrac_y, v_afrac_z, v_bcent, v_bnorm,
636  v_tau_eb13, v_tau_eb23, dx, dy, dz, vol, mu_eff);
637  }
638  }
639 
640  // z-momentum
641  if (w_type == FabType::regular) {
642 
643  ParallelFor(bxz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
644 
645  Real mfsq = mf_mx(i,j,0) * mf_my(i,j,0);
646 
647  rho_w_rhs(i,j,k) -= ( (tau13(i+1, j , k ) - tau13(i , j , k ) ) * dxinv * mfsq
648  + (tau23(i , j+1, k ) - tau23(i , j , k ) ) * dyinv * mfsq
649  + (tau33(i , j , k ) - tau33(i , j , k-1) ) * dzinv );
650  });
651 
652  } else if (w_type == FabType::singlevalued) {
653 
654  ParallelFor(bxz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
655  EBCellFlag const cell_flag = w_cellflg(i,j,k);
656 
657  if (cell_flag.isRegular()) {
658  Real mfsq = mf_mx(i,j,0) * mf_my(i,j,0);
659 
660  rho_w_rhs(i,j,k) -= ( (tau13(i+1, j , k ) - tau13(i , j , k ) ) * dxinv * mfsq
661  + (tau23(i , j+1, k ) - tau23(i , j , k ) ) * dyinv * mfsq
662  + (tau33(i , j , k ) - tau33(i , j , k-1) ) * dzinv );
663  } else if (cell_flag.isSingleValued()) {
664  Real vfrac = w_volfrac(i,j,k);
665  if (vfrac <= zero) { return; }
666 
667  // Inv Jacobian
668  Real mfsq = mf_mx(i,j,0) * mf_my(i,j,0);
669 
670  Real diffContrib = ( (tau13(i+1, j , k ) * w_afrac_x(i+1,j ,k )
671  - tau13(i , j , k ) * w_afrac_x(i ,j ,k ) ) * dxinv * mfsq
672  + (tau23(i , j+1, k ) * w_afrac_y(i ,j+1,k )
673  - tau23(i , j , k ) * w_afrac_y(i ,j ,k ) ) * dyinv * mfsq
674  + (tau33(i , j , k ) * w_afrac_z(i ,j ,k+1)
675  - tau33(i , j , k-1) * w_afrac_z(i ,j ,k ) ) * dzinv );
676  diffContrib /= vfrac;
677 
678  rho_w_rhs(i,j,k) -= diffContrib;
679  }
680  });
681  } // w_type
682 
683  if (l_w_correction) {
684  if (l_no_slip) {
685  launch_eb_wall_correction<2,EBBoundaryType::NoSlipWall>(
686  bxz, w_cut_cells, rho_w_rhs, u_arr, v_arr, w_arr,
687  u_cellflg, v_cellflg, w_cellflg, u_volcent, v_volcent, w_volcent,
688  unused_real, unused_real, unused_real, w_volfrac,
689  w_afrac_x, w_afrac_y, w_afrac_z, w_bcent, w_bnorm,
690  unused_real, unused_real, dx, dy, dz, vol, mu_eff);
691  } else {
692  launch_eb_wall_correction<2,EBBoundaryType::SurfaceLayer>(
693  bxz, w_cut_cells, rho_w_rhs, u_arr, v_arr, w_arr,
694  u_cellflg, v_cellflg, w_cellflg, u_volcent, v_volcent, w_volcent,
695  u_volfrac, v_volfrac, w_volfrac, w_volfrac,
696  w_afrac_x, w_afrac_y, w_afrac_z, w_bcent, w_bnorm,
697  w_tau_eb13, w_tau_eb23, dx, dy, dz, vol, mu_eff);
698  }
699  }
700 }
@ tau12
Definition: ERF_DataStruct.H:49
@ tau23
Definition: ERF_DataStruct.H:49
@ tau33
Definition: ERF_DataStruct.H:49
@ tau22
Definition: ERF_DataStruct.H:49
@ tau11
Definition: ERF_DataStruct.H:49
@ tau13
Definition: ERF_DataStruct.H:49
void DiffusionSrcForMom_EB(const MFIter &mfi, [[maybe_unused]] const Box &domain, const Box &bxx, const Box &bxy, const Box &bxz, const Array4< Real > &rho_u_rhs, const Array4< Real > &rho_v_rhs, const Array4< Real > &rho_w_rhs, const Array4< const Real > &u_arr, const Array4< const Real > &v_arr, const Array4< const Real > &w_arr, const Array4< const Real > &tau11, const Array4< const Real > &tau22, const Array4< const Real > &tau33, const Array4< const Real > &tau12, const Array4< const Real > &tau13, const Array4< const Real > &tau23, const Array4< const Real > &u_tau_eb13, const Array4< const Real > &u_tau_eb23, const Array4< const Real > &v_tau_eb13, const Array4< const Real > &v_tau_eb23, const Array4< const Real > &w_tau_eb13, const Array4< const Real > &w_tau_eb23, const Real *dx_arr, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const Array4< const Real > &mf_mx, const Array4< const Real > &mf_ux, const Array4< const Real > &mf_vx, const Array4< const Real > &mf_my, const Array4< const Real > &mf_uy, const Array4< const Real > &mf_vy, const SolverChoice &solverChoice, const eb_ &ebfact, [[maybe_unused]] const BCRec *d_bcrec_ptr)
Definition: ERF_DiffusionSrcForMom_EB.cpp:372
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:17
const Real dy
Definition: ERF_InitCustomPert_ABL.H:45
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
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);})
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
CutCellList const & get_u_cut_cells(int grid_index) const noexcept
Return cut x-faces owned by a grid, cached when the EB factories are built.
Definition: ERF_EB.H:106
CutCellList const & get_v_cut_cells(int grid_index) const noexcept
Return cut y-faces owned by a grid, cached when the EB factories are built.
Definition: ERF_EB.H:112
CutCellList const & get_w_cut_cells(int grid_index) const noexcept
Return cut z-faces owned by a grid, cached when the EB factories are built.
Definition: ERF_EB.H:118
amrex::EBFArrayBoxFactory const * get_w_const_factory() const noexcept
Return the native AMReX z-face EB factory.
Definition: ERF_EB.H:148
amrex::EBFArrayBoxFactory const * get_u_const_factory() const noexcept
Return the native AMReX x-face EB factory.
Definition: ERF_EB.H:144
amrex::EBFArrayBoxFactory const * get_v_const_factory() const noexcept
Return the native AMReX y-face EB factory.
Definition: ERF_EB.H:146
@ dz
Definition: ERF_AdvanceWDM6.cpp:273
Definition: ERF_DiffStruct.H:24
bool eb_diff_constraint_z
Whether to constrain EB diffusion in the z direction.
Definition: ERF_DiffStruct.H:111
MolecDiffType molec_diff_type
Selected molecular transport model.
Definition: ERF_DiffStruct.H:96
bool eb_diff_constraint_y
Whether to constrain EB diffusion in the y direction.
Definition: ERF_DiffStruct.H:110
bool eb_diff_constraint_x
Whether to constrain EB diffusion in the x direction.
Definition: ERF_DiffStruct.H:109
amrex::Real dynamic_viscosity
Dynamic viscosity for momentum diffusion [kg/(m-s)].
Definition: ERF_DiffStruct.H:108
amrex::Real rho0_trans
Reference density used to compute dynamic diffusion coefficients [kg/m3].
Definition: ERF_DiffStruct.H:103
Definition: ERF_EBStruct.H:36
EBChoice ebChoice
Embedded-boundary options.
Definition: ERF_DataStruct.H:2621
DiffChoice diffChoice
Diffusion-related options.
Definition: ERF_DataStruct.H:2617
Here is the call graph for this function: