ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_AdvectionSrcForOpenBC.cpp File Reference
#include <ERF_Advection.H>
Include dependency graph for ERF_AdvectionSrcForOpenBC.cpp:

Functions

void AdvectionSrcForOpenBC_Normal (const Box &bx, const int &dir, const Array4< Real > &rhs_arr, const Array4< const Real > &vel_norm_arr, const Array4< const Real > &cell_data_arr, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const bool do_lo)
 
void AdvectionSrcForOpenBC_Tangent_Xmom (const Box &bxx, const int &dir, const Array4< Real > &rho_u_rhs, const Array4< const Real > &u, const Array4< const Real > &rho_u, const Array4< const Real > &rho_v, const Array4< const Real > &Omega, const Array4< const Real > &ax, const Array4< const Real > &az, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const bool do_lo)
 
void AdvectionSrcForOpenBC_Tangent_Ymom (const Box &bxy, const int &dir, const Array4< Real > &rho_v_rhs, const Array4< const Real > &v, const Array4< const Real > &rho_u, const Array4< const Real > &rho_v, const Array4< const Real > &Omega, const Array4< const Real > &ay, const Array4< const Real > &az, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const bool do_lo)
 
void AdvectionSrcForOpenBC_Tangent_Zmom (const Box &bxz, const OpenSide x_side, const OpenSide y_side, const Array4< Real > &rho_w_rhs, const Array4< const Real > &w, const Array4< const Real > &rho_u, const Array4< const Real > &rho_v, const Array4< const Real > &Omega, 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 int domhi_z)
 
void AdvectionSrcForOpenBC_Tangent_Scalars (const Box &bx, const OpenSide x_side, const OpenSide y_side, const int scalar_icomp, const int rhs_icomp, const int ncomp, const Array4< Real > &cell_rhs, const Array4< const Real > &cell_prim, const Array4< const Real > &avg_xmom, const Array4< const Real > &avg_ymom, const Array4< const Real > &avg_zmom, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv)
 
void AdvectionSrcForOpenBC_Tangent_Cons (const Box &bx, const OpenSide x_side, const OpenSide y_side, const int &icomp, const int &ncomp, const Array4< Real > &cell_rhs, const Array4< const Real > &cell_prim, const Array4< const Real > &avg_xmom, const Array4< const Real > &avg_ymom, const Array4< const Real > &avg_zmom, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv)
 
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real AdvectionSrcForOpenBC_Tangent (const int &i, const int &j, const int &k, const int &nprim, const int &dir, const Array4< const Real > &prim_tang_arr, const Array4< const Real > &mom_norm_arr, const Real &dxInv, const bool do_lo)
 

Function Documentation

◆ AdvectionSrcForOpenBC_Normal()

void AdvectionSrcForOpenBC_Normal ( const Box &  bx,
const int &  dir,
const Array4< Real > &  rhs_arr,
const Array4< const Real > &  vel_norm_arr,
const Array4< const Real > &  cell_data_arr,
const GpuArray< Real, AMREX_SPACEDIM > &  dxInv,
const bool  do_lo 
)

Compute advection tendencies for momentum normal to an open boundary.

Parameters
[in]bxbox over which the boundary-normal momentum is updated
[in]dircoordinate direction normal to the open boundary
[out]rhs_arrtendency for the boundary-normal momentum equation
[in]vel_norm_arrvelocity component normal to the open boundary
[in]cell_data_arrcell-centered conservative state
[in]dxInvinverse grid spacing
[in]do_loflag for a low-side open boundary
24 {
25  // NOTE: Klemp, J. B., and R. Wilhelmson, 1978: The simulation of three-dimensional
26  // convective storm dynamics, J. Atmos. Sci., 35, 1070-Real(1096.)
27  // NOTE: Implementation is for the high bndry side. The low bndry side is obtained
28  // by flipping sgn = -one
29  // NOTE: Indices (i,j,k) correspond to data that is ON the open bdy.
30  int sgn = 1; if (do_lo) sgn = -1;
31  Real c_o_star = Real(sgn)*Real(30.0);
32  ParallelFor(bx, [=,zero_d=zero] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
33  {
34  IntVect ivu1(i,j,k); if ( do_lo) ivu1[dir] -= sgn; // Vel indexed into domain for do_lo
35  IntVect ivu2(i,j,k); if (!do_lo) ivu2[dir] -= sgn; // Vel indexed into domain for do_hi
36 
37  IntVect ivr1(i,j,k); if (!do_lo) ivr1[dir] -= sgn; // Rho indexed into domain for do_hi
38  IntVect ivr2(i,j,k); if ( do_lo) ivr2[dir] += sgn; // Rho indexed out domain for do_lo
39 
40  Real rho_face = myhalf * ( cell_data_arr(ivr1,Rho_comp) + cell_data_arr(ivr2,Rho_comp) );
41  Real mom_star = rho_face * Real(sgn) * max( Real(sgn)*(vel_norm_arr(ivu1) + c_o_star), zero_d );
42  Real vel_grad = ( vel_norm_arr(ivu1) - vel_norm_arr(ivu2) ) * dxInv[dir];
43  Real flux = -( mom_star * vel_grad );
44  rhs_arr(i,j,k) = flux;
45  });
46 }
#define Rho_comp
Definition: ERF_IndexDefines.H:39
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:17
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 zero
Definition: ERF_NumericalConstants.H:29
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:34
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Here is the call graph for this function:

◆ AdvectionSrcForOpenBC_Tangent()

AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real AdvectionSrcForOpenBC_Tangent ( const int &  i,
const int &  j,
const int &  k,
const int &  nprim,
const int &  dir,
const Array4< const Real > &  prim_tang_arr,
const Array4< const Real > &  mom_norm_arr,
const Real dxInv,
const bool  do_lo 
)

Compute the open-boundary normal-direction source for a tangential primitive variable.

Parameters
[in]ii-index of the target cell
[in]jj-index of the target cell
[in]kk-index of the target cell
[in]nprimprimitive component to update
[in]dircoordinate direction normal to the open boundary
[in]prim_tang_arrprimitive variable tangent to the open boundary
[in]mom_norm_arrmomentum component normal to the open boundary
[in]dxInvinverse grid spacing in the open-boundary normal direction
[in]do_loflag for a low-side open boundary
Returns
source contribution before the wrapper applies its sign convention
367 {
368  // NOTE: Klemp, J. B., and R. Wilhelmson, 1978: The simulation of three-dimensional
369  // convective storm dynamics, J. Atmos. Sci., 35, 1070-Real(1096.)
370  // NOTE: Implementation is for the high bndry side. The low bndry side is obtained
371  // by flipping sgn = -one
372 
373  int sgn = 1; if (do_lo) { sgn = -1; }
374 
375  // NOTE: The indices (i,j,k) passed to this routine correspond to data that resides
376  // 1/2 dx away from the open boundary and into the domain. The momentum is
377  // face centered in dir, so it has one more cell than the scalar and cell
378  // (i,j,k) is bounded by the faces (i,j,k) and (i,j,k)+e_dir. One of those two
379  // faces resides on the physical boundary: the high face at a high open bndry,
380  // the low face at a low open bndry. Averaging and differencing that same pair
381  // of faces therefore yields the cell centered momentum and its exact cell
382  // centered gradient on both sides, so no sgn dependence is needed here.
383  IntVect ivm1(i,j,k); ivm1[dir] += 1; // Mom on the high face of cell (i,j,k)
384  IntVect ivm2(i,j,k); // Mom on the low face of cell (i,j,k)
385 
386  IntVect ivs1(i,j,k); if ( do_lo) { ivs1[dir] -= sgn; } // Scalar indexed into domain for do_lo
387  IntVect ivs2(i,j,k); if (!do_lo) { ivs2[dir] -= sgn; } // Scalar indexed into domain for do_hi
388 
389  Real mom_at_cc = myhalf * (mom_norm_arr(ivm1) + mom_norm_arr(ivm2));
390  Real mom_star = Real(sgn) * max( Real(sgn)*mom_at_cc, zero );
391  Real mom_grad = ( mom_norm_arr(ivm1) - mom_norm_arr(ivm2) ) * dxInv;
392  Real prim_grad = ( prim_tang_arr(ivs1,nprim) - prim_tang_arr(ivs2,nprim) ) * dxInv;
393 
394  // NOTE: Negative sign taken care of by wrapper function
395  Real src = ( mom_star*prim_grad + prim_tang_arr(i,j,k,nprim)*mom_grad );
396  return src;
397 }

Referenced by AdvectionSrcForOpenBC_Tangent_Scalars(), AdvectionSrcForOpenBC_Tangent_Xmom(), AdvectionSrcForOpenBC_Tangent_Ymom(), and AdvectionSrcForOpenBC_Tangent_Zmom().

Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Cons()

void AdvectionSrcForOpenBC_Tangent_Cons ( const Box &  bx,
const OpenSide  x_side,
const OpenSide  y_side,
const int &  icomp,
const int &  ncomp,
const Array4< Real > &  cell_rhs,
const Array4< const Real > &  cell_prim,
const Array4< const Real > &  avg_xmom,
const Array4< const Real > &  avg_ymom,
const Array4< const Real > &  avg_zmom,
const Array4< const Real > &  detJ,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv 
)

Adapt the native conserved-state layout to the component-explicit scalar open-BC operation.

331 {
332  AMREX_ALWAYS_ASSERT(icomp > 0);
333  AdvectionSrcForOpenBC_Tangent_Scalars(bx, x_side, y_side,
334  icomp - 1, icomp, ncomp,
335  cell_rhs, cell_prim,
336  avg_xmom, avg_ymom, avg_zmom,
337  detJ, cellSizeInv);
338 }
void AdvectionSrcForOpenBC_Tangent_Scalars(const Box &bx, const OpenSide x_side, const OpenSide y_side, const int scalar_icomp, const int rhs_icomp, const int ncomp, const Array4< Real > &cell_rhs, const Array4< const Real > &cell_prim, const Array4< const Real > &avg_xmom, const Array4< const Real > &avg_ymom, const Array4< const Real > &avg_zmom, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv)
Definition: ERF_AdvectionSrcForOpenBC.cpp:256
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
Here is the call graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Scalars()

void AdvectionSrcForOpenBC_Tangent_Scalars ( const Box &  bx,
const OpenSide  x_side,
const OpenSide  y_side,
const int  scalar_icomp,
const int  rhs_icomp,
const int  ncomp,
const Array4< Real > &  cell_rhs,
const Array4< const Real > &  cell_prim,
const Array4< const Real > &  avg_xmom,
const Array4< const Real > &  avg_ymom,
const Array4< const Real > &  avg_zmom,
const Array4< const Real > &  detJ,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv 
)

Compute second-order advection tendencies for scalar fields tangent to an open boundary.

Parameters
[in]bxbox over which the scalar tendencies are updated
[in]x_sidewhich x boundary the cells lie on, if any
[in]y_sidewhich y boundary the cells lie on, if any
[in]scalar_icompfirst component of the supplied scalar view to read
[in]rhs_icompfirst component of the supplied tendency view to write
[in]ncompnumber of components to update
[out]cell_rhstendency view
[in]cell_primsupplied scalar view
[in]avg_xmomx-component of time-averaged mass flux
[in]avg_ymomy-component of time-averaged mass flux
[in]avg_zmomz-component of time-averaged mass flux
[in]detJJacobian of the metric transformation
[in]cellSizeInvinverse grid spacing
269 {
270  // At a corner both sides are set, and neither x nor y may be differenced across
271  const bool xopen = (x_side != OpenSide::none);
272  const bool yopen = (y_side != OpenSide::none);
273  const bool x_do_lo = (x_side == OpenSide::lo);
274  const bool y_do_lo = (y_side == OpenSide::lo);
275 
276  AMREX_ALWAYS_ASSERT(xopen || yopen);
277 
278  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
279 
280  ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
281  {
282  if (detJ(i,j,k) > zero) {
283  const int scalar_comp = scalar_icomp + n;
284  const int rhs_comp = rhs_icomp + n;
285  Real prim_xlo = myhalf * (cell_prim(i,j,k,scalar_comp) + cell_prim(i-1,j,k,scalar_comp));
286  Real prim_xhi = myhalf * (cell_prim(i,j,k,scalar_comp) + cell_prim(i+1,j,k,scalar_comp));
287  Real xflux_lo = avg_xmom(i ,j,k) * prim_xlo;
288  Real xflux_hi = avg_xmom(i+1,j,k) * prim_xhi;
289 
290  Real prim_ylo = myhalf * (cell_prim(i,j,k,scalar_comp) + cell_prim(i,j-1,k,scalar_comp));
291  Real prim_yhi = myhalf * (cell_prim(i,j,k,scalar_comp) + cell_prim(i,j+1,k,scalar_comp));
292  Real yflux_lo = avg_ymom(i,j ,k) * prim_ylo;
293  Real yflux_hi = avg_ymom(i,j+1,k) * prim_yhi;
294 
295  Real prim_zlo = myhalf * (cell_prim(i,j,k,scalar_comp) + cell_prim(i,j,k-1,scalar_comp));
296  Real prim_zhi = myhalf * (cell_prim(i,j,k,scalar_comp) + cell_prim(i,j,k+1,scalar_comp));
297  Real zflux_lo = avg_zmom(i,j,k ) * prim_zlo;
298  Real zflux_hi = avg_zmom(i,j,k+1) * prim_zhi;
299 
300  Real x_src = (xopen) ? AdvectionSrcForOpenBC_Tangent(i, j, k,
301  scalar_comp, 0, cell_prim,
302  avg_xmom, dxInv, x_do_lo) :
303  (xflux_hi - xflux_lo) * dxInv;
304  Real y_src = (yopen) ? AdvectionSrcForOpenBC_Tangent(i, j, k,
305  scalar_comp, 1, cell_prim,
306  avg_ymom, dyInv, y_do_lo) :
307  (yflux_hi - yflux_lo) * dyInv;
308  Real z_src = (zflux_hi - zflux_lo) * dzInv;
309  Real advectionSrc = x_src + y_src + z_src;
310  cell_rhs(i,j,k,rhs_comp) = -advectionSrc / detJ(i,j,k);
311  }
312  });
313 }
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real AdvectionSrcForOpenBC_Tangent(const int &i, const int &j, const int &k, const int &nprim, const int &dir, const Array4< const Real > &prim_tang_arr, const Array4< const Real > &mom_norm_arr, const Real &dxInv, const bool do_lo)
Definition: ERF_AdvectionSrcForOpenBC.cpp:358

Referenced by AdvectionSrcForOpenBC_Tangent_Cons().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Xmom()

void AdvectionSrcForOpenBC_Tangent_Xmom ( const Box &  bxx,
const int &  dir,
const Array4< Real > &  rho_u_rhs,
const Array4< const Real > &  u,
const Array4< const Real > &  rho_u,
const Array4< const Real > &  rho_v,
const Array4< const Real > &  Omega,
const Array4< const Real > &  ax,
const Array4< const Real > &  az,
const Array4< const Real > &  detJ,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv,
const bool  do_lo 
)

Compute second-order advection tendencies for x-momentum tangent to an open boundary.

Parameters
[in]bxxbox over which x-momentum is updated
[in]dircoordinate direction normal to the open boundary
[out]rho_u_rhstendency for the x-momentum equation
[in]ux-component of velocity
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]Omegacomponent of momentum normal to the z-coordinate surface
[in]axarea fraction of x-faces
[in]azarea fraction of z-faces
[in]detJJacobian of the metric transformation
[in]cellSizeInvinverse grid spacing
[in]do_loflag for a low-side open boundary
77 {
78  AMREX_ALWAYS_ASSERT(dir==1);
79 
80  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
81 
82  ParallelFor(bxx,[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
83  {
84  if (ax(i,j,k) > zero) {
85  Real xflux_hi = fourth * (rho_u(i, j , k) + rho_u(i+1, j , k)) * (u(i+1,j,k) + u(i,j,k)) * myhalf * (ax(i,j,k) + ax(i+1,j,k));
86  Real xflux_lo = fourth * (rho_u(i, j , k) + rho_u(i-1, j , k)) * (u(i-1,j,k) + u(i,j,k)) * myhalf * (ax(i,j,k) + ax(i-1,j,k));
87 
88  Real zflux_hi = fourth * (Omega(i, j, k+1) + Omega(i-1, j, k+1)) * (u(i,j,k+1) + u(i,j,k)) * az(i,j,k+1);
89  Real zflux_lo = fourth * (Omega(i, j, k ) + Omega(i-1, j, k )) * (u(i,j,k-1) + u(i,j,k)) * az(i,j,k );
90 
91  Real x_src = (xflux_hi - xflux_lo) * dxInv;
92  Real y_src = AdvectionSrcForOpenBC_Tangent(i, j, k, 0, dir, u, rho_v, dyInv, do_lo);
93  Real z_src = (zflux_hi - zflux_lo) * dzInv;
94  Real advectionSrc = x_src + y_src + z_src;
95 
96  rho_u_rhs(i, j, k) = -advectionSrc / (myhalf * (detJ(i,j,k) + detJ(i-1,j,k)));
97  } else {
98  rho_u_rhs(i, j, k) = zero;
99  }
100  });
101 }
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:35
Here is the call graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Ymom()

void AdvectionSrcForOpenBC_Tangent_Ymom ( const Box &  bxy,
const int &  dir,
const Array4< Real > &  rho_v_rhs,
const Array4< const Real > &  v,
const Array4< const Real > &  rho_u,
const Array4< const Real > &  rho_v,
const Array4< const Real > &  Omega,
const Array4< const Real > &  ay,
const Array4< const Real > &  az,
const Array4< const Real > &  detJ,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv,
const bool  do_lo 
)

Compute second-order advection tendencies for y-momentum tangent to an open boundary.

Parameters
[in]bxybox over which y-momentum is updated
[in]dircoordinate direction normal to the open boundary
[out]rho_v_rhstendency for the y-momentum equation
[in]vy-component of velocity
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]Omegacomponent of momentum normal to the z-coordinate surface
[in]ayarea fraction of y-faces
[in]azarea fraction of z-faces
[in]detJJacobian of the metric transformation
[in]cellSizeInvinverse grid spacing
[in]do_loflag for a low-side open boundary
132 {
133  AMREX_ALWAYS_ASSERT(dir==0);
134 
135  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
136 
137  ParallelFor(bxy,[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
138  {
139  if (ay(i,j,k) > zero) {
140  Real yflux_hi = fourth * (rho_v(i ,j+1,k) + rho_v(i ,j ,k)) * (v(i,j+1,k) + v(i,j,k)) * myhalf * (ay(i,j,k) + ay(i,j+1,k));
141  Real yflux_lo = fourth * (rho_v(i ,j ,k) + rho_v(i ,j-1,k)) * (v(i,j-1,k) + v(i,j,k)) * myhalf * (ay(i,j,k) + ay(i,j-1,k));
142 
143  Real zflux_hi = fourth * (Omega(i, j, k+1) + Omega(i, j-1, k+1)) * (v(i,j,k+1) + v(i,j,k)) * az(i,j,k+1);
144  Real zflux_lo = fourth * (Omega(i, j, k ) + Omega(i, j-1, k )) * (v(i,j,k-1) + v(i,j,k)) * az(i,j,k );
145 
146  Real x_src = AdvectionSrcForOpenBC_Tangent(i, j, k, 0, dir, v, rho_u, dxInv, do_lo);
147  Real y_src = (yflux_hi - yflux_lo) * dyInv;
148  Real z_src = (zflux_hi - zflux_lo) * dzInv;
149  Real advectionSrc = x_src + y_src + z_src;
150 
151  rho_v_rhs(i, j, k) = -advectionSrc / (myhalf * (detJ(i,j,k) + detJ(i,j-1,k)));
152  } else {
153  rho_v_rhs(i, j, k) = zero;
154  }
155  });
156 }
Here is the call graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Zmom()

void AdvectionSrcForOpenBC_Tangent_Zmom ( const Box &  bxz,
const OpenSide  x_side,
const OpenSide  y_side,
const Array4< Real > &  rho_w_rhs,
const Array4< const Real > &  w,
const Array4< const Real > &  rho_u,
const Array4< const Real > &  rho_v,
const Array4< const Real > &  Omega,
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 int  domhi_z 
)

Compute second-order advection tendencies for z-momentum tangent to an open boundary.

Parameters
[in]bxzbox over which z-momentum is updated
[in]x_sidewhich x boundary the cells lie on, if any
[in]y_sidewhich y boundary the cells lie on, if any
[out]rho_w_rhstendency for the z-momentum equation
[in]wz-component of velocity
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]Omegacomponent of momentum normal to the z-coordinate surface
[in]axarea fraction of x-faces
[in]ayarea fraction of y-faces
[in]azarea fraction of z-faces
[in]detJJacobian of the metric transformation
[in]cellSizeInvinverse grid spacing
[in]domhi_zmaximum cell-centered k-index in the domain
191 {
192  // At a corner both sides are set, and neither x nor y may be differenced across
193  const bool xopen = (x_side != OpenSide::none);
194  const bool yopen = (y_side != OpenSide::none);
195  const bool x_do_lo = (x_side == OpenSide::lo);
196  const bool y_do_lo = (y_side == OpenSide::lo);
197 
198  AMREX_ALWAYS_ASSERT(xopen || yopen);
199 
200  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
201 
202  ParallelFor(bxz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
203  {
204  if (az(i,j,k) > zero) {
205  Real xflux_hi = fourth*(rho_u(i+1,j ,k) + rho_u(i+1, j, k-1)) * (w(i+1,j,k) + w(i,j,k)) *
206  myhalf *(ax(i+1,j,k) + ax(i+1,j,k-1));
207 
208  Real xflux_lo = fourth*(rho_u(i ,j ,k) + rho_u(i , j, k-1)) * (w(i-1,j,k) + w(i,j,k)) *
209  myhalf *(ax(i,j,k) + ax(i,j,k-1));
210 
211  Real yflux_hi = fourth*(rho_v(i ,j+1,k) + rho_v(i, j+1, k-1)) * (w(i,j+1,k) + w(i,j,k)) *
212  myhalf *(ay(i,j+1,k) + ay(i,j+1,k-1));
213 
214  Real yflux_lo = fourth*(rho_v(i ,j ,k) + rho_v(i, j , k-1)) * (w(i,j-1,k) + w(i,j,k)) *
215  myhalf *(ay(i,j,k) + ay(i,j,k-1));
216 
217  Real zflux_lo = fourth * (Omega(i,j,k) + Omega(i,j,k-1)) * (w(i,j,k) + w(i,j,k-1)) *
218  myhalf *(az(i,j,k) + az(i,j,k-1));
219 
220  Real zflux_hi = (k == domhi_z+1) ? Omega(i,j,k) * w(i,j,k) * az(i,j,k):
221  fourth * (Omega(i,j,k) + Omega(i,j,k+1)) * (w(i,j,k) + w(i,j,k+1)) *
222  myhalf * (az(i,j,k) + az(i,j,k+1));
223 
224  Real x_src = (xopen) ? AdvectionSrcForOpenBC_Tangent(i, j, k, 0, 0, w, rho_u, dxInv, x_do_lo) :
225  (xflux_hi - xflux_lo) * dxInv;
226  Real y_src = (yopen) ? AdvectionSrcForOpenBC_Tangent(i, j, k, 0, 1, w, rho_v, dyInv, y_do_lo) :
227  (yflux_hi - yflux_lo) * dyInv;
228  Real z_src = (zflux_hi - zflux_lo) * dzInv;
229  Real advectionSrc = x_src + y_src + z_src;
230 
231  rho_w_rhs(i, j, k) = -advectionSrc / (myhalf*(detJ(i,j,k) + detJ(i,j,k-1)));
232  } else {
233  rho_w_rhs(i, j, k) = zero;
234  }
235  });
236 }
Real w
Definition: ERF_Plotfile2DInterpolator.cpp:22
Here is the call graph for this function: