ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_EddyViscosity.H File Reference
#include <ERF_ABLMost.H>
#include <ERF_DataStruct.H>
#include <AMReX_BCRec.H>
Include dependency graph for ERF_EddyViscosity.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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, 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 bool &exp_most, const bool &use_moisture, int level, const amrex::BCRec *bc_ptr, bool vert_only=false)
 
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)
 

Function Documentation

◆ ComputeSmnSmn()

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 
)
41 {
42  // NOTES:
43  // - If ERF_EXPLICIT_MOST_STRESS is not used, then we do not use the
44  // strains lying on the bottom boundary with MOST. These values are
45  // corrupted with the reflect odd BC used to fill the ghost cells.
46  // - Neglecting the strains on the bottom boundary and using a one-
47  // sided average implies that the strains are equal at klo and klo+1.
48  // du/dz and dv/dz can be assumed to be equal through the first cell.
49  // However, whereas dw/dx = dw/dy = 0 on the surface, this is not true at
50  // klo+1. Therefore, the strains are not equal in general.
51  // - If ERF_EXPLICIT_MOST_STRESS _is_ used, then strains may be correctly
52  // evaluated at the surface and no assumptions are needed.
53  amrex::Real s13bar;
54  if (use_most && k==klo && !exp_most) {
55  s13bar = 0.5 * ( tau13(i , j , k+1) + tau13(i+1, j , k+1) );
56  }
57  else
58  {
59  s13bar = 0.25 * ( tau13(i , j , k ) + tau13(i , j , k+1)
60  + tau13(i+1, j , k ) + tau13(i+1, j , k+1) );
61  }
62 
63  amrex::Real s23bar;
64  if (use_most && k==klo && !exp_most) {
65  s23bar = 0.5 * ( tau23(i , j , k+1) + tau23(i , j+1, k+1) );
66  }
67  else
68  {
69  s23bar = 0.25 * ( tau23(i , j , k ) + tau23(i , j , k+1)
70  + tau23(i , j+1, k ) + tau23(i , j+1, k+1) );
71  }
72 
73  amrex::Real s11bar = tau11(i,j,k);
74  amrex::Real s22bar = tau22(i,j,k);
75  amrex::Real s33bar = tau33(i,j,k);
76  amrex::Real s12bar = 0.25 * ( tau12(i , j , k ) + tau12(i , j+1, k )
77  + tau12(i+1, j , k ) + tau12(i+1, j+1, k ) );
78 
79  amrex::Real SmnSmn = s11bar*s11bar + s22bar*s22bar + s33bar*s33bar
80  + 2.0*s12bar*s12bar + 2.0*s13bar*s13bar + 2.0*s23bar*s23bar;
81 
82  return SmnSmn;
83 }

Referenced by ComputeTurbulentViscosityLES(), and erf_make_tau_terms().

Here is the caller graph for this function:

◆ ComputeTurbulentViscosity()

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,
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 bool &  exp_most,
const bool &  use_moisture,
int  level,
const amrex::BCRec *  bc_ptr,
bool  vert_only = false 
)