ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_MakeTauTerms.cpp File Reference
#include "AMReX_ArrayLim.H"
#include "AMReX_BCRec.H"
#include "AMReX_GpuContainers.H"
#include "ERF_TI_slow_headers.H"
#include "ERF_EOS.H"
#include "ERF_Utils.H"
#include "ERF_LogShear.H"
Include dependency graph for ERF_MakeTauTerms.cpp:

Functions

void erf_make_tau_terms (int level, int nrk, const Vector< BCRec > &domain_bcs_type_h, const MultiFab &z_phys_nd, Vector< MultiFab > &S_data, const MultiFab &xvel, const MultiFab &yvel, const MultiFab &zvel, Vector< std::unique_ptr< MultiFab >> &Tau_lev, Vector< std::unique_ptr< MultiFab >> &Tau_corr_lev, MultiFab *SmnSmn, MultiFab *eddyDiffs, const Geometry geom, const SolverChoice &solverChoice, const amrex::Vector< std::unique_ptr< SurfaceLayer >> &SurfLayer, Gpu::DeviceVector< Real > &stretched_dz_d, const MultiFab &detJ, Vector< std::unique_ptr< MultiFab >> &mapfac, const MultiFab &ax, const MultiFab &ay, const MultiFab &az, const eb_ &ebfact, const MultiFab *ib_wall_face13, const MultiFab *ib_wall_face23, const MultiFab *walldist)
 
void copy_surface_tau_for_implicit (Vector< std::unique_ptr< MultiFab >> &Tau_lev, Vector< std::unique_ptr< MultiFab >> &Tau_corr_lev)
 

Function Documentation

◆ copy_surface_tau_for_implicit()

void copy_surface_tau_for_implicit ( Vector< std::unique_ptr< MultiFab >> &  Tau_lev,
Vector< std::unique_ptr< MultiFab >> &  Tau_corr_lev 
)
773 {
774  // This is only needed if we're using a surface layer, which overwrites the
775  // shear stresses at klo -- at the moment, this is for testing
776 
777  for ( MFIter mfi(*Tau_lev[TauType::tau11],TileNoZ()); mfi.isValid(); ++mfi)
778  {
779  Array4<Real> tau13 = Tau_lev[TauType::tau13]->array(mfi);
780  Array4<Real> tau23 = Tau_lev[TauType::tau23]->array(mfi);
781 
782  Array4<Real> tau13_corr = Tau_corr_lev[0]->array(mfi);
783  Array4<Real> tau23_corr = Tau_corr_lev[1]->array(mfi);
784 
785  const int klo{0};
786  Box bx = mfi.tilebox();
787  bx.makeSlab(2,klo);
788  Box bxx = surroundingNodes(bx,0);
789  Box bxy = surroundingNodes(bx,1);
790 
791  ParallelFor(bxx, bxy,
792  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
793  tau13_corr(i,j,k) = tau13(i,j,k);
794  },
795  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
796  tau23_corr(i,j,k) = tau23(i,j,k);
797  });
798  }
799 }
@ tau23
Definition: ERF_DataStruct.H:51
@ tau11
Definition: ERF_DataStruct.H:51
@ tau13
Definition: ERF_DataStruct.H:51
const int klo
Definition: ERF_InitCustomPert_KE.H:9
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);})
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
Here is the call graph for this function:

◆ erf_make_tau_terms()

void erf_make_tau_terms ( int  level,
int  nrk,
const Vector< BCRec > &  domain_bcs_type_h,
const MultiFab &  z_phys_nd,
Vector< MultiFab > &  S_data,
const MultiFab &  xvel,
const MultiFab &  yvel,
const MultiFab &  zvel,
Vector< std::unique_ptr< MultiFab >> &  Tau_lev,
Vector< std::unique_ptr< MultiFab >> &  Tau_corr_lev,
MultiFab *  SmnSmn,
MultiFab *  eddyDiffs,
const Geometry  geom,
const SolverChoice &  solverChoice,
const amrex::Vector< std::unique_ptr< SurfaceLayer >> &  SurfLayer,
Gpu::DeviceVector< Real > &  stretched_dz_d,
const MultiFab &  detJ,
Vector< std::unique_ptr< MultiFab >> &  mapfac,
const MultiFab &  ax,
const MultiFab &  ay,
const MultiFab &  az,
const eb_ &  ebfact,
const MultiFab *  ib_wall_face13,
const MultiFab *  ib_wall_face23,
const MultiFab *  walldist 
)
35 {
36  BL_PROFILE_REGION("erf_make_tau_terms()");
37 
38  const BCRec* bc_ptr_h = domain_bcs_type_h.data();
39 
40  DiffChoice dc = solverChoice.diffChoice;
41  TurbChoice tc = solverChoice.turbChoice[level];
42 
43  const bool l_use_terrain_fitted_coords = (solverChoice.mesh_type != MeshType::ConstantDz);
44  const bool l_moving_terrain = (solverChoice.terrain_type == TerrainType::MovingFittedMesh);
45  if (l_moving_terrain) AMREX_ALWAYS_ASSERT (l_use_terrain_fitted_coords);
46 
47 
48  const bool l_use_diff = ( (dc.molec_diff_type != MolecDiffType::None) || tc.use_kturb );
49  const bool l_use_constAlpha = ( dc.molec_diff_type == MolecDiffType::ConstantAlpha );
50  const bool l_use_turb = ( tc.les_type == LESType::Smagorinsky ||
51  tc.les_type == LESType::Deardorff ||
52  tc.rans_type == RANSType::kEqn ||
53  tc.pbl_type == PBLType::MYJ ||
54  tc.pbl_type == PBLType::MYNN25 ||
55  tc.pbl_type == PBLType::MYNNEDMF ||
56  tc.pbl_type == PBLType::YSU ||
57  tc.pbl_type == PBLType::MRF);
58 
59  const bool need_SmnSmn = (tc.les_type == LESType::Deardorff ||
60  tc.rans_type == RANSType::kEqn);
61 
62  // k-eqn RANS, erf.rans_shear_stencil = log_law: the vertical shear in SmnSmn is the
63  // log-consistent one (ERF_LogShear.H), from the wall distance and the surface layer's z0
64  const bool l_log_shear = (tc.rans_type == RANSType::kEqn &&
65  tc.rans_shear_stencil == RANSShearStencil::log_law);
66  const MultiFab* z0_log_shear = nullptr;
67  if (l_log_shear) {
68  const auto& sl_zlo = SurfLayer[Orientation(Direction::z, Orientation::low)];
69  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(sl_zlo != nullptr && walldist != nullptr,
70  "erf.rans_shear_stencil = log_law needs zlo.type = surface_layer and the RANS wall distance");
71  z0_log_shear = sl_zlo->get_z0(level);
72  }
73 
74  const bool do_implicit = (solverChoice.vert_implicit_fac[level][nrk] > 0) && solverChoice.implicit_momentum_diffusion;
75  // erf.implicit_terrain_metric: the implicit solve also takes the compact terrain-metric
76  // term, so the explicit part it removes (Tau_corr) must hold it as well
77  const bool l_implicit_metric = do_implicit && solverChoice.implicit_terrain_metric;
78 
79  const Box& domain = geom.Domain();
80  const int domlo_z = domain.smallEnd(2);
81  const int domhi_z = domain.bigEnd(2);
82 
83  const GpuArray<Real, AMREX_SPACEDIM> dxInv = geom.InvCellSizeArray();
84 
85  // *****************************************************************************
86  // Pre-computed quantities
87  // *****************************************************************************
88  const BoxArray& ba = S_data[IntVars::cons].boxArray();
89  const DistributionMapping& dm = S_data[IntVars::cons].DistributionMap();
90 
91  std::unique_ptr<MultiFab> expr;
92 
93  if (l_use_diff) {
94  expr = std::make_unique<MultiFab>(ba, dm, 1, IntVect(1,1,1));
95 
96  // if using constant alpha (mu = rho * alpha), then first divide by the
97  // reference density -- mu_eff will be scaled by the instantaneous
98  // local density later when ComputeStress*Visc_*() is called
99  Real mu_eff = (l_use_constAlpha) ? two * dc.dynamic_viscosity / dc.rho0_trans
100  : two * dc.dynamic_viscosity;
101 
102  auto dz_ptr = stretched_dz_d.data();
103 
104 #ifdef _OPENMP
105 #pragma omp parallel if (Gpu::notInLaunchRegion())
106 #endif
107  for ( MFIter mfi(S_data[IntVars::cons],TileNoZ()); mfi.isValid(); ++mfi)
108  {
109  const Box& valid_bx = mfi.validbox();
110 
111  // Velocities
112  const Array4<const Real> & u = xvel.array(mfi);
113  const Array4<const Real> & v = yvel.array(mfi);
114  const Array4<const Real> & w = zvel.array(mfi);
115 
116  // Map factors
117  const Array4<const Real>& mf_mx = mapfac[MapFacType::m_x]->const_array(mfi);
118  const Array4<const Real>& mf_ux = mapfac[MapFacType::u_x]->const_array(mfi);
119  const Array4<const Real>& mf_vx = mapfac[MapFacType::v_x]->const_array(mfi);
120  const Array4<const Real>& mf_my = mapfac[MapFacType::m_y]->const_array(mfi);
121  const Array4<const Real>& mf_uy = mapfac[MapFacType::u_y]->const_array(mfi);
122  const Array4<const Real>& mf_vy = mapfac[MapFacType::v_y]->const_array(mfi);
123 
124  // Eddy viscosity
125  const Array4<Real const>& mu_turb = l_use_turb ? eddyDiffs->const_array(mfi) :
126  Array4<const Real>{};
127  const Array4<Real const>& cell_data = l_use_constAlpha ? S_data[IntVars::cons].const_array(mfi) :
128  Array4<const Real>{};
129 
130  // Terrain metrics
131  const Array4<const Real>& z_nd = z_phys_nd.const_array(mfi);
132  const Array4<const Real>& detJ_arr = detJ.const_array(mfi);
133 
134  // EB
135  Array4<const EBCellFlag> cflag{};
136  Array4<const Real> vfrac{};
137  Array4<const Real> apx{};
138  Array4<const Real> apy{};
139  Array4<const Real> apz{};
140  if (solverChoice.terrain_type == TerrainType::EB) {
141  auto const& eb_factory = ebfact.get_const_factory();
142  EBCellFlagFab const& cflag_fab = eb_factory->getMultiEBCellFlagFab()[mfi];
143  cflag = cflag_fab.const_array();
144  vfrac = eb_factory->getVolFrac().const_array(mfi);
145  if (cflag_fab.getType(valid_bx) == FabType::singlevalued) {
146  apx = eb_factory->getAreaFrac()[0]->const_array(mfi);
147  apy = eb_factory->getAreaFrac()[1]->const_array(mfi);
148  apz = eb_factory->getAreaFrac()[2]->const_array(mfi);
149  } else {
150  apx = ax.const_array(mfi);
151  apy = ay.const_array(mfi);
152  apz = az.const_array(mfi);
153  }
154  }
155 
156  //-------------------------------------------------------------------------------
157  // NOTE: Tile boxes with terrain are not intuitive. The linear combination of
158  // stress terms requires care. Create a tile box that intersects the
159  // valid box, then grow the box in x/y. Compute the strain on the local
160  // FAB over this grown tile box. Compute the stress over the tile box,
161  // except tau_ii which still needs the halo cells. Finally, write from
162  // the local FAB to the Tau MF but only on the tile box.
163  //-------------------------------------------------------------------------------
164 
165  //-------------------------------------------------------------------------------
166  // TODO: Avoid recomputing strain on the first RK stage. One could populate
167  // the FABs with tau_ij, compute stress, and then write to tau_ij. The
168  // problem with this approach is you will over-write the needed halo layer
169  // needed by subsequent tile boxes (particularly S_ii becomes Tau_ii).
170  //-------------------------------------------------------------------------------
171 
172  // Strain/Stress tile boxes
173  Box bx = mfi.tilebox();
174  Box bxcc = mfi.tilebox();
175  Box tbxxy = mfi.tilebox(IntVect(1,1,0));
176  Box tbxxz = mfi.tilebox(IntVect(1,0,1));
177  Box tbxyz = mfi.tilebox(IntVect(0,1,1));
178 
179  // We need a halo cell for terrain
180  bxcc.grow(IntVect(1,1,0));
181  tbxxy.grow(IntVect(1,1,0));
182  tbxxz.grow(IntVect(1,1,0));
183  tbxyz.grow(IntVect(1,1,0));
184 
185  if (bxcc.smallEnd(2) != domain.smallEnd(2)) {
186  bxcc.growLo(2,1);
187  tbxxy.growLo(2,1);
188  tbxxz.growLo(2,1);
189  tbxyz.growLo(2,1);
190  }
191 
192  if (bxcc.bigEnd(2) != domain.bigEnd(2)) {
193  bxcc.growHi(2,1);
194  tbxxy.growHi(2,1);
195  tbxxz.growHi(2,1);
196  tbxyz.growHi(2,1);
197  }
198 
199  // Expansion rate
200  Array4<Real> er_arr = expr->array(mfi);
201 
202  // Temporary storage for tiling/OMP
203  FArrayBox S11,S22,S33;
204  FArrayBox S12,S13,S23;
205 
206  // Symmetric strain/stresses
207  S11.resize( bxcc,1,The_Async_Arena()); S22.resize( bxcc,1,The_Async_Arena()); S33.resize( bxcc,1,The_Async_Arena());
208  S12.resize(tbxxy,1,The_Async_Arena()); S13.resize(tbxxz,1,The_Async_Arena()); S23.resize(tbxyz,1,The_Async_Arena());
209  Array4<Real> s11 = S11.array(); Array4<Real> s22 = S22.array(); Array4<Real> s33 = S33.array();
210  Array4<Real> s12 = S12.array(); Array4<Real> s13 = S13.array(); Array4<Real> s23 = S23.array();
211  Array4<Real> tau11 = Tau_lev[TauType::tau11]->array(mfi); Array4<Real> tau22 = Tau_lev[TauType::tau22]->array(mfi);
212  Array4<Real> tau33 = Tau_lev[TauType::tau33]->array(mfi); Array4<Real> tau12 = Tau_lev[TauType::tau12]->array(mfi);
213  Array4<Real> tau13 = Tau_lev[TauType::tau13]->array(mfi); Array4<Real> tau23 = Tau_lev[TauType::tau23]->array(mfi);
214 
215  // We cannot simply scale the tau3* terms since our implicit
216  // correction to vertical diffusion only applies to the
217  // second-order derivatives in the vertical and we don't want to
218  // touch the cross terms -- we save the terms here and
219  // manipulate them later.
220  FArrayBox S13_for_impl, S23_for_impl;
221  S13_for_impl.resize(tbxxz,1,The_Async_Arena());
222  S23_for_impl.resize(tbxyz,1,The_Async_Arena());
223  Array4<Real> s13_corr = (do_implicit) ? S13_for_impl.array() : Array4<Real>{};
224  Array4<Real> s23_corr = (do_implicit) ? S23_for_impl.array() : Array4<Real>{};
225  Array4<Real> tau13_corr = (do_implicit) ? Tau_corr_lev[0]->array(mfi) : Array4<Real>{};
226  Array4<Real> tau23_corr = (do_implicit) ? Tau_corr_lev[1]->array(mfi) : Array4<Real>{};
227 
228  // Calculate the magnitude of the strain-rate tensor squared if
229  // using Deardorff or k-eqn RANS. This contributes to the production
230  // term, included in diffusion source in slow RHS post and in the
231  // first RK stage (TKE tendencies constant for nrk>0, following WRF)
232  Array4<Real> SmnSmn_a = ((nrk==0) && need_SmnSmn) ? SmnSmn->array(mfi) : Array4<Real>{};
233 
234  // ****************************************************************
235  //
236  // These are the steps taken below...
237  //
238  // 1. Calculate expansion rate
239  // - will be added to the normal strain rates in ComputeStress
240  //
241  // 2. Call ComputeStrain
242  // - IMPLICIT path: s31_corr and s32_corr are modified in here
243  //
244  // 3. Call ComputeSmnSmn, if needed for turbulence model
245  //
246  // 4. Call ComputeStress
247  // - add expansion rates to terms on diagonal
248  // - multiply strain rates by diffusivities, with the total
249  // viscosity calculated as the sum of a constant viscosity (or
250  // constant alpha with mu = rho*alpha) and the eddy viscosity
251  // from the turbulence model
252  //
253  // 5. Copy temp Sij fabs into Tau_lev multifabs
254  // - stress tensor is symmetric if no terrain and no implicit diffusion
255  // - otherwise, stress tensor is asymmetric
256  //
257  // ****************************************************************
258 
259  if (solverChoice.mesh_type == MeshType::StretchedDz) {
260  // Terrain non-symmetric terms
261  FArrayBox S21,S31,S32;
262  S21.resize(tbxxy,1,The_Async_Arena()); S31.resize(tbxxz,1,The_Async_Arena()); S32.resize(tbxyz,1,The_Async_Arena());
263  Array4<Real> s21 = S21.array(); Array4<Real> s31 = S31.array(); Array4<Real> s32 = S32.array();
264  Array4<Real> tau21 = Tau_lev[TauType::tau21]->array(mfi);
265  Array4<Real> tau31 = Tau_lev[TauType::tau31]->array(mfi);
266  Array4<Real> tau32 = Tau_lev[TauType::tau32]->array(mfi);
267 
268  // *****************************************************************************
269  // Expansion rate compute terrain
270  // *****************************************************************************
271  {
272  BL_PROFILE("slow_rhs_making_er_S");
273  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
274  {
275  Real mfsq = mf_mx(i,j,0)*mf_my(i,j,0);
276  er_arr(i,j,k) = (u(i+1, j , k )/mf_uy(i+1,j,0) - u(i, j, k)/mf_uy(i,j,0))*dxInv[0] * mfsq + // == du / (dη/dy) * (1/dξ) * (dξ/dx)*(dη/dy) = du/dx
277  (v(i , j+1, k )/mf_vx(i,j+1,0) - v(i, j, k)/mf_vx(i,j,0))*dxInv[1] * mfsq + // == dv / (dξ/dx) * (1/dη) * (dξ/dx)*(dη/dy) = dv/dy
278  (w(i , j , k+1) - w(i, j, k) )/dz_ptr[k];
279  });
280  } // end profile
281 
282  // *****************************************************************************
283  // Strain tensor compute terrain
284  // *****************************************************************************
285  {
286  BL_PROFILE("slow_rhs_making_strain_S");
287  ComputeStrain_S(bxcc, tbxxy, tbxxz, tbxyz, domain,
288  u, v, w,
289  s11, s22, s33,
290  s12, s21,
291  s13, s31,
292  s23, s32,
293  stretched_dz_d, dxInv,
294  mf_mx, mf_ux, mf_vx,
295  mf_my, mf_uy, mf_vy, bc_ptr_h,
296  s13_corr, s23_corr);
297  } // end profile
298 
299  if (SmnSmn_a) {
300  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
301  {
302  SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k,
303  s11,s22,s33,
304  s12,s13,s23);
305  });
306  if (l_log_shear) {
307  log_shear::correct_box(bx, domain, SmnSmn_a, u, v, s13, s23,
308  walldist->const_array(mfi),
309  z0_log_shear->const_array(mfi), z_nd);
310  }
311  }
312 
313  // *****************************************************************************
314  // Stress tensor compute terrain
315  // *****************************************************************************
316  {
317  BL_PROFILE("slow_rhs_making_stress_T");
318 
319  // Remove Halo cells just for tau_ij comps
320  tbxxy.grow(IntVect(-1,-1,0));
321  tbxxz.grow(IntVect(-1,-1,0));
322  tbxyz.grow(IntVect(-1,-1,0));
323 
324  if (!l_use_turb) {
325  ComputeStressConsVisc_S(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
326  cell_data,
327  s11, s22, s33,
328  s12, s21,
329  s13, s31,
330  s23, s32,
331  er_arr,
332  mf_mx, mf_vx,
333  mf_my, mf_uy,
334  s13_corr, s23_corr);
335  } else {
336  ComputeStressVarVisc_S(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
337  cell_data,
338  s11, s22, s33,
339  s12, s21,
340  s13, s31,
341  s23, s32,
342  er_arr,
343  mf_mx, mf_vx,
344  mf_my, mf_uy,
345  s13_corr, s23_corr);
346  }
347 
348  // Remove halo cells from tau_ii but extend across valid_box bdry
349  bxcc.grow(IntVect(-1,-1,0));
350  if (bxcc.smallEnd(0) == valid_bx.smallEnd(0)) bxcc.growLo(0, 1);
351  if (bxcc.bigEnd(0) == valid_bx.bigEnd(0)) bxcc.growHi(0, 1);
352  if (bxcc.smallEnd(1) == valid_bx.smallEnd(1)) bxcc.growLo(1, 1);
353  if (bxcc.bigEnd(1) == valid_bx.bigEnd(1)) bxcc.growHi(1, 1);
354 
355  // Copy from temp FABs back to tau
356  ParallelFor(bxcc,
357  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
358  tau11(i,j,k) = s11(i,j,k);
359  tau22(i,j,k) = s22(i,j,k);
360  tau33(i,j,k) = s33(i,j,k);
361  });
362 
363  ParallelFor(tbxxy, tbxxz, tbxyz,
364  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
365  tau12(i,j,k) = s12(i,j,k);
366  tau21(i,j,k) = s21(i,j,k);
367  },
368  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
369  tau13(i,j,k) = s13(i,j,k);
370  tau31(i,j,k) = s31(i,j,k);
371  if (tau13_corr) tau13_corr(i,j,k) = s13_corr(i,j,k);
372  },
373  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
374  tau23(i,j,k) = s23(i,j,k);
375  tau32(i,j,k) = s32(i,j,k);
376  if (tau23_corr) tau23_corr(i,j,k) = s23_corr(i,j,k);
377  });
378  } // end profile
379 
380  } else if (l_use_terrain_fitted_coords) {
381 
382  // Terrain non-symmetric terms
383  FArrayBox S21,S31,S32;
384  S21.resize(tbxxy,1,The_Async_Arena()); S31.resize(tbxxz,1,The_Async_Arena()); S32.resize(tbxyz,1,The_Async_Arena());
385  Array4<Real> s21 = S21.array(); Array4<Real> s31 = S31.array(); Array4<Real> s32 = S32.array();
386  Array4<Real> tau21 = Tau_lev[TauType::tau21]->array(mfi);
387  Array4<Real> tau31 = Tau_lev[TauType::tau31]->array(mfi);
388  Array4<Real> tau32 = Tau_lev[TauType::tau32]->array(mfi);
389 
390 
391  // *****************************************************************************
392  // Expansion rate compute terrain
393  // *****************************************************************************
394  {
395  BL_PROFILE("slow_rhs_making_er_T");
396  Box gbxo = surroundingNodes(bxcc,2);
397 
398  // We make a temporary container for contravariant velocity Omega here
399  // -- it is only used to compute er_arr below
400  FArrayBox Omega;
401  Omega.resize(gbxo,1,The_Async_Arena());
402 
403  // First create Omega using velocity (not momentum)
404  Array4<Real> omega_arr = Omega.array();
405  // On a moving surface, OmegaFromW at k = 0 is the surface velocity z_t, not zero
406  const bool l_moving_surface = (solverChoice.terrain_type == TerrainType::MovingFittedMesh);
407  ParallelFor(gbxo, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
408  {
409  omega_arr(i,j,k) = (k == 0 && !l_moving_surface) ? zero : OmegaFromW(i,j,k,w(i,j,k),u,v,
410  mf_ux,mf_vy,z_nd,dxInv);
411  });
412 
413  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
414  {
415 
416  Real met_u_h_zeta_hi = Compute_h_zeta_AtIface(i+1, j , k, dxInv, z_nd);
417  Real met_u_h_zeta_lo = Compute_h_zeta_AtIface(i , j , k, dxInv, z_nd);
418 
419  Real met_v_h_zeta_hi = Compute_h_zeta_AtJface(i , j+1, k, dxInv, z_nd);
420  Real met_v_h_zeta_lo = Compute_h_zeta_AtJface(i , j , k, dxInv, z_nd);
421 
422  Real Omega_hi = omega_arr(i,j,k+1);
423  Real Omega_lo = omega_arr(i,j,k );
424 
425  Real mfsq = mf_mx(i,j,0)*mf_my(i,j,0);
426 
427  Real expansionRate = (u(i+1,j ,k)/mf_uy(i+1,j,0)*met_u_h_zeta_hi - u(i,j,k)/mf_uy(i,j,0)*met_u_h_zeta_lo)*dxInv[0]*mfsq +
428  (v(i ,j+1,k)/mf_vx(i,j+1,0)*met_v_h_zeta_hi - v(i,j,k)/mf_vx(i,j,0)*met_v_h_zeta_lo)*dxInv[1]*mfsq +
429  (Omega_hi - Omega_lo)*dxInv[2];
430 
431  er_arr(i,j,k) = expansionRate / detJ_arr(i,j,k);
432 
433  // Note:
434  // expansionRate ~ du / (dη/dy) * (dz/dζ) * (1/dξ) * (dξ/dx)*(dη/dy)
435  // + dv / (dξ/dx) * (dz/dζ) * (1/dη) * (dξ/dx)*(dη/dy)
436  // + dΩ/dζ
437  // ~ (du/dx)*(dz/dζ) + (dv/dy)*(dz/dζ) + dΩ/dζ
438  // Dividing by detJ==dz/dζ gives du/dx + dv/dy + dΩ/dz
439  });
440  } // end profile
441 
442  // *****************************************************************************
443  // Strain tensor compute terrain
444  // *****************************************************************************
445  {
446  BL_PROFILE("slow_rhs_making_strain_T");
447  ComputeStrain_T(bxcc, tbxxy, tbxxz, tbxyz, domain,
448  u, v, w,
449  s11, s22, s33,
450  s12, s21,
451  s13, s31,
452  s23, s32,
453  z_nd, detJ_arr, dxInv,
454  mf_mx, mf_ux, mf_vx,
455  mf_my, mf_uy, mf_vy, bc_ptr_h,
456  s13_corr, s23_corr);
457  } // end profile
458 
459  if (SmnSmn_a) {
460  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
461  {
462  SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k,
463  s11,s22,s33,
464  s12,s13,s23);
465  });
466  if (l_log_shear) {
467  log_shear::correct_box(bx, domain, SmnSmn_a, u, v, s13, s23,
468  walldist->const_array(mfi),
469  z0_log_shear->const_array(mfi), z_nd);
470  }
471  }
472 
473  // *****************************************************************************
474  // Stress tensor compute terrain
475  // *****************************************************************************
476  {
477  BL_PROFILE("slow_rhs_making_stress_T");
478 
479  // Remove Halo cells just for tau_ij comps
480  tbxxy.grow(IntVect(-1,-1,0));
481  tbxxz.grow(IntVect(-1,-1,0));
482  tbxyz.grow(IntVect(-1,-1,0));
483 
484  if (!l_use_turb) {
485  ComputeStressConsVisc_T(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
486  cell_data,
487  s11, s22, s33,
488  s12, s21,
489  s13, s31,
490  s23, s32,
491  er_arr, z_nd, detJ_arr, dxInv,
492  mf_mx, mf_ux, mf_vx,
493  mf_my, mf_uy, mf_vy,
494  s13_corr, s23_corr,
495  l_implicit_metric);
496  } else {
497  ComputeStressVarVisc_T(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
498  cell_data,
499  s11, s22, s33,
500  s12, s21,
501  s13, s31,
502  s23, s32,
503  er_arr, z_nd, detJ_arr, dxInv,
504  mf_mx, mf_ux, mf_vx,
505  mf_my, mf_uy, mf_vy,
506  s13_corr, s23_corr,
507  l_implicit_metric);
508  }
509 
510  // Remove halo cells from tau_ii but extend across valid_box bdry
511  bxcc.grow(IntVect(-1,-1,0));
512  if (bxcc.smallEnd(0) == valid_bx.smallEnd(0)) bxcc.growLo(0, 1);
513  if (bxcc.bigEnd(0) == valid_bx.bigEnd(0)) bxcc.growHi(0, 1);
514  if (bxcc.smallEnd(1) == valid_bx.smallEnd(1)) bxcc.growLo(1, 1);
515  if (bxcc.bigEnd(1) == valid_bx.bigEnd(1)) bxcc.growHi(1, 1);
516 
517  // Copy from temp FABs back to tau
518  ParallelFor(bxcc,
519  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
520  tau11(i,j,k) = s11(i,j,k);
521  tau22(i,j,k) = s22(i,j,k);
522  tau33(i,j,k) = s33(i,j,k);
523  });
524 
525  ParallelFor(tbxxy, tbxxz, tbxyz,
526  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
527  tau12(i,j,k) = s12(i,j,k);
528  tau21(i,j,k) = s21(i,j,k);
529  },
530  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
531  tau13(i,j,k) = s13(i,j,k);
532  tau31(i,j,k) = s31(i,j,k);
533  if(tau13_corr) tau13_corr(i,j,k) = s13_corr(i,j,k);
534  },
535  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
536  tau23(i,j,k) = s23(i,j,k);
537  tau32(i,j,k) = s32(i,j,k);
538  if(tau23_corr) tau23_corr(i,j,k) = s23_corr(i,j,k);
539  });
540  } // end profile
541 
542  } else {
543 
544  // *****************************************************************************
545  // Expansion rate compute no terrain
546  // *****************************************************************************
547  {
548  BL_PROFILE("slow_rhs_making_er_N");
549  if (solverChoice.terrain_type != TerrainType::EB) {
550  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
551  Real mfsq = mf_mx(i,j,0)*mf_my(i,j,0);
552  er_arr(i,j,k) = (u(i+1, j , k )/mf_uy(i+1,j,0) - u(i, j, k)/mf_uy(i,j,0))*dxInv[0]*mfsq +
553  (v(i , j+1, k )/mf_vx(i,j+1,0) - v(i, j, k)/mf_vx(i,j,0))*dxInv[1]*mfsq +
554  (w(i , j , k+1) - w(i, j, k))*dxInv[2];
555  });
556  } else {
557  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
558  if (cflag(i,j,k).isSingleValued()) {
559  er_arr(i,j,k) = (one/vfrac(i,j,k)) * (
560  dxInv[0] * ( apx(i+1,j,k)*u(i+1,j,k) - apx(i,j,k)*u(i,j,k) )
561  + dxInv[1] * ( apy(i,j+1,k)*v(i,j+1,k) - apy(i,j,k)*v(i,j,k) )
562  + dxInv[2] * ( apz(i,j,k+1)*w(i,j,k+1) - apz(i,j,k)*w(i,j,k) ) );
563  } else if (cflag(i,j,k).isRegular()) {
564  er_arr(i,j,k) = (u(i+1, j , k ) - u(i, j, k))*dxInv[0] +
565  (v(i , j+1, k ) - v(i, j, k))*dxInv[1] +
566  (w(i , j , k+1) - w(i, j, k))*dxInv[2];
567  } else {
568  er_arr(i,j,k) = zero;
569  }
570  });
571  }
572  } // end profile
573 
574  // *****************************************************************************
575  // Strain tensor compute no terrain
576  // *****************************************************************************
577  {
578  BL_PROFILE("slow_rhs_making_strain_N");
579  if (solverChoice.terrain_type != TerrainType::EB) {
580  ComputeStrain_N(bxcc, tbxxy, tbxxz, tbxyz, domain,
581  u, v, w,
582  s11, s22, s33,
583  s12, s13, s23,
584  dxInv,
585  mf_mx, mf_ux, mf_vx,
586  mf_my, mf_uy, mf_vy, bc_ptr_h,
587  s13_corr, s23_corr);
588  } else {
589  ComputeStrain_EB(mfi, bxcc, tbxxy, tbxxz, tbxyz, domain,
590  u, v, w,
591  s11, s22, s33,
592  s12, s13, s23,
593  dxInv,
594  bc_ptr_h,
595  ebfact,
596  s13_corr, s23_corr);
597  }
598  } // end profile
599 
600  // Fraction-stress immersed wall law: the strain on the bottom face of the wall cell is
601  // the strain on the face above, as on the zlo face of flat ground, whose hoextrap ghost
602  // (2 u_0 - u_1) gives the first cell the gradient of the face above. The TKE production
603  // of the wall cell then does not see the solid below as a no-slip wall. (The stress on
604  // that face is zeroed below: the wall law supplies it.) One wall face per column, and
605  // the face above is never one, so the copy has no read/write overlap. The copy comes
606  // first, so the wall face carries the unscaled strain; the face above the wall cell
607  // is then scaled by the spacing factor of erf.if_wall_face_spacing.
608  if (ib_wall_face13 && ib_wall_face23) {
609  auto const m13 = ib_wall_face13->const_array(mfi);
610  auto const m23 = ib_wall_face23->const_array(mfi);
611  Box xz = tbxxz & ib_wall_face13->fabbox(mfi.index()); xz.growHi(2, -1);
612  Box yz = tbxyz & ib_wall_face23->fabbox(mfi.index()); yz.growHi(2, -1);
613  const Box xz_all = tbxxz & ib_wall_face13->fabbox(mfi.index());
614  const Box yz_all = tbxyz & ib_wall_face23->fabbox(mfi.index());
615  ParallelFor(xz, yz,
616  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
617  if (m13(i,j,k) == zero) {
618  s13(i,j,k) = s13(i,j,k+1);
619  if (s13_corr) s13_corr(i,j,k) = s13_corr(i,j,k+1);
620  }
621  },
622  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
623  if (m23(i,j,k) == zero) {
624  s23(i,j,k) = s23(i,j,k+1);
625  if (s23_corr) s23_corr(i,j,k) = s23_corr(i,j,k+1);
626  }
627  });
628  ParallelFor(xz_all, yz_all,
629  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
630  if (m13(i,j,k) != zero) {
631  s13(i,j,k) *= m13(i,j,k);
632  if (s13_corr) s13_corr(i,j,k) *= m13(i,j,k);
633  }
634  },
635  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
636  if (m23(i,j,k) != zero) {
637  s23(i,j,k) *= m23(i,j,k);
638  if (s23_corr) s23_corr(i,j,k) *= m23(i,j,k);
639  }
640  });
641  }
642 
643  if (SmnSmn_a) {
644  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
645  {
646  SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k,
647  s11,s22,s33,
648  s12,s13,s23);
649  });
650  if (l_log_shear) {
651  log_shear::correct_box(bx, domain, SmnSmn_a, u, v, s13, s23,
652  walldist->const_array(mfi),
653  z0_log_shear->const_array(mfi), z_nd);
654  }
655  }
656 
657  // *****************************************************************************
658  // Stress tensor compute no terrain
659  // *****************************************************************************
660  {
661  BL_PROFILE("slow_rhs_making_stress_N");
662 
663  // Remove Halo cells just for tau_ij comps
664  tbxxy.grow(IntVect(-1,-1,0));
665  tbxxz.grow(IntVect(-1,-1,0));
666  tbxyz.grow(IntVect(-1,-1,0));
667  if (tbxxy.smallEnd(2) > domlo_z) {
668  tbxxy.growLo(2,-1);
669  tbxxz.growLo(2,-1);
670  tbxyz.growLo(2,-1);
671  }
672  if (tbxxy.bigEnd(2) < domhi_z) {
673  tbxxy.growHi(2,-1);
674  tbxxz.growHi(2,-1);
675  tbxyz.growHi(2,-1);
676  }
677 
678  if (!l_use_turb) {
679  if (solverChoice.terrain_type != TerrainType::EB) {
680  ComputeStressConsVisc_N(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
681  cell_data,
682  s11, s22, s33,
683  s12, s13, s23,
684  er_arr,
685  s13_corr, s23_corr);
686  } else {
687  ComputeStressConsVisc_EB(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
688  cell_data,
689  s11, s22, s33,
690  s12, s13, s23,
691  er_arr,
692  vfrac,
693  s13_corr, s23_corr);
694  }
695  } else {
696  if (solverChoice.terrain_type != TerrainType::EB) {
697  ComputeStressVarVisc_N(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
698  cell_data,
699  s11, s22, s33,
700  s12, s13, s23,
701  er_arr,
702  s13_corr, s23_corr);
703  } else {
704  ComputeStressVarVisc_EB(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
705  cell_data,
706  s11, s22, s33,
707  s12, s13, s23,
708  er_arr,
709  vfrac,
710  s13_corr, s23_corr);
711  }
712  }
713 
714  // Remove halo cells from tau_ii but extend across valid_box bdry
715  bxcc.grow(IntVect(-1,-1,0));
716  if (bxcc.smallEnd(0) == valid_bx.smallEnd(0)) bxcc.growLo(0, 1);
717  if (bxcc.bigEnd(0) == valid_bx.bigEnd(0)) bxcc.growHi(0, 1);
718  if (bxcc.smallEnd(1) == valid_bx.smallEnd(1)) bxcc.growLo(1, 1);
719  if (bxcc.bigEnd(1) == valid_bx.bigEnd(1)) bxcc.growHi(1, 1);
720 
721  // Copy from temp FABs back to tau
722  ParallelFor(bxcc,
723  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
724  tau11(i,j,k) = s11(i,j,k);
725  tau22(i,j,k) = s22(i,j,k);
726  tau33(i,j,k) = s33(i,j,k);
727  });
728  ParallelFor(tbxxy, tbxxz, tbxyz,
729  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
730  tau12(i,j,k) = s12(i,j,k);
731  },
732  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
733  tau13(i,j,k) = s13(i,j,k);
734  if (tau13_corr) tau13_corr(i,j,k) = s13_corr(i,j,k);
735  },
736  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
737  tau23(i,j,k) = s23(i,j,k);
738  if (tau23_corr) tau23_corr(i,j,k) = s23_corr(i,j,k);
739  });
740 
741  // Fraction-stress immersed wall law: no resolved flux through the wall face,
742  // the wall stress is a source in the wall cell (ERF_ImmersedWallCell.H)
743  if (ib_wall_face13 && ib_wall_face23) {
744  auto const m13 = ib_wall_face13->const_array(mfi);
745  auto const m23 = ib_wall_face23->const_array(mfi);
746  const Box xz = tbxxz & ib_wall_face13->fabbox(mfi.index());
747  const Box yz = tbxyz & ib_wall_face23->fabbox(mfi.index());
748  ParallelFor(xz, yz,
749  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
750  // the strain carries the spacing factor already: only close the wall face
751  if (m13(i,j,k) == zero) {
752  tau13(i,j,k) = zero;
753  if (tau13_corr) tau13_corr(i,j,k) = zero;
754  }
755  },
756  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
757  if (m23(i,j,k) == zero) {
758  tau23(i,j,k) = zero;
759  if (tau23_corr) tau23_corr(i,j,k) = zero;
760  }
761  });
762  }
763  } // end profile
764  } // no terrain
765  } // MFIter
766  } // l_use_diff
767 }
void ComputeStrain_EB(const MFIter &mfi, Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Box domain, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const BCRec *bc_ptr, const eb_ &ebfact, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStrain_EB.cpp:31
void ComputeStrain_N(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Box domain, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, 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 BCRec *bc_ptr, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStrain_N.cpp:35
void ComputeStrain_S(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Box domain, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau21, Array4< Real > &tau13, Array4< Real > &tau31, Array4< Real > &tau23, Array4< Real > &tau32, const Gpu::DeviceVector< Real > &stretched_dz_d, 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 BCRec *bc_ptr, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStrain_S.cpp:40
void ComputeStrain_T(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Box domain, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau21, Array4< Real > &tau13, Array4< Real > &tau31, Array4< Real > &tau23, Array4< Real > &tau32, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, 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 BCRec *bc_ptr, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStrain_T.cpp:41
void ComputeStressConsVisc_EB(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const Array4< const Real > &er_arr, Array4< const Real > &vfrac, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStress_EB.cpp:26
void ComputeStressVarVisc_EB(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &mu_turb, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const Array4< const Real > &er_arr, Array4< const Real > &vfrac, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStress_EB.cpp:177
void ComputeStressVarVisc_N(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &mu_turb, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const Array4< const Real > &er_arr, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStress_N.cpp:121
void ComputeStressConsVisc_N(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const Array4< const Real > &er_arr, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStress_N.cpp:25
void ComputeStressConsVisc_S(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau21, Array4< Real > &tau13, Array4< Real > &tau31, Array4< Real > &tau23, Array4< Real > &tau32, const Array4< const Real > &er_arr, const Array4< const Real > &mf_mx, const Array4< const Real > &mf_vx, const Array4< const Real > &mf_my, const Array4< const Real > &mf_uy, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStress_S.cpp:33
void ComputeStressVarVisc_S(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &mu_turb, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau21, Array4< Real > &tau13, Array4< Real > &tau31, Array4< Real > &tau23, Array4< Real > &tau32, const Array4< const Real > &er_arr, const Array4< const Real > &mf_mx, const Array4< const Real > &mf_vx, const Array4< const Real > &mf_my, const Array4< const Real > &mf_uy, Array4< Real > &tau13i, Array4< Real > &tau23i)
Definition: ERF_ComputeStress_S.cpp:162
void ComputeStressVarVisc_T(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &mu_turb, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau21, Array4< Real > &tau13, Array4< Real > &tau31, Array4< Real > &tau23, Array4< Real > &tau32, const Array4< const Real > &er_arr, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, 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, Array4< Real > &tau13i, Array4< Real > &tau23i, const bool implicit_metric)
Definition: ERF_ComputeStress_T.cpp:404
void ComputeStressConsVisc_T(Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau21, Array4< Real > &tau13, Array4< Real > &tau31, Array4< Real > &tau23, Array4< Real > &tau32, const Array4< const Real > &er_arr, const Array4< const Real > &z_nd, const Array4< const Real > &detJ, 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, Array4< Real > &tau13i, Array4< Real > &tau23i, const bool implicit_metric)
Definition: ERF_ComputeStress_T.cpp:41
@ tau12
Definition: ERF_DataStruct.H:51
@ tau33
Definition: ERF_DataStruct.H:51
@ tau22
Definition: ERF_DataStruct.H:51
@ tau32
Definition: ERF_DataStruct.H:51
@ tau31
Definition: ERF_DataStruct.H:51
@ tau21
Definition: ERF_DataStruct.H:51
@ v_x
Definition: ERF_DataStruct.H:40
@ u_y
Definition: ERF_DataStruct.H:41
@ v_y
Definition: ERF_DataStruct.H:41
@ m_y
Definition: ERF_DataStruct.H:41
@ u_x
Definition: ERF_DataStruct.H:40
@ m_x
Definition: ERF_DataStruct.H:40
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeSmnSmn(int &i, int &j, int &k, const amrex::Array4< amrex::Real const > &tau11, const amrex::Array4< amrex::Real const > &tau22, const amrex::Array4< amrex::Real const > &tau33, const amrex::Array4< amrex::Real const > &tau12, const amrex::Array4< amrex::Real const > &tau13, const amrex::Array4< amrex::Real const > &tau23)
Definition: ERF_EddyViscosity.H:133
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:16
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(axis >=0 &&axis< AMREX_SPACEDIM, "prob.axis must be 0, 1 or 2")
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
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:281
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real OmegaFromW(int &i, int &j, int &k, amrex::Real w, const amrex::Array4< const amrex::Real > &u_arr, const amrex::Array4< const amrex::Real > &v_arr, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vy, const amrex::Array4< const amrex::Real > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:802
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:351
const std::unique_ptr< amrex::EBFArrayBoxFactory > & get_const_factory() const noexcept
Return the cell-centered EB factory.
Definition: ERF_EB.H:110
@ cons
Definition: ERF_IndexDefines.H:249
@ xvel
Definition: ERF_IndexDefines.H:232
@ zvel
Definition: ERF_IndexDefines.H:234
@ yvel
Definition: ERF_IndexDefines.H:233
void correct_box(const amrex::Box &bx, const amrex::Box &domain, const amrex::Array4< amrex::Real > &SmnSmn, const amrex::Array4< amrex::Real const > &u, const amrex::Array4< amrex::Real const > &v, const amrex::Array4< amrex::Real const > &s13, const amrex::Array4< amrex::Real const > &s23, const amrex::Array4< amrex::Real const > &d, const amrex::Array4< amrex::Real const > &z0, const amrex::Array4< amrex::Real const > &z_nd)
Definition: ERF_LogShear.H:169
Definition: ERF_DiffStruct.H:25
MolecDiffType molec_diff_type
Selected molecular transport model.
Definition: ERF_DiffStruct.H:97
amrex::Real dynamic_viscosity
Dynamic viscosity for momentum diffusion [kg/(m-s)].
Definition: ERF_DiffStruct.H:109
amrex::Real rho0_trans
Reference density used to compute dynamic diffusion coefficients [kg/m3].
Definition: ERF_DiffStruct.H:104
amrex::Vector< TurbChoice > turbChoice
Turbulence options for each AMR level.
Definition: ERF_DataStruct.H:3020
static MeshType mesh_type
Vertical mesh representation.
Definition: ERF_DataStruct.H:3004
amrex::Vector< amrex::Vector< amrex::Real > > vert_implicit_fac
Per-level, per-stage implicit vertical diffusion factors.
Definition: ERF_DataStruct.H:3058
bool implicit_terrain_metric
Whether the compact terrain-metric part of the vertical diffusion is solved implicitly.
Definition: ERF_DataStruct.H:3068
static TerrainType terrain_type
Terrain or immersed-boundary representation.
Definition: ERF_DataStruct.H:2989
DiffChoice diffChoice
Diffusion-related options.
Definition: ERF_DataStruct.H:3017
bool implicit_momentum_diffusion
Whether implicit vertical momentum diffusion is included.
Definition: ERF_DataStruct.H:3064
Definition: ERF_TurbStruct.H:129
RANSType rans_type
Selected RANS closure.
Definition: ERF_TurbStruct.H:960
RANSShearStencil rans_shear_stencil
Definition: ERF_TurbStruct.H:994
LESType les_type
Selected LES closure.
Definition: ERF_TurbStruct.H:909
bool use_kturb
Whether any turbulence model is active.
Definition: ERF_TurbStruct.H:1061
PBLType pbl_type
Selected PBL closure.
Definition: ERF_TurbStruct.H:1003

Referenced by erf_slow_rhs_pre().

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