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

Macros

#define INSTANTIATE_IMPLICIT_DIFF_FOR_MOM(STAGDIR)
 

Functions

void ImplicitDiffForState_T (const Box &bx, const Box &domain, const int level, const Real dt, const GpuArray< Real, AMREX_SPACEDIM *2 > &bc_neumann_vals, const Array4< Real > &cell_data, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const Array4< const Real > &hfx_z, 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 ImplicitDiffForMom_T (const Box &bx, const Box &domain, const int level, const Real dt, const Array4< const Real > &cell_data, const Array4< Real > &face_data, const Array4< const Real > &tau_corr, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, 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

#define INSTANTIATE_IMPLICIT_DIFF_FOR_MOM (   STAGDIR)
Value:
template void ImplicitDiffForMom_T<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 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:128

Function Documentation

◆ ImplicitDiffForMom_T()

template<int stagdir>
void ImplicitDiffForMom_T ( const Box &  bx,
const Box &  domain,
const int  level,
const Real  dt,
const Array4< const Real > &  cell_data,
const Array4< Real > &  face_data,
const Array4< const Real > &  tau_corr,
const Array4< const Real > &  z_nd,
const Array4< const Real > &  detJ,
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, over terrain.

This function (explicitly instantiated below) handles staggering in x, y, or z through the template parameter, stagdir. NOTE: implicit diffusion of w has remains an experimental feature and has not been tested yet with terrain.

Parameters
[in]bxcell-centered box to loop over
[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]z_ndnodal array of z
[in]detJJacobian determinant
[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
195 {
196  BL_PROFILE_VAR("ImplicitDiffForMom_T()",ImplicitDiffForMom_T);
197 
198  // setup quantities for getRhoAlphaAtFaces()
199  DiffChoice dc = solverChoice.diffChoice;
200  TurbChoice tc = solverChoice.turbChoice[level];
202  bool l_turb = tc.use_kturb;
203  Real mu_eff = (l_consA) ? 2.0 * dc.dynamic_viscosity / dc.rho0_trans
204  : 2.0 * dc.dynamic_viscosity;
205 
206  // g(S*) coefficient
207  // stagdir==0: tau_corr = 0.5 * du/dz * mu_tot
208  // stagdir==1: tau_corr = 0.5 * dv/dz * mu_tot
209  // stagdir==2: tau_corr = dw/dz * mu_tot
210  constexpr Real gfac = (stagdir == 2) ? 2.0/3.0 : 1.0;
211 
212  // offsets used to average to faces
213  constexpr int ioff = (stagdir == 0) ? 1 : 0;
214  constexpr int joff = (stagdir == 1) ? 1 : 0;
215 
216  // Box bounds
217  int ilo = bx.smallEnd(0);
218  int ihi = bx.bigEnd(0);
219  int jlo = bx.smallEnd(1);
220  int jhi = bx.bigEnd(1);
221  int klo = bx.smallEnd(2);
222  int khi = bx.bigEnd(2);
223  amrex::ignore_unused(ilo, ihi, jlo, jhi);
224 
225  // Temporary FABs for tridiagonal solve (allocated on column)
226  // A[k] * x[k-1] + B[k] * x[k] + C[k+1] = RHS[k]
227  amrex::FArrayBox RHS_fab, soln_fab, coeffA_fab, coeffB_fab, inv_coeffB_fab, coeffC_fab;
228  RHS_fab.resize(bx,1, amrex::The_Async_Arena());
229  soln_fab.resize(bx,1, amrex::The_Async_Arena());
230  coeffA_fab.resize(bx,1, amrex::The_Async_Arena());
231  coeffB_fab.resize(bx,1, amrex::The_Async_Arena());
232  inv_coeffB_fab.resize(bx,1, amrex::The_Async_Arena());
233  coeffC_fab.resize(bx,1, amrex::The_Async_Arena());
234  auto const& RHS_a = RHS_fab.array();
235  auto const& soln_a = soln_fab.array();
236  auto const& coeffA_a = coeffA_fab.array(); // lower diagonal
237  auto const& coeffB_a = coeffB_fab.array(); // diagonal
238  auto const& inv_coeffB_a = inv_coeffB_fab.array();
239  auto const& coeffC_a = coeffC_fab.array(); // upper diagonal
240 
241  const auto& dom_lo = lbound(domain);
242  const auto& dom_hi = ubound(domain);
243  Real dz_inv = cellSizeInv[2];
244 
245  int bc_comp = BCVars::xvel_bc + stagdir;
246  bool ext_dir_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::ext_dir ||
247  bc_ptr[bc_comp].lo(2) == ERFBCType::ext_dir_prim);
248  bool ext_dir_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::ext_dir ||
249  bc_ptr[bc_comp].hi(2) == ERFBCType::ext_dir_prim);
250  bool foextrap_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::foextrap);
251  amrex::ignore_unused(foextrap_on_zhi);
252 
253  AMREX_ASSERT_WITH_MESSAGE(ext_dir_on_zlo || ext_dir_on_zhi || use_SurfLayer,
254  "Unexpected lower BC used with implicit vertical diffusion");
255  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zhi,
256  "Unexpected upper BC used with implicit vertical diffusion");
257  if (stagdir < 2 && (ext_dir_on_zlo || ext_dir_on_zhi)) {
258  amrex::Warning("No-slip walls have not been fully tested");
259  }
260 
261 #ifdef AMREX_USE_GPU
262  ParallelFor(makeSlab(bx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int)
263  {
264 #else
265  for (int j(jlo); j<=jhi; ++j) {
266  for (int i(ilo); i<=ihi; ++i) {
267 #endif
268  // Build the coefficients and RHS
269  for (int k(klo); k <= khi; k++)
270  {
271  Real rhoface, detJface; // at staggered location
272  Real rhoAlpha_lo, rhoAlpha_hi;
273  Real met_h_zeta_lo, met_h_zeta_hi;
274  if (stagdir < 2) {
275  // Note: either ioff or joff are 1
276  rhoface = 0.5 * (cell_data(i,j,k,Rho_comp) + cell_data(i-ioff,j-joff,k,Rho_comp));
277  detJface = 0.5 * (detJ(i,j,k) + detJ(i-ioff,j-joff,k));
278 
279  // average to lo/hi edges
280  getRhoAlphaForFaces(i, j, k, ioff, joff,
281  rhoAlpha_lo, rhoAlpha_hi,
282  cell_data, mu_turb, mu_eff,
283  l_consA, l_turb);
284 
285  met_h_zeta_lo = 0.5 * ( Compute_h_zeta_AtKface(i ,j ,k ,cellSizeInv,z_nd)
286  + Compute_h_zeta_AtKface(i-ioff,j-joff,k ,cellSizeInv,z_nd) );
287  met_h_zeta_hi = 0.5 * ( Compute_h_zeta_AtKface(i ,j ,k+1,cellSizeInv,z_nd)
288  + Compute_h_zeta_AtKface(i-ioff,j-joff,k+1,cellSizeInv,z_nd) );
289  } else {
290  rhoface = 0.5 * (cell_data(i,j,k,Rho_comp) + cell_data(i,j,k-1,Rho_comp));
291  detJface = 0.5 * (detJ(i,j,k) + detJ(i,j,k-1));
292 
293  // no averaging, lo/hi at cc
294  getRhoAlphaForFaces(i, j, k, /*ioff, joff,*/
295  rhoAlpha_lo, rhoAlpha_hi,
296  cell_data, mu_turb, mu_eff,
297  l_consA, l_turb);
298 
299  met_h_zeta_lo = detJ(i,j,k-1);
300  met_h_zeta_hi = detJ(i,j,k );;
301  }
302 
303  // Face data currently holds the _fully_ explicit solution, which
304  // will be used to determine the velocity gradient for the bottom
305  // BC
306 
307  RHS_a(i,j,k) = detJface * face_data(i,j,k); // Note this is momentum but solution will be velocity
308 
309  // Notes:
310  //
311  // - In DiffusionSrcForMom (e.g., for x-mom)
312  //
313  // Real diffContrib = ...
314  // + (tau13(i,j,k+1) - tau13(i,j,k)) * dzinv
315  // diffContrib /= 0.5*(detJ(i,j,k) + detJ(i,j,k-1));
316  // rho_u_rhs(i,j,k) -= diffContrib; // note the negative sign
317  //
318  // - We need to scale the explicit _part_ of `tau13` (for x-mom) by (1 - implicit_fac)
319  // The part that needs to be scaled is stored in `tau_corr`.
320  // E.g., tau13 = 0.5 * (du/dz + dw/dx)
321  // tau13_corr = 0.5 * du/dz
322  //
323  // - The momentum (`face_data`) was set to `S_old + S_rhs * dt`
324  // prior to including "ERF_Implicit.H". Recall that S_rhs includes
325  // sources from advection and other forcings, not just diffusion.
326  //
327  // - To correct momentum, we need to subtract `implicit_fac * diffContrib_corr`
328  // from S_rhs to recover `(1 - implicit_fac) * diffContrib_corr`,
329  // where `diffContrib_corr = -d(tau_corr)/dz`. The negative sign
330  // comes from our convention for the RHS diffusion source.
331  //
332  // Subtracting a negative gives the += below; multiply by dt to
333  // get the intermediate momentum on the RHS of the tridiagonal
334  // system.
335 
336  RHS_a(i,j,k) += implicit_fac * gfac * (tau_corr(i,j,k+1) - tau_corr(i,j,k))*dz_inv * dt;
337 
338  // This represents the face-centered finite difference of two
339  // edge-centered finite differences (hi and lo)
340  coeffA_a(i,j,k) = -implicit_fac * gfac * rhoAlpha_lo * dt * dz_inv * dz_inv/met_h_zeta_lo;
341  coeffC_a(i,j,k) = -implicit_fac * gfac * rhoAlpha_hi * dt * dz_inv * dz_inv/met_h_zeta_hi;
342 
343  // We multiplied through by detJ (at faces) for numerical stability; as a
344  // result, it does not show up in the denominator of coeffs A and C
345  // but we see it multiplying the B coeff and the RHS
346 
347  // Setup BCs
348  if (k == dom_lo.z) {
349  if (ext_dir_on_zlo) {
350  // This can be a no-slip wall (u = v = w = 0), slip wall (w = 0), or surface layer (w = 0)
351  if (stagdir==2) {
352  coeffC_a(i,j,klo) = 0.;
353  RHS_a(i,j,klo) = 0.;
354  } else {
355  // first-order:
356  // u(klo) - (u(klo+1) - u(klo))/dz_hi * dz/2 = u_dir
357  coeffC_a(i,j,klo) = -0.5 * detJface * detJface / met_h_zeta_hi; // -0.5 * dz/dz_hi * detJ
358  RHS_a(i,j,klo) = detJface * face_data(i,j,klo-1); // Dirichlet value
359  }
360  } else if (use_SurfLayer) {
361  // Match explicit grad(u) at the surface
362  Real uhi = 2.0 * face_data(i,j,klo ) / (cell_data(i,j,klo ,Rho_comp) + cell_data(i-ioff,j-joff,klo ,Rho_comp));
363  Real ulo = 2.0 * face_data(i,j,klo-1) / (cell_data(i,j,klo-1,Rho_comp) + cell_data(i-ioff,j-joff,klo-1,Rho_comp));
364  RHS_a(i,j,klo) += coeffA_a(i,j,klo) * (uhi - ulo);
365  }
366 
367  // default is foextrap
368  coeffA_a(i,j,klo) = 0.;
369  }
370  if (k == dom_hi.z) {
371  if (ext_dir_on_zhi) {
372  if (stagdir==2) {
373  coeffA_a(i,j,khi) = 0.;
374  RHS_a(i,j,khi) = 0.;
375  } else {
376  // first-order:
377  // u(khi) + (u(khi) - u(khi-1))/dz_lo * dz/2 = u_dir
378  coeffA_a(i,j,khi) = -0.5 * detJface * detJface / met_h_zeta_lo; // -0.5 * dz/dz_lo * detJ;
379  RHS_a(i,j,khi) = detJface * face_data(i,j,khi+1); // Dirichlet value
380  }
381  }
382 
383  // default is foextrap
384  coeffC_a(i,j,khi) = 0.;
385  }
386 
387  coeffB_a(i,j,k) = detJface * rhoface - coeffA_a(i,j,k) - coeffC_a(i,j,k);
388  } // k
389 
390  SolveTridiag(i,j,klo,khi,soln_a,coeffA_a,coeffB_a,inv_coeffB_a,coeffC_a,RHS_a);
391  for (int k(klo); k<=khi; ++k) {
392  Real rhoface = 0.5 * (cell_data(i,j,k,Rho_comp) + cell_data(i-ioff,j-joff,k,Rho_comp));
393  face_data(i,j,k) = rhoface * soln_a(i,j,k);
394  }
395 
396 #ifdef AMREX_USE_GPU
397  });
398 #else
399  } // i
400  } // j
401 #endif
402 }
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
void ImplicitDiffForMom_T(const Box &bx, const Box &domain, const int level, const Real dt, const Array4< const Real > &cell_data, const Array4< Real > &face_data, const Array4< const Real > &tau_corr, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, 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)
Definition: ERF_ImplicitDiff_T.cpp:180
#define Rho_comp
Definition: ERF_IndexDefines.H:36
const auto & dom_hi
Definition: ERF_SetupVertDiff.H:2
bool l_turb
Definition: ERF_SetupVertDiff.H:8
const auto & dom_lo
Definition: ERF_SetupVertDiff.H:1
bool l_consA
Definition: ERF_SetupVertDiff.H:7
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SolveTridiag(int i, int j, int klo, int khi, const amrex::Array4< amrex::Real > &soln_a, const amrex::Array4< const amrex::Real > &coeffA_a, const amrex::Array4< amrex::Real > &coeffB_a, const amrex::Array4< amrex::Real > &inv_coeffB_a, const amrex::Array4< const amrex::Real > &coeffC_a, const amrex::Array4< const amrex::Real > &RHS_a)
Definition: ERF_SolveTridiag.H:6
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:182
@ xvel_bc
Definition: ERF_IndexDefines.H:87
@ foextrap
Definition: ERF_IndexDefines.H:208
@ ext_dir
Definition: ERF_IndexDefines.H:209
@ ext_dir_prim
Definition: ERF_IndexDefines.H:211
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:992
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:995
Definition: ERF_TurbStruct.H:41
bool use_kturb
Definition: ERF_TurbStruct.H:396
Here is the call graph for this function:

◆ ImplicitDiffForState_T()

void ImplicitDiffForState_T ( const Box &  bx,
const Box &  domain,
const int  level,
const Real  dt,
const GpuArray< Real, AMREX_SPACEDIM *2 > &  bc_neumann_vals,
const Array4< Real > &  cell_data,
const Array4< const Real > &  z_nd,
const Array4< const Real > &  detJ,
const GpuArray< Real, AMREX_SPACEDIM > &  cellSizeInv,
const Array4< const Real > &  hfx_z,
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 terrain.

Parameters
[in]bxcell-centered box to loop over
[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]z_ndnodal array of z
[in]detJJacobian determinant
[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_T()",ImplicitDiffForState_T);
45 
46  // setup quantities for getRhoAlpha()
47 #include "ERF_SetupVertDiff.H"
48  const int n = RhoTheta_comp;
49  const int qty_index = RhoTheta_comp;
50  const int prim_index = qty_index - 1;
51  const int prim_scal_index = (qty_index >= RhoScalar_comp && qty_index < RhoScalar_comp+NSCALARS) ? PrimScalar_comp : prim_index;
52 
53  // Box bounds
54  int ilo = bx.smallEnd(0);
55  int ihi = bx.bigEnd(0);
56  int jlo = bx.smallEnd(1);
57  int jhi = bx.bigEnd(1);
58  int klo = bx.smallEnd(2);
59  int khi = bx.bigEnd(2);
60  amrex::ignore_unused(ilo, ihi, jlo, jhi);
61 
62  // Temporary FABs for tridiagonal solve (allocated on column)
63  // A[k] * x[k-1] + B[k] * x[k] + C[k+1] = RHS[k]
64  amrex::FArrayBox RHS_fab, soln_fab, coeffA_fab, coeffB_fab, inv_coeffB_fab, coeffC_fab;
65  RHS_fab.resize(bx,1, amrex::The_Async_Arena());
66  soln_fab.resize(bx,1, amrex::The_Async_Arena());
67  coeffA_fab.resize(bx,1, amrex::The_Async_Arena());
68  coeffB_fab.resize(bx,1, amrex::The_Async_Arena());
69  inv_coeffB_fab.resize(bx,1, amrex::The_Async_Arena());
70  coeffC_fab.resize(bx,1, amrex::The_Async_Arena());
71  auto const& RHS_a = RHS_fab.array();
72  auto const& soln_a = soln_fab.array();
73  auto const& coeffA_a = coeffA_fab.array(); // lower diagonal
74  auto const& coeffB_a = coeffB_fab.array(); // diagonal
75  auto const& inv_coeffB_a = inv_coeffB_fab.array();
76  auto const& coeffC_a = coeffC_fab.array(); // upper diagonal
77 
78  Real dz_inv = cellSizeInv[2];
79 
80  int bc_comp = qty_index;
81  bool foextrap_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::foextrap);
82  bool foextrap_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::foextrap);
83  bool neumann_on_zlo = (bc_ptr[bc_comp].lo(2) == ERFBCType::neumann);
84  bool neumann_on_zhi = (bc_ptr[bc_comp].hi(2) == ERFBCType::neumann);
85  amrex::ignore_unused(foextrap_on_zlo, foextrap_on_zhi);
86 
87  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zlo || neumann_on_zlo || use_SurfLayer,
88  "Unexpected lower BC used with implicit vertical diffusion");
89  AMREX_ASSERT_WITH_MESSAGE(foextrap_on_zhi || neumann_on_zhi,
90  "Unexpected upper BC used with implicit vertical diffusion");
91 
92 #ifdef AMREX_USE_GPU
93  ParallelFor(makeSlab(bx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int)
94  {
95 #else
96  for (int j(jlo); j<=jhi; ++j) {
97  for (int i(ilo); i<=ihi; ++i) {
98 #endif
99  // Build the coefficients and RHS
100  for (int k(klo); k <= khi; k++)
101  {
102  Real rhoAlpha_lo, rhoAlpha_hi;
103  getRhoAlpha(i, j, k, rhoAlpha_lo, rhoAlpha_hi,
104  cell_data, mu_turb, d_alpha_eff, d_eddy_diff_idz,
105  prim_index, prim_scal_index, l_consA, l_turb);
106 
107  Real met_h_zeta_lo = Compute_h_zeta_AtKface(i,j,k ,cellSizeInv,z_nd);
108  Real met_h_zeta_hi = Compute_h_zeta_AtKface(i,j,k+1,cellSizeInv,z_nd);
109 
110  RHS_a(i,j,k) = detJ(i,j,k) * cell_data(i,j,k,n); // Note this is rho*theta, whereas solution will be theta
111 
112  // This represents the cell-centered finite difference of two
113  // face-centered finite differences (hi and lo)
114  coeffA_a(i,j,k) = -implicit_fac * rhoAlpha_lo * dt * dz_inv * dz_inv / met_h_zeta_lo;
115  coeffC_a(i,j,k) = -implicit_fac * rhoAlpha_hi * dt * dz_inv * dz_inv / met_h_zeta_hi;
116 
117  // Note: The additional factor of detJ was multiplied through so we
118  // don't see it in the denominator of coeffs A and C but we
119  // do see it multiplying the B coeff and the RHS
120 
121  // Setup BCs
122  if (k == dom_lo.z) {
123  if (use_SurfLayer) {
124  RHS_a(i,j,klo) += implicit_fac * dt * dz_inv * hfx_z(i,j,0);
125  } else if (neumann_on_zlo) {
126  RHS_a(i,j,klo) += coeffA_a(i,j,klo) * bc_neumann_vals[2] / dz_inv*met_h_zeta_lo;
127  }
128 
129  coeffA_a(i,j,klo) = 0.;
130  }
131  if (k == dom_hi.z) {
132  if (neumann_on_zhi) {
133  RHS_a(i,j,khi) -= coeffC_a(i,j,khi) * bc_neumann_vals[5] / dz_inv*met_h_zeta_hi;
134  }
135 
136  coeffC_a(i,j,khi) = 0.;
137  }
138 
139  coeffB_a(i,j,k) = detJ(i,j,k)*cell_data(i,j,k,Rho_comp) - coeffA_a(i,j,k) - coeffC_a(i,j,k);
140  } // k
141 
142  SolveTridiag(i,j,klo,khi,soln_a,coeffA_a,coeffB_a,inv_coeffB_a,coeffC_a,RHS_a);
143  for (int k(klo); k<=khi; ++k) {
144  cell_data(i,j,k,n) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
145  }
146 
147 #ifdef AMREX_USE_GPU
148  });
149 #else
150  } // i
151  } // j
152 #endif
153 }
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
void ImplicitDiffForState_T(const Box &bx, const Box &domain, const int level, const Real dt, const GpuArray< Real, AMREX_SPACEDIM *2 > &bc_neumann_vals, const Array4< Real > &cell_data, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const Array4< const Real > &hfx_z, const Array4< const Real > &mu_turb, const SolverChoice &solverChoice, const BCRec *bc_ptr, const bool use_SurfLayer, const Real implicit_fac)
Definition: ERF_ImplicitDiff_T.cpp:29
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:40
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define NSCALARS
Definition: ERF_IndexDefines.H:16
#define PrimScalar_comp
Definition: ERF_IndexDefines.H:52
int * d_eddy_diff_idz
Definition: ERF_SetupVertDiff.H:107
Real * d_alpha_eff
Definition: ERF_SetupVertDiff.H:104
@ neumann
Definition: ERF_IndexDefines.H:213
Here is the call graph for this function: