ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ImplicitDiff_N.cpp File Reference
Include dependency graph for ERF_ImplicitDiff_N.cpp:

Macros

#define INSTANTIATE_IMPLICIT_DIFF_FOR_MOM_LU(STAGDIR)
 

Functions

void ImplicitDiffForStateLU_N (const Box &bx, const Box &domain, const int level, const int n, const Real dt, const GpuArray< Real, AMREX_SPACEDIM *2 > &bc_neumann_vals, const Array4< Real > &cell_data, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const Array4< const Real > &scalar_zflux, const Array4< const Real > &mu_turb, const SolverChoice &solverChoice, const BCRec *bc_ptr, const bool use_SurfLayer, const Real implicit_fac)
 
template<int stagdir>
void ImplicitDiffForMomLU_N (const Box &bx, const Box &, const int level, const Real dt, const Array4< const Real > &cell_data, const Array4< Real > &face_data, const Array4< const Real > &tau, const Array4< const Real > &tau_corr, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const Array4< const Real > &mu_turb, const SolverChoice &solverChoice, const BCRec *bc_ptr, const bool use_SurfLayer, const Real implicit_fac)
 

Macro Definition Documentation

◆ INSTANTIATE_IMPLICIT_DIFF_FOR_MOM_LU

#define INSTANTIATE_IMPLICIT_DIFF_FOR_MOM_LU (   STAGDIR)
Value:
template void ImplicitDiffForMomLU_N<STAGDIR> ( \
const Box&, \
const Box&, \
const int, \
const Real, \
const Array4<const Real>&, \
const Array4< Real>&, \
const Array4<const Real>&, \
const Array4<const Real>&, \
const GpuArray<Real, AMREX_SPACEDIM>&, \
const Array4<const Real>&, \
const SolverChoice&, \
const BCRec*, \
const bool, \
const Real);
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_DataStruct.H:141

Function Documentation

◆ ImplicitDiffForMomLU_N()

template<int stagdir>
void ImplicitDiffForMomLU_N ( const Box &  bx,
const Box &  ,
const int  level,
const Real  dt,
const Array4< const Real > &  cell_data,
const Array4< Real > &  face_data,
const Array4< const Real > &  tau,
const Array4< const Real > &  tau_corr,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv,
const Array4< const Real > &  mu_turb,
const SolverChoice solverChoice,
const BCRec *  bc_ptr,
const bool  use_SurfLayer,
const Real  implicit_fac 
)

Function for computing the implicit contribution to the vertical diffusion of momentum, with a uniform grid and no terrain.

This function (explicitly instantiated below) handles staggering in x, y, or z through the template parameter, stagdir.

Parameters
[in]bxcell-centered box to loop over
[in]levelAMR level
[in]domainbox of the whole domain
[in]dttime step
[in]cell_dataconserved cell-centered rho
[in,out]face_dataconserved momentum
[in]tau_corrstress contribution to momentum that will be corrected by the implicit solve
[in]cellSizeInvinverse cell size array
[in]mu_turbturbulent viscosity
[in]solverChoicecontainer of parameters
[in]bc_ptrcontainer with boundary conditions
[in]use_SurfLayerwhether we have turned on subgrid diffusion
[in]implicit_facif 1 then fully implicit; if 0 then fully explicit
218 {
219  BL_PROFILE_VAR("ImplicitDiffForMom_N()",ImplicitDiffForMom_N);
220 
221  // setup quantities for getRhoAlphaAtFaces()
222  DiffChoice dc = solverChoice.diffChoice;
223  TurbChoice tc = solverChoice.turbChoice[level];
225  bool l_turb = tc.use_kturb;
226  Real mu_eff = (l_consA) ? two * dc.dynamic_viscosity / dc.rho0_trans
227  : two * dc.dynamic_viscosity;
228 
229  // g(S*) coefficient
230  // stagdir==0: tau_corr = myhalf * du/dz * mu_tot
231  // stagdir==1: tau_corr = myhalf * dv/dz * mu_tot
232  // stagdir==2: tau_corr = dw/dz * mu_tot
233  constexpr Real gfac = (stagdir == 2) ? two/three : one;
234 
235  // offsets used to average to faces
236  constexpr int ioff = (stagdir == 0) ? 1 : 0;
237  constexpr int joff = (stagdir == 1) ? 1 : 0;
238 
239  // Box bounds
240  int ilo = bx.smallEnd(0);
241  int ihi = bx.bigEnd(0);
242  int jlo = bx.smallEnd(1);
243  int jhi = bx.bigEnd(1);
244  int klo = bx.smallEnd(2);
245  int khi = bx.bigEnd(2);
246  amrex::ignore_unused(ilo, ihi, jlo, jhi);
247 
248  // Temporary FABs for tridiagonal solve (allocated on column)
249  // A[k] * x[k-1] + B[k] * x[k] + C[k+1] = RHS[k]
250  amrex::FArrayBox RHS_fab, soln_fab, coeffG_fab;
251  RHS_fab.resize(bx,1, amrex::The_Async_Arena());
252  soln_fab.resize(bx,1, amrex::The_Async_Arena());
253  coeffG_fab.resize(bx,1, amrex::The_Async_Arena());
254  auto const& RHS_a = RHS_fab.array();
255  auto const& soln_a = soln_fab.array();
256  auto const& coeffG_a = coeffG_fab.array();
257 
258  Real dz_inv = cellSizeInv[2];
259 
260  int bc_comp = BCVars::xvel_bc + stagdir;
261  bool ext_dir_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::ext_dir ||
262  bc_ptr[bc_comp].lo(2) == ERFBCType::ext_dir_prim);
263  bool ext_dir_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::ext_dir ||
264  bc_ptr[bc_comp].hi(2) == ERFBCType::ext_dir_prim);
265  bool foextrap_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::foextrap);
266  bool foextrap_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::foextrap);
267  amrex::ignore_unused(foextrap_on_zlo,foextrap_on_zhi);
268 
269  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zlo || ext_dir_on_zlo || use_SurfLayer,
270  "Unexpected lower BC for momentum used with implicit vertical diffusion");
271  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zhi || ext_dir_on_zhi,
272  "Unexpected upper BC for momentum used with implicit vertical diffusion");
273 
274  Real Fact = implicit_fac * dt * dz_inv;
275 
276 #ifdef AMREX_USE_GPU
277  ParallelFor(makeSlab(bx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int)
278  {
279 #else
280  for (int j(jlo); j<=jhi; ++j) {
281  for (int i(ilo); i<=ihi; ++i) {
282 #endif
283  // Notes:
284  //
285  // - In DiffusionSrcForMom (e.g., for x-mom)
286  //
287  // Real diffContrib = ...
288  // + (tau13(i,j,k+1) - tau13(i,j,k)) / dzinv
289  // rho_u_rhs(i,j,k) -= diffContrib; // note the negative sign
290  //
291  // - We need to scale the explicit _part_ of `tau13` (for x-mom) by (1 - implicit_fac)
292  // The part that needs to be scaled is stored in `tau_corr`.
293  // E.g., tau13 = 0.5 * (du/dz + dw/dx)
294  // tau13_corr = 0.5 * du/dz
295  //
296  // - The momentum (`face_data`) was set to `S_old + S_rhs * dt`
297  // prior to including "ERF_Implicit.H". Recall that S_rhs includes
298  // sources from advection and other forcings, not just diffusion.
299  //
300  // - To correct momentum, we need to subtract `implicit_fac * diffContrib_corr`
301  // from S_rhs to recover `(1 - implicit_fac) * diffContrib_corr`,
302  // where `diffContrib_corr = -d(tau_corr)/dz`. The negative sign
303  // comes from our convention for the RHS diffusion source.
304  //
305  // Subtracting a negative gives the += below; multiply by dt to
306  // get the intermediate momentum on the RHS of the tridiagonal
307  // system.
308  //
309  // - With a surface_layer BC, tau13/23 holds the vertical flux -d_z(k*u_i)
310  // directly. We must use tau at klo (not tau_corr) with SL BCs.
311  //
312  // - Finally, the terms ~ RHS += (tau_corr_hi - tau_corr_lo) / dz (below)
313  // essentially undo the explicit diffusion update that will be
314  // handled here implicitly.
315 
316  // Bottom boundary coefficients and RHS for L decomp
317  //===================================================
318  Real rhoface, rhoAlpha_lo, rhoAlpha_hi;
319  Real a_tmp, b_tmp, c_tmp, inv_b2_tmp;
320  {
321  rhoface = myhalf * (cell_data(i,j,klo,Rho_comp) + cell_data(i-ioff,j-joff,klo,Rho_comp));
322  getRhoAlphaForFaces(i, j, klo, ioff, joff, rhoAlpha_lo, rhoAlpha_hi,
323  cell_data, mu_turb, mu_eff,
324  l_consA, l_turb);
325 
326  a_tmp = zero;
327  c_tmp = -Fact * gfac * rhoAlpha_hi * dz_inv;
328 
329  RHS_a(i,j,klo) = face_data(i,j,klo); // NOTE: this is momenta; solution is velocity
330 
331  // BCs: Dirichlet (u_i = val), slip wall (w = 0), or surface layer (w = 0)
332  if (ext_dir_on_zlo) {
333  RHS_a(i,j,klo) += Fact * gfac * (tau_corr(i,j,klo+1) - tau_corr(i,j,klo));
334  if (stagdir==2) {
335  c_tmp = zero;
336  RHS_a(i,j,klo) = zero;
337  } else {
338  // NOTE: wall is 1/2 dz away (2 dz_inv)
339  a_tmp = -two * Fact * rhoAlpha_lo * dz_inv;
340  RHS_a(i,j,klo) += two * rhoAlpha_lo * face_data(i,j,klo-1) * dz_inv * dz_inv;
341  }
342  } else if (use_SurfLayer) {
343  // NOTE: tau = -mu*d_z(u_i) w/ SL
344  RHS_a(i,j,klo) += Fact * gfac * (tau_corr(i,j,klo+1) - tau(i,j,klo));
345  RHS_a(i,j,klo) += Fact * tau(i,j,klo);
346  } else {
347  // NOTE: FOEXTRAP has zero lower flux (nothing to add to RHS)
348  RHS_a(i,j,klo) += Fact * gfac * (tau_corr(i,j,klo+1) - tau_corr(i,j,klo));
349  }
350 
351  b_tmp = rhoface - a_tmp - c_tmp;
352  inv_b2_tmp = one;
353 
354  RHS_a(i,j,klo) /= b_tmp; // NOTE: this is now "rho"
355  coeffG_a(i,j,klo) = c_tmp / b_tmp; // NOTE: this is now "gamma"
356  }
357 
358  // Build the coefficients and RHS for L decomp
359  //===================================================
360  for (int k(klo+1); k < khi; k++) {
361  rhoface = myhalf * (cell_data(i,j,k,Rho_comp) + cell_data(i-ioff,j-joff,k,Rho_comp));
362  getRhoAlphaForFaces(i, j, k, ioff, joff, rhoAlpha_lo, rhoAlpha_hi,
363  cell_data, mu_turb, mu_eff,
364  l_consA, l_turb);
365 
366  a_tmp = -Fact * rhoAlpha_lo * dz_inv;
367  c_tmp = -Fact * rhoAlpha_hi * dz_inv;
368  b_tmp = rhoface - a_tmp - c_tmp;
369  inv_b2_tmp = one/ (b_tmp - a_tmp * coeffG_a(i,j,k-1));
370 
371  RHS_a(i,j,k) = face_data(i,j,k); // NOTE: this is momenta; solution is velocity
372  RHS_a(i,j,k) += Fact * gfac * (tau_corr(i,j,k+1) - tau_corr(i,j,k));
373 
374  RHS_a(i,j,k) = (RHS_a(i,j,k) - a_tmp * RHS_a(i,j,k-1)) * inv_b2_tmp; // NOTE: This is now "rho"
375  coeffG_a(i,j,k) = c_tmp * inv_b2_tmp; // NOTE: this is now "gamma"
376  } // k
377 
378  // Top boundary coefficients and RHS for L decomp
379  //===================================================
380  {
381  rhoface = myhalf * (cell_data(i,j,khi,Rho_comp) + cell_data(i-ioff,j-joff,khi,Rho_comp));
382  getRhoAlphaForFaces(i, j, khi, ioff, joff, rhoAlpha_lo, rhoAlpha_hi,
383  cell_data, mu_turb, mu_eff,
384  l_consA, l_turb);
385 
386  a_tmp = -Fact * gfac * rhoAlpha_lo * dz_inv;
387  c_tmp = zero;
388 
389  RHS_a(i,j,khi) = face_data(i,j,khi); // NOTE: this is momenta; solution is velocity
390  RHS_a(i,j,khi) += Fact * gfac * (tau_corr(i,j,khi+1) - tau_corr(i,j,khi));
391 
392  // BCs: Dirichlet (u_i = val), slip wall (w = 0)
393  if (ext_dir_on_zhi) {
394  if (stagdir==2) {
395  a_tmp = zero;
396  RHS_a(i,j,khi) = zero;
397  } else {
398  // NOTE: wall is 1/2 dz away (2 dz_inv)
399  c_tmp = -two * Fact * rhoAlpha_hi * dz_inv;
400  RHS_a(i,j,khi) += two * rhoAlpha_hi * face_data(i,j,khi+1) * dz_inv * dz_inv;
401  }
402  }
403 
404  b_tmp = rhoface - a_tmp - c_tmp;
405  inv_b2_tmp = one/ (b_tmp - a_tmp * coeffG_a(i,j,khi-1));
406 
407  // First solve
408  soln_a(i,j,khi) = (RHS_a(i,j,khi) - a_tmp * RHS_a(i,j,khi-1)) * inv_b2_tmp;
409  }
410 
411  // Back sweep the U decomp solution
412  //===================================================
413  for (int k(khi-1); k>=klo; --k) {
414  soln_a(i,j,k) = RHS_a(i,j,k) - coeffG_a(i,j,k) * soln_a(i,j,k+1);
415  }
416 
417  // Convert back to momenta
418  //===================================================
419  for (int k(klo); k<=khi; ++k) {
420  rhoface = myhalf * (cell_data(i,j,k,Rho_comp) + cell_data(i-ioff,j-joff,k,Rho_comp));
421  face_data(i,j,k) = rhoface * soln_a(i,j,k);
422  }
423 
424 #ifdef AMREX_USE_GPU
425  });
426 #else
427  } // i
428  } // j
429 #endif
430 }
constexpr amrex::Real three
Definition: ERF_Constants.H:11
constexpr amrex::Real two
Definition: ERF_Constants.H:10
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void getRhoAlphaForFaces(int i, int j, int k, int ioff, int joff, amrex::Real &rhoAlpha_lo, amrex::Real &rhoAlpha_hi, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &mu_turb, const amrex::Real mu_eff, bool l_consA, bool l_turb)
Definition: ERF_GetRhoAlphaForFaces.H:5
#define Rho_comp
Definition: ERF_IndexDefines.H:36
const int khi
Definition: ERF_InitCustomPert_Bubble.H:21
ParallelFor(grown_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
bool l_turb
Definition: ERF_SetupVertDiff.H:9
bool l_consA
Definition: ERF_SetupVertDiff.H:8
AMREX_ASSERT_WITH_MESSAGE(wbar_cutoff_min > wbar_cutoff_max, "ERROR: wbar_cutoff_min < wbar_cutoff_max")
@ xvel_bc
Definition: ERF_IndexDefines.H:102
@ foextrap
Definition: ERF_IndexDefines.H:242
@ ext_dir
Definition: ERF_IndexDefines.H:243
@ ext_dir_prim
Definition: ERF_IndexDefines.H:246
Definition: ERF_DiffStruct.H:19
amrex::Real rho0_trans
Definition: ERF_DiffStruct.H:91
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
amrex::Real dynamic_viscosity
Definition: ERF_DiffStruct.H:96
DiffChoice diffChoice
Definition: ERF_DataStruct.H:1220
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:1223
Definition: ERF_TurbStruct.H:82
bool use_kturb
Definition: ERF_TurbStruct.H:513
Here is the call graph for this function:

◆ ImplicitDiffForStateLU_N()

void ImplicitDiffForStateLU_N ( const Box &  bx,
const Box &  domain,
const int  level,
const int  n,
const Real  dt,
const GpuArray< Real, AMREX_SPACEDIM *2 > &  bc_neumann_vals,
const Array4< Real > &  cell_data,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv,
const Array4< const Real > &  scalar_zflux,
const Array4< const Real > &  mu_turb,
const SolverChoice solverChoice,
const BCRec *  bc_ptr,
const bool  use_SurfLayer,
const Real  implicit_fac 
)

Function for computing the implicit contribution to the vertical diffusion of theta, with a uniform grid, no terrain, and LU decomposition.

Parameters
[in]bxcell-centered box to loop over
[in]levelAMR level
[in]domainbox of the whole domain
[in]dttime step
[in]bc_neumann_valsvalues of derivatives if bc_type == Neumann
[in,out]cell_dataconserved cell-centered rho, rho theta
[in]cellSizeInvinverse cell size array
[in,out]hfx_zheat flux in z-dir
[in]mu_turbturbulent viscosity
[in]solverChoicecontainer of parameters
[in]bc_ptrcontainer with boundary conditions
[in]use_SurfLayerwhether we have turned on subgrid diffusion
[in]implicit_facif 1 then fully implicit; if 0 then fully explicit
43 {
44  BL_PROFILE_VAR("ImplicitDiffForState_N()",ImplicitDiffForState_N);
45 
46  // setup quantities for getRhoAlpha()
47 #include "ERF_SetupVertDiff.H"
48  const int qty_index = n;
49  const int prim_index = qty_index - 1;
50  const int prim_scal_index = (qty_index >= RhoScalar_comp && qty_index < RhoScalar_comp+NSCALARS) ? PrimScalar_comp : prim_index;
51 
52  // Box bounds
53  int ilo = bx.smallEnd(0);
54  int ihi = bx.bigEnd(0);
55  int jlo = bx.smallEnd(1);
56  int jhi = bx.bigEnd(1);
57  int klo = bx.smallEnd(2);
58  int khi = bx.bigEnd(2);
59  amrex::ignore_unused(ilo, ihi, jlo, jhi);
60 
61  // Temporary FABs for tridiagonal solve (allocated on column)
62  // A[k] * x[k-1] + B[k] * x[k] + C[k+1] = RHS[k]
63 
64  // With LU decomposition, M * x = r is written as L * U * x = r with U * x = rho
65  // We then first have L * rho = r and U * x = rho
66  amrex::FArrayBox RHS_fab, soln_fab, coeffG_fab;
67  RHS_fab.resize(bx,1, amrex::The_Async_Arena());
68  soln_fab.resize(bx,1, amrex::The_Async_Arena());
69  coeffG_fab.resize(bx,1, amrex::The_Async_Arena());
70  auto const& RHS_a = RHS_fab.array();
71  auto const& soln_a = soln_fab.array();
72  auto const& coeffG_a = coeffG_fab.array();
73 
74  Real dz_inv = cellSizeInv[2];
75 
76  int bc_comp = qty_index;
77  bool foextrap_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::foextrap);
78  bool foextrap_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::foextrap);
79  bool neumann_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::neumann);
80  bool neumann_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::neumann);
81  amrex::ignore_unused(foextrap_on_zlo, foextrap_on_zhi);
82 
83  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zlo || neumann_on_zlo || use_SurfLayer,
84  "Unexpected lower BC for scalars used with implicit vertical diffusion");
85  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zhi || neumann_on_zhi,
86  "Unexpected upper BC for scalars used with implicit vertical diffusion");
87 
88  Real Fact = implicit_fac * dt * dz_inv;
89 
90 #ifdef AMREX_USE_GPU
91  ParallelFor(makeSlab(bx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int)
92  {
93 #else
94  for (int j(jlo); j<=jhi; ++j) {
95  for (int i(ilo); i<=ihi; ++i) {
96 #endif
97  // Bottom boundary coefficients and RHS for L decomp
98  //===================================================
99  Real rhoAlpha_lo, rhoAlpha_hi;
100  Real a_tmp, b_tmp, c_tmp, inv_b2_tmp;
101  {
102  getRhoAlpha(i, j, klo, rhoAlpha_lo, rhoAlpha_hi,
103  cell_data, mu_turb, d_alpha_eff, d_eddy_diff_idz,
104  prim_index, prim_scal_index, l_consA, l_turb);
105 
106  a_tmp = zero;
107  c_tmp = -Fact * rhoAlpha_hi * dz_inv;
108  b_tmp = cell_data(i,j,klo,Rho_comp) - a_tmp - c_tmp;
109  inv_b2_tmp = one;
110 
111  RHS_a(i,j,klo) = cell_data(i,j,klo,n); // NOTE: this is rho*phi; solution is phi
112  if (use_SurfLayer && scalar_zflux) {
113  RHS_a(i,j,klo) += Fact * scalar_zflux(i,j,klo); // NOTE: scalar_zflux = -K*d_z(\phi)
114  } else if (neumann_on_zlo) {
115  RHS_a(i,j,klo) += -Fact * rhoAlpha_lo * bc_neumann_vals[2]; // NOTE: N_val = d_z(\phi)
116  }
117 
118  RHS_a(i,j,klo) /= b_tmp; // NOTE: this is now "rho"
119  coeffG_a(i,j,klo) = c_tmp / b_tmp; // NOTE: this is now "gamma"
120  }
121 
122  // Build the coefficients and RHS for L decomp
123  //===================================================
124  for (int k(klo+1); k < khi; k++) {
125  getRhoAlpha(i, j, k, rhoAlpha_lo, rhoAlpha_hi,
126  cell_data, mu_turb, d_alpha_eff, d_eddy_diff_idz,
127  prim_index, prim_scal_index, l_consA, l_turb);
128 
129  a_tmp = -Fact * rhoAlpha_lo * dz_inv;
130  c_tmp = -Fact * rhoAlpha_hi * dz_inv;
131  b_tmp = cell_data(i,j,k,Rho_comp) - a_tmp - c_tmp;
132  inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,k-1));
133 
134  RHS_a(i,j,k) = cell_data(i,j,k,n); // NOTE: this is rho*phi; solution is phi
135 
136  RHS_a(i,j,k) = (RHS_a(i,j,k) - a_tmp * RHS_a(i,j,k-1)) * inv_b2_tmp; // NOTE: This is now "rho"
137  coeffG_a(i,j,k) = c_tmp * inv_b2_tmp; // NOTE: this is now "gamma"
138  } // k
139 
140  // Top boundary coefficients and RHS for L decomp
141  //===================================================
142  {
143  getRhoAlpha(i, j, khi, rhoAlpha_lo, rhoAlpha_hi,
144  cell_data, mu_turb, d_alpha_eff, d_eddy_diff_idz,
145  prim_index, prim_scal_index, l_consA, l_turb);
146 
147  a_tmp = -Fact * rhoAlpha_lo * dz_inv;
148  c_tmp = zero;
149  b_tmp = cell_data(i,j,khi,Rho_comp) - a_tmp - c_tmp;
150  inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,khi-1));
151 
152  RHS_a(i,j,khi) = cell_data(i,j,khi,n); // NOTE: this is rho*phi; solution is phi
153  if (neumann_on_zhi) {
154  RHS_a(i,j,khi) -= -Fact * rhoAlpha_hi * bc_neumann_vals[5]; // NOTE: N_val = d_z(\phi)
155  }
156 
157  // First solve
158  soln_a(i,j,khi) = (RHS_a(i,j,khi) - a_tmp * RHS_a(i,j,khi-1)) * inv_b2_tmp;
159  }
160 
161  // Back sweep the U decomp solution
162  //===================================================
163  for (int k(khi-1); k>=klo; --k) {
164  soln_a(i,j,k) = RHS_a(i,j,k) - coeffG_a(i,j,k) * soln_a(i,j,k+1);
165  }
166 
167  // Convert back to rho*theta
168  //===================================================
169  for (int k(klo); k<=khi; ++k) {
170  cell_data(i,j,k,n) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
171  }
172 
173 #ifdef AMREX_USE_GPU
174  });
175 #else
176  } // i
177  } // j
178 #endif
179 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void getRhoAlpha(int i, int j, int k, amrex::Real &rhoAlpha_lo, amrex::Real &rhoAlpha_hi, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &mu_turb, const amrex::Real *d_alpha_eff, const int *d_eddy_diff_idz, int prim_index, int prim_scal_index, bool l_consA, bool l_turb)
Definition: ERF_GetRhoAlpha.H:5
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:40
#define NSCALARS
Definition: ERF_IndexDefines.H:16
#define PrimScalar_comp
Definition: ERF_IndexDefines.H:57
int * d_eddy_diff_idz
Definition: ERF_SetupVertDiff.H:99
Real * d_alpha_eff
Definition: ERF_SetupVertDiff.H:98
@ neumann
Definition: ERF_IndexDefines.H:248
Here is the call graph for this function: