ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ERF_EddyViscosity.H
Go to the documentation of this file.
1 /** \file ERF_EddyViscosity.H */
2 
3 #ifndef ERF_EDDY_VISCOSITY_H_
4 #define ERF_EDDY_VISCOSITY_H_
5 
6 #include <ERF_ABLMost.H>
7 #include <ERF_DataStruct.H>
8 #include <AMReX_BCRec.H>
9 
10 void
11 ComputeTurbulentViscosity (const amrex::MultiFab& xvel , const amrex::MultiFab& yvel ,
12  const amrex::MultiFab& Tau11, const amrex::MultiFab& Tau22, const amrex::MultiFab& Tau33,
13  const amrex::MultiFab& Tau12, const amrex::MultiFab& Tau13, const amrex::MultiFab& Tau23,
14  const amrex::MultiFab& cons_in, const amrex::MultiFab& wdist,
15  amrex::MultiFab& eddyViscosity,
16  amrex::MultiFab& Hfx1, amrex::MultiFab& Hfx2, amrex::MultiFab& Hfx3, amrex::MultiFab& Diss,
17  const amrex::Geometry& geom,
18  const amrex::MultiFab& mapfac_u, const amrex::MultiFab& mapfac_v,
19  const std::unique_ptr<amrex::MultiFab>& z_phys_nd,
20  const SolverChoice& solverChoice,
21  std::unique_ptr<ABLMost>& most,
22  const amrex::FArrayBox* z_0,
23  const bool& exp_most,
24  const bool& use_terrain_fitted_coords,
25  const bool& use_moisture,
26  int level,
27  const amrex::BCRec* bc_ptr,
28  bool vert_only = false);
29 
30 AMREX_GPU_DEVICE
31 AMREX_FORCE_INLINE
32 amrex::Real
33 ComputeSmnSmn (int& i, int& j, int& k,
34  const amrex::Array4<amrex::Real const>& tau11,
35  const amrex::Array4<amrex::Real const>& tau22,
36  const amrex::Array4<amrex::Real const>& tau33,
37  const amrex::Array4<amrex::Real const>& tau12,
38  const amrex::Array4<amrex::Real const>& tau13,
39  const amrex::Array4<amrex::Real const>& tau23,
40  const int& klo,
41  const bool& use_most,
42  const bool& exp_most)
43 {
44  // NOTES:
45  // - If ERF_EXPLICIT_MOST_STRESS is not used, then we do not use the
46  // strains lying on the bottom boundary with MOST. These values are
47  // corrupted with the reflect odd BC used to fill the ghost cells.
48  // - Neglecting the strains on the bottom boundary and using a one-
49  // sided average implies that the strains are equal at klo and klo+1.
50  // du/dz and dv/dz can be assumed to be equal through the first cell.
51  // However, whereas dw/dx = dw/dy = 0 on the surface, this is not true at
52  // klo+1. Therefore, the strains are not equal in general.
53  // - If ERF_EXPLICIT_MOST_STRESS _is_ used, then strains may be correctly
54  // evaluated at the surface and no assumptions are needed.
55  amrex::Real s13bar;
56  if (use_most && k==klo && !exp_most) {
57  s13bar = 0.5 * ( tau13(i , j , k+1) + tau13(i+1, j , k+1) );
58  }
59  else
60  {
61  s13bar = 0.25 * ( tau13(i , j , k ) + tau13(i , j , k+1)
62  + tau13(i+1, j , k ) + tau13(i+1, j , k+1) );
63  }
64 
65  amrex::Real s23bar;
66  if (use_most && k==klo && !exp_most) {
67  s23bar = 0.5 * ( tau23(i , j , k+1) + tau23(i , j+1, k+1) );
68  }
69  else
70  {
71  s23bar = 0.25 * ( tau23(i , j , k ) + tau23(i , j , k+1)
72  + tau23(i , j+1, k ) + tau23(i , j+1, k+1) );
73  }
74 
75  amrex::Real s11bar = tau11(i,j,k);
76  amrex::Real s22bar = tau22(i,j,k);
77  amrex::Real s33bar = tau33(i,j,k);
78  amrex::Real s12bar = 0.25 * ( tau12(i , j , k ) + tau12(i , j+1, k )
79  + tau12(i+1, j , k ) + tau12(i+1, j+1, k ) );
80 
81  amrex::Real SmnSmn = s11bar*s11bar + s22bar*s22bar + s33bar*s33bar
82  + 2.0*s12bar*s12bar + 2.0*s13bar*s13bar + 2.0*s23bar*s23bar;
83 
84  return SmnSmn;
85 }
86 #endif
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, const int &klo, const bool &use_most, const bool &exp_most)
Definition: ERF_EddyViscosity.H:33
void ComputeTurbulentViscosity(const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &Tau11, const amrex::MultiFab &Tau22, const amrex::MultiFab &Tau33, const amrex::MultiFab &Tau12, const amrex::MultiFab &Tau13, const amrex::MultiFab &Tau23, const amrex::MultiFab &cons_in, const amrex::MultiFab &wdist, amrex::MultiFab &eddyViscosity, amrex::MultiFab &Hfx1, amrex::MultiFab &Hfx2, amrex::MultiFab &Hfx3, amrex::MultiFab &Diss, const amrex::Geometry &geom, const amrex::MultiFab &mapfac_u, const amrex::MultiFab &mapfac_v, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const SolverChoice &solverChoice, std::unique_ptr< ABLMost > &most, const amrex::FArrayBox *z_0, const bool &exp_most, const bool &use_terrain_fitted_coords, const bool &use_moisture, int level, const amrex::BCRec *bc_ptr, bool vert_only=false)
@ xvel
Definition: ERF_IndexDefines.H:141
@ yvel
Definition: ERF_IndexDefines.H:142
Definition: ERF_DataStruct.H:86