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 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, MultiFab *SmnSmn, MultiFab *eddyDiffs, const Geometry geom, const SolverChoice &solverChoice, std::unique_ptr< SurfaceLayer > &, Gpu::DeviceVector< Real > &stretched_dz_d, const MultiFab &detJ, Vector< std::unique_ptr< MultiFab >> &mapfac)
 

Function Documentation

◆ 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,
MultiFab *  SmnSmn,
MultiFab *  eddyDiffs,
const Geometry  geom,
const SolverChoice solverChoice,
std::unique_ptr< SurfaceLayer > &  ,
Gpu::DeviceVector< Real > &  stretched_dz_d,
const MultiFab &  detJ,
Vector< std::unique_ptr< MultiFab >> &  mapfac 
)
28 {
29  BL_PROFILE_REGION("erf_make_tau_terms()");
30 
31  const BCRec* bc_ptr_h = domain_bcs_type_h.data();
32 
33  DiffChoice dc = solverChoice.diffChoice;
34  TurbChoice tc = solverChoice.turbChoice[level];
35 
36  const bool l_use_terrain_fitted_coords = (solverChoice.mesh_type != MeshType::ConstantDz);
37  const bool l_moving_terrain = (solverChoice.terrain_type == TerrainType::MovingFittedMesh);
38  if (l_moving_terrain) AMREX_ALWAYS_ASSERT (l_use_terrain_fitted_coords);
39 
40 
41  const bool l_use_diff = ( (dc.molec_diff_type != MolecDiffType::None) || tc.use_kturb );
42  const bool l_use_constAlpha = ( dc.molec_diff_type == MolecDiffType::ConstantAlpha );
43  const bool l_use_turb = ( tc.les_type == LESType::Smagorinsky ||
44  tc.les_type == LESType::Deardorff ||
45  tc.rans_type == RANSType::kEqn ||
46  tc.pbl_type == PBLType::MYJ ||
47  tc.pbl_type == PBLType::MYNN25 ||
48  tc.pbl_type == PBLType::MYNNEDMF ||
49  tc.pbl_type == PBLType::YSU ||
50  tc.pbl_type == PBLType::MRF);
51 
52  const bool need_SmnSmn = (tc.les_type == LESType::Deardorff ||
53  tc.rans_type == RANSType::kEqn);
54 
55  const Real l_vert_implicit_fac = solverChoice.vert_implicit_fac[nrk];
56  const bool need_tau31_tau32 = (solverChoice.mesh_type == MeshType::StretchedDz ||
57  l_use_terrain_fitted_coords ||
58  l_vert_implicit_fac > 0);
59 
60  const Box& domain = geom.Domain();
61  const int domlo_z = domain.smallEnd(2);
62  const int domhi_z = domain.bigEnd(2);
63 
64  const GpuArray<Real, AMREX_SPACEDIM> dxInv = geom.InvCellSizeArray();
65 
66  // *****************************************************************************
67  // Pre-computed quantities
68  // *****************************************************************************
69  const BoxArray& ba = S_data[IntVars::cons].boxArray();
70  const DistributionMapping& dm = S_data[IntVars::cons].DistributionMap();
71 
72  std::unique_ptr<MultiFab> expr;
73 
74  if (l_use_diff) {
75  expr = std::make_unique<MultiFab>(ba, dm, 1, IntVect(1,1,1));
76 
77  // if using constant alpha (mu = rho * alpha), then first divide by the
78  // reference density -- mu_eff will be scaled by the instantaneous
79  // local density later when ComputeStress*Visc_*() is called
80  Real mu_eff = (l_use_constAlpha) ? 2.0 * dc.dynamic_viscosity / dc.rho0_trans
81  : 2.0 * dc.dynamic_viscosity;
82 
83  auto dz_ptr = stretched_dz_d.data();
84 
85 #ifdef _OPENMP
86 #pragma omp parallel if (Gpu::notInLaunchRegion())
87 #endif
88  for ( MFIter mfi(S_data[IntVars::cons],TileNoZ()); mfi.isValid(); ++mfi)
89  {
90  const Box& valid_bx = mfi.validbox();
91 
92  // Velocities
93  const Array4<const Real> & u = xvel.array(mfi);
94  const Array4<const Real> & v = yvel.array(mfi);
95  const Array4<const Real> & w = zvel.array(mfi);
96 
97  // Map factors
98  const Array4<const Real>& mf_mx = mapfac[MapFacType::m_x]->const_array(mfi);
99  const Array4<const Real>& mf_ux = mapfac[MapFacType::u_x]->const_array(mfi);
100  const Array4<const Real>& mf_vx = mapfac[MapFacType::v_x]->const_array(mfi);
101  const Array4<const Real>& mf_my = mapfac[MapFacType::m_y]->const_array(mfi);
102  const Array4<const Real>& mf_uy = mapfac[MapFacType::u_y]->const_array(mfi);
103  const Array4<const Real>& mf_vy = mapfac[MapFacType::v_y]->const_array(mfi);
104 
105  // Eddy viscosity
106  const Array4<Real const>& mu_turb = l_use_turb ? eddyDiffs->const_array(mfi) :
107  Array4<const Real>{};
108  const Array4<Real const>& cell_data = l_use_constAlpha ? S_data[IntVars::cons].const_array(mfi) :
109  Array4<const Real>{};
110 
111  // Terrain metrics
112  const Array4<const Real>& z_nd = z_phys_nd.const_array(mfi);
113  const Array4<const Real>& detJ_arr = detJ.const_array(mfi);
114 
115  //-------------------------------------------------------------------------------
116  // NOTE: Tile boxes with terrain are not intuitive. The linear combination of
117  // stress terms requires care. Create a tile box that intersects the
118  // valid box, then grow the box in x/y. Compute the strain on the local
119  // FAB over this grown tile box. Compute the stress over the tile box,
120  // except tau_ii which still needs the halo cells. Finally, write from
121  // the local FAB to the Tau MF but only on the tile box.
122  //-------------------------------------------------------------------------------
123 
124  //-------------------------------------------------------------------------------
125  // TODO: Avoid recomputing strain on the first RK stage. One could populate
126  // the FABs with tau_ij, compute stress, and then write to tau_ij. The
127  // problem with this approach is you will over-write the needed halo layer
128  // needed by subsequent tile boxes (particularly S_ii becomes Tau_ii).
129  //-------------------------------------------------------------------------------
130 
131  // Strain/Stress tile boxes
132  Box bx = mfi.tilebox();
133  Box bxcc = mfi.tilebox();
134  Box tbxxy = mfi.tilebox(IntVect(1,1,0));
135  Box tbxxz = mfi.tilebox(IntVect(1,0,1));
136  Box tbxyz = mfi.tilebox(IntVect(0,1,1));
137 
138  // We need a halo cell for terrain
139  bxcc.grow(IntVect(1,1,0));
140  tbxxy.grow(IntVect(1,1,0));
141  tbxxz.grow(IntVect(1,1,0));
142  tbxyz.grow(IntVect(1,1,0));
143 
144  if (bxcc.smallEnd(2) != domain.smallEnd(2)) {
145  bxcc.growLo(2,1);
146  tbxxy.growLo(2,1);
147  tbxxz.growLo(2,1);
148  tbxyz.growLo(2,1);
149  }
150 
151  if (bxcc.bigEnd(2) != domain.bigEnd(2)) {
152  bxcc.growHi(2,1);
153  tbxxy.growHi(2,1);
154  tbxxz.growHi(2,1);
155  tbxyz.growHi(2,1);
156  }
157 
158  // Expansion rate
159  Array4<Real> er_arr = expr->array(mfi);
160 
161  // Temporary storage for tiling/OMP
162  FArrayBox S11,S22,S33;
163  FArrayBox S12,S13,S23;
164  FArrayBox S21,S31,S32;
165 
166  // Symmetric strain/stresses
167  S11.resize( bxcc,1,The_Async_Arena()); S22.resize( bxcc,1,The_Async_Arena()); S33.resize( bxcc,1,The_Async_Arena());
168  S12.resize(tbxxy,1,The_Async_Arena()); S13.resize(tbxxz,1,The_Async_Arena()); S23.resize(tbxyz,1,The_Async_Arena());
169  Array4<Real> s11 = S11.array(); Array4<Real> s22 = S22.array(); Array4<Real> s33 = S33.array();
170  Array4<Real> s12 = S12.array(); Array4<Real> s13 = S13.array(); Array4<Real> s23 = S23.array();
171  Array4<Real> tau11 = Tau_lev[TauType::tau11]->array(mfi); Array4<Real> tau22 = Tau_lev[TauType::tau22]->array(mfi);
172  Array4<Real> tau33 = Tau_lev[TauType::tau33]->array(mfi); Array4<Real> tau12 = Tau_lev[TauType::tau12]->array(mfi);
173  Array4<Real> tau13 = Tau_lev[TauType::tau13]->array(mfi); Array4<Real> tau23 = Tau_lev[TauType::tau23]->array(mfi);
174 
175  // Terrain or implicit non-symmetric terms
176  Array4<Real> s21{}, s31{}, s32{};
177  Array4<Real> tau21{}, tau31{}, tau32{};
178  if (solverChoice.mesh_type == MeshType::StretchedDz ||
179  l_use_terrain_fitted_coords)
180  {
181  S21.resize(tbxxy,1,The_Async_Arena());
182  s21 = S21.array();
183  tau21 = Tau_lev[TauType::tau21]->array(mfi);
184  }
185  if (need_tau31_tau32)
186  {
187  S31.resize(tbxxz,1,The_Async_Arena());
188  S32.resize(tbxyz,1,The_Async_Arena());
189  s31 = S31.array();
190  s32 = S32.array();
191  tau31 = Tau_lev[TauType::tau31]->array(mfi);
192  tau32 = Tau_lev[TauType::tau32]->array(mfi);
193  }
194 
195  // Calculate strain-rate magnitude SmnSmn if using Deardorff or
196  // or k-eqn RANS (included in diffusion source in post) and in the
197  // first RK stage (TKE tendencies constant for nrk>0, following WRF)
198  Array4<Real> SmnSmn_a = ((nrk==0) && need_SmnSmn) ? SmnSmn->array(mfi) : Array4<Real>{};
199 
200  if (solverChoice.mesh_type == MeshType::StretchedDz) {
201  // *****************************************************************************
202  // Expansion rate compute terrain
203  // *****************************************************************************
204  {
205  BL_PROFILE("slow_rhs_making_er_S");
206  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
207  {
208  Real mfsq = mf_mx(i,j,0)*mf_my(i,j,0);
209  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 +
210  (v(i , j+1, k )/mf_vx(i,j+1,0) - v(i, j, k)/mf_vx(i,j,0))*dxInv[1]*mfsq +
211  (w(i , j , k+1) - w(i, j, k))/dz_ptr[k];
212  });
213  } // end profile
214 
215  // *****************************************************************************
216  // Strain tensor compute terrain
217  // *****************************************************************************
218  {
219  BL_PROFILE("slow_rhs_making_strain_S");
220  ComputeStrain_S(bx, bxcc, tbxxy, tbxxz, tbxyz, domain,
221  u, v, w,
222  s11, s22, s33,
223  s12, s21,
224  s13, s31,
225  s23, s32,
226  stretched_dz_d, dxInv,
227  mf_mx, mf_ux, mf_vx,
228  mf_my, mf_uy, mf_vy, bc_ptr_h,
229  SmnSmn_a,
230  l_vert_implicit_fac);
231  } // end profile
232 
233  // *****************************************************************************
234  // Stress tensor compute terrain
235  // *****************************************************************************
236  {
237  BL_PROFILE("slow_rhs_making_stress_T");
238 
239  // Remove Halo cells just for tau_ij comps
240  tbxxy.grow(IntVect(-1,-1,0));
241  tbxxz.grow(IntVect(-1,-1,0));
242  tbxyz.grow(IntVect(-1,-1,0));
243 
244  if (!l_use_turb) {
245  ComputeStressConsVisc_S(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
246  cell_data,
247  s11, s22, s33,
248  s12, s21,
249  s13, s31,
250  s23, s32,
251  er_arr,
252  mf_mx, mf_ux, mf_vx,
253  mf_my, mf_uy, mf_vy);
254  } else {
255  ComputeStressVarVisc_S(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
256  cell_data,
257  s11, s22, s33,
258  s12, s21,
259  s13, s31,
260  s23, s32,
261  er_arr,
262  mf_mx, mf_ux, mf_vx,
263  mf_my, mf_uy, mf_vy);
264  }
265 
266  // Remove halo cells from tau_ii but extend across valid_box bdry
267  bxcc.grow(IntVect(-1,-1,0));
268  if (bxcc.smallEnd(0) == valid_bx.smallEnd(0)) bxcc.growLo(0, 1);
269  if (bxcc.bigEnd(0) == valid_bx.bigEnd(0)) bxcc.growHi(0, 1);
270  if (bxcc.smallEnd(1) == valid_bx.smallEnd(1)) bxcc.growLo(1, 1);
271  if (bxcc.bigEnd(1) == valid_bx.bigEnd(1)) bxcc.growHi(1, 1);
272 
273  // Copy from temp FABs back to tau
274  ParallelFor(bxcc,
275  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
276  tau11(i,j,k) = s11(i,j,k);
277  tau22(i,j,k) = s22(i,j,k);
278  tau33(i,j,k) = s33(i,j,k);
279  });
280 
281  ParallelFor(tbxxy, tbxxz, tbxyz,
282  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
283  tau12(i,j,k) = s12(i,j,k);
284  tau21(i,j,k) = s21(i,j,k);
285  },
286  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
287  tau13(i,j,k) = s13(i,j,k);
288  tau31(i,j,k) = s31(i,j,k);
289  },
290  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
291  tau23(i,j,k) = s23(i,j,k);
292  tau32(i,j,k) = s32(i,j,k);
293  });
294  } // end profile
295 
296  } else if (l_use_terrain_fitted_coords) {
297  // *****************************************************************************
298  // Expansion rate compute terrain
299  // *****************************************************************************
300  {
301  BL_PROFILE("slow_rhs_making_er_T");
302  Box gbxo = surroundingNodes(bxcc,2);
303 
304  // We make a temporary container for contravariant velocity Omega here
305  // -- it is only used to compute er_arr below
306  FArrayBox Omega;
307  Omega.resize(gbxo,1,The_Async_Arena());
308 
309  // First create Omega using velocity (not momentum)
310  Array4<Real> omega_arr = Omega.array();
311  ParallelFor(gbxo, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
312  {
313  omega_arr(i,j,k) = (k == 0) ? 0. : OmegaFromW(i,j,k,w(i,j,k),u,v,
314  mf_ux,mf_vy,z_nd,dxInv);
315  });
316 
317  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
318  {
319 
320  Real met_u_h_zeta_hi = Compute_h_zeta_AtIface(i+1, j , k, dxInv, z_nd);
321  Real met_u_h_zeta_lo = Compute_h_zeta_AtIface(i , j , k, dxInv, z_nd);
322 
323  Real met_v_h_zeta_hi = Compute_h_zeta_AtJface(i , j+1, k, dxInv, z_nd);
324  Real met_v_h_zeta_lo = Compute_h_zeta_AtJface(i , j , k, dxInv, z_nd);
325 
326  Real Omega_hi = omega_arr(i,j,k+1);
327  Real Omega_lo = omega_arr(i,j,k );
328 
329  Real mfsq = mf_mx(i,j,0)*mf_my(i,j,0);
330 
331  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 +
332  (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 +
333  (Omega_hi - Omega_lo)*dxInv[2];
334 
335  er_arr(i,j,k) = expansionRate / detJ_arr(i,j,k);
336  });
337  } // end profile
338 
339  // *****************************************************************************
340  // Strain tensor compute terrain
341  // *****************************************************************************
342  {
343  BL_PROFILE("slow_rhs_making_strain_T");
344  ComputeStrain_T(bx, bxcc, tbxxy, tbxxz, tbxyz, domain,
345  u, v, w,
346  s11, s22, s33,
347  s12, s21,
348  s13, s31,
349  s23, s32,
350  z_nd, detJ_arr, dxInv,
351  mf_mx, mf_ux, mf_vx,
352  mf_my, mf_uy, mf_vy, bc_ptr_h,
353  SmnSmn_a,
354  l_vert_implicit_fac);
355  } // end profile
356 
357  // *****************************************************************************
358  // Stress tensor compute terrain
359  // *****************************************************************************
360  {
361  BL_PROFILE("slow_rhs_making_stress_T");
362 
363  // Remove Halo cells just for tau_ij comps
364  tbxxy.grow(IntVect(-1,-1,0));
365  tbxxz.grow(IntVect(-1,-1,0));
366  tbxyz.grow(IntVect(-1,-1,0));
367 
368  if (!l_use_turb) {
369  ComputeStressConsVisc_T(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
370  cell_data,
371  s11, s22, s33,
372  s12, s21,
373  s13, s31,
374  s23, s32,
375  er_arr, z_nd, detJ_arr, dxInv,
376  mf_mx, mf_ux, mf_vx,
377  mf_my, mf_uy, mf_vy);
378  } else {
379  ComputeStressVarVisc_T(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
380  cell_data,
381  s11, s22, s33,
382  s12, s21,
383  s13, s31,
384  s23, s32,
385  er_arr, z_nd, detJ_arr, dxInv,
386  mf_mx, mf_ux, mf_vx,
387  mf_my, mf_uy, mf_vy);
388  }
389 
390  // Remove halo cells from tau_ii but extend across valid_box bdry
391  bxcc.grow(IntVect(-1,-1,0));
392  if (bxcc.smallEnd(0) == valid_bx.smallEnd(0)) bxcc.growLo(0, 1);
393  if (bxcc.bigEnd(0) == valid_bx.bigEnd(0)) bxcc.growHi(0, 1);
394  if (bxcc.smallEnd(1) == valid_bx.smallEnd(1)) bxcc.growLo(1, 1);
395  if (bxcc.bigEnd(1) == valid_bx.bigEnd(1)) bxcc.growHi(1, 1);
396 
397  // Copy from temp FABs back to tau
398  ParallelFor(bxcc,
399  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
400  tau11(i,j,k) = s11(i,j,k);
401  tau22(i,j,k) = s22(i,j,k);
402  tau33(i,j,k) = s33(i,j,k);
403  });
404 
405  ParallelFor(tbxxy, tbxxz, tbxyz,
406  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
407  tau12(i,j,k) = s12(i,j,k);
408  tau21(i,j,k) = s21(i,j,k);
409  },
410  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
411  tau13(i,j,k) = s13(i,j,k);
412  tau31(i,j,k) = s31(i,j,k);
413  },
414  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
415  tau23(i,j,k) = s23(i,j,k);
416  tau32(i,j,k) = s32(i,j,k);
417  });
418  } // end profile
419 
420  } else {
421 
422  // *****************************************************************************
423  // Expansion rate compute no terrain
424  // *****************************************************************************
425  {
426  BL_PROFILE("slow_rhs_making_er_N");
427  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
428  Real mfsq = mf_mx(i,j,0)*mf_my(i,j,0);
429  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 +
430  (v(i , j+1, k )/mf_vx(i,j+1,0) - v(i, j, k)/mf_vx(i,j,0))*dxInv[1]*mfsq +
431  (w(i , j , k+1) - w(i, j, k))*dxInv[2];
432  });
433  } // end profile
434 
435 
436  // *****************************************************************************
437  // Strain tensor compute no terrain
438  // *****************************************************************************
439  {
440  BL_PROFILE("slow_rhs_making_strain_N");
441  ComputeStrain_N(bx, bxcc, tbxxy, tbxxz, tbxyz, domain,
442  u, v, w,
443  s11, s22, s33,
444  s12, /*s21,*/
445  s13, s31,
446  s23, s32,
447  dxInv,
448  mf_mx, mf_ux, mf_vx,
449  mf_my, mf_uy, mf_vy, bc_ptr_h,
450  SmnSmn_a,
451  l_vert_implicit_fac);
452  } // end profile
453 
454  // *****************************************************************************
455  // Stress tensor compute no terrain
456  // *****************************************************************************
457  {
458  BL_PROFILE("slow_rhs_making_stress_N");
459 
460  // Remove Halo cells just for tau_ij comps
461  tbxxy.grow(IntVect(-1,-1,0));
462  tbxxz.grow(IntVect(-1,-1,0));
463  tbxyz.grow(IntVect(-1,-1,0));
464  if (tbxxy.smallEnd(2) > domlo_z) {
465  tbxxy.growLo(2,-1);
466  tbxxz.growLo(2,-1);
467  tbxyz.growLo(2,-1);
468  }
469  if (tbxxy.bigEnd(2) < domhi_z) {
470  tbxxy.growHi(2,-1);
471  tbxxz.growHi(2,-1);
472  tbxyz.growHi(2,-1);
473  }
474 
475  if (!l_use_turb) {
476  ComputeStressConsVisc_N(bxcc, tbxxy, tbxxz, tbxyz, mu_eff,
477  cell_data,
478  s11, s22, s33,
479  s12, s13, s23,
480  er_arr);
481  } else {
482  ComputeStressVarVisc_N(bxcc, tbxxy, tbxxz, tbxyz, mu_eff, mu_turb,
483  cell_data,
484  s11, s22, s33,
485  s12, s13, s23,
486  er_arr);
487  }
488 
489  // Remove halo cells from tau_ii but extend across valid_box bdry
490  bxcc.grow(IntVect(-1,-1,0));
491  if (bxcc.smallEnd(0) == valid_bx.smallEnd(0)) bxcc.growLo(0, 1);
492  if (bxcc.bigEnd(0) == valid_bx.bigEnd(0)) bxcc.growHi(0, 1);
493  if (bxcc.smallEnd(1) == valid_bx.smallEnd(1)) bxcc.growLo(1, 1);
494  if (bxcc.bigEnd(1) == valid_bx.bigEnd(1)) bxcc.growHi(1, 1);
495 
496  // Copy from temp FABs back to tau
497  ParallelFor(bxcc,
498  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
499  tau11(i,j,k) = s11(i,j,k);
500  tau22(i,j,k) = s22(i,j,k);
501  tau33(i,j,k) = s33(i,j,k);
502  });
503  ParallelFor(tbxxy, tbxxz, tbxyz,
504  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
505  tau12(i,j,k) = s12(i,j,k);
506  },
507  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
508  tau13(i,j,k) = s13(i,j,k);
509  },
510  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
511  tau23(i,j,k) = s23(i,j,k);
512  });
513  } // end profile
514  } // l_use_terrain_fitted_coords
515  } // MFIter
516  } // l_use_diff
517 }
void ComputeStrain_N(Box bx, 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 > &, Array4< Real > &tau23, Array4< Real > &, 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 > &SmnSmn_a, const Real)
Definition: ERF_ComputeStrain_N.cpp:32
void ComputeStrain_S(Box bx, 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 > &SmnSmn_a, const Real)
Definition: ERF_ComputeStrain_S.cpp:38
void ComputeStrain_T(Box bx, 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 > &SmnSmn_a, const Real)
Definition: ERF_ComputeStrain_T.cpp:38
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)
Definition: ERF_ComputeStress_N.cpp:105
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)
Definition: ERF_ComputeStress_N.cpp:23
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_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)
Definition: ERF_ComputeStress_S.cpp:137
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_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)
Definition: ERF_ComputeStress_S.cpp:28
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)
Definition: ERF_ComputeStress_T.cpp:29
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)
Definition: ERF_ComputeStress_T.cpp:336
@ tau12
Definition: ERF_DataStruct.H:30
@ tau23
Definition: ERF_DataStruct.H:30
@ tau33
Definition: ERF_DataStruct.H:30
@ tau22
Definition: ERF_DataStruct.H:30
@ tau11
Definition: ERF_DataStruct.H:30
@ tau32
Definition: ERF_DataStruct.H:30
@ tau31
Definition: ERF_DataStruct.H:30
@ tau21
Definition: ERF_DataStruct.H:30
@ tau13
Definition: ERF_DataStruct.H:30
@ v_x
Definition: ERF_DataStruct.H:22
@ u_y
Definition: ERF_DataStruct.H:23
@ v_y
Definition: ERF_DataStruct.H:23
@ m_y
Definition: ERF_DataStruct.H:23
@ u_x
Definition: ERF_DataStruct.H:22
@ m_x
Definition: ERF_DataStruct.H:22
amrex::Real Real
Definition: ERF_ShocInterface.H:19
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_u, const amrex::Array4< const amrex::Real > &mf_v, const amrex::Array4< const amrex::Real > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:412
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:102
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:142
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
@ cons
Definition: ERF_IndexDefines.H:158
@ xvel
Definition: ERF_IndexDefines.H:141
@ zvel
Definition: ERF_IndexDefines.H:143
@ yvel
Definition: ERF_IndexDefines.H:142
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
static MeshType mesh_type
Definition: ERF_DataStruct.H:894
DiffChoice diffChoice
Definition: ERF_DataStruct.H:903
amrex::Vector< amrex::Real > vert_implicit_fac
Definition: ERF_DataStruct.H:919
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:905
static TerrainType terrain_type
Definition: ERF_DataStruct.H:885
Definition: ERF_TurbStruct.H:41
PBLType pbl_type
Definition: ERF_TurbStruct.H:390
RANSType rans_type
Definition: ERF_TurbStruct.H:387
LESType les_type
Definition: ERF_TurbStruct.H:345
bool use_kturb
Definition: ERF_TurbStruct.H:396

Referenced by erf_slow_rhs_pre().

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