ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_GetRhoAlphaForFaces.H File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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, const int eddy_comp=EddyDiff::Mom_v)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void getRhoAlphaForFaces (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 mu_eff, bool l_consA, bool l_turb)
 

Function Documentation

◆ getRhoAlphaForFaces() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void getRhoAlphaForFaces ( 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  mu_eff,
bool  l_consA,
bool  l_turb 
)

Return rhoAlpha at cell centers below and above a z-staggered face.

Parameters
[in]iface i-index
[in]jface j-index
[in]kface k-index
[out]rhoAlpha_lorhoAlpha below the face
[out]rhoAlpha_hirhoAlpha above the face
[in]cell_dataconserved cell-centered state
[in]mu_turbturbulent viscosity
[in]mu_effeffective molecular viscosity. NOTE: unlike the mu_eff in ERF_MakeTauTerms.cpp and ComputeStress*, this includes the factor of 2 only for the w (diagonal) correction stress, because the u/v (off-diagonal) correction strains already carry a factor of 1/2.
[in]l_consAflag for conservative constant-alpha diffusion
[in]l_turbflag for turbulent diffusion
90 {
91  if (l_consA && l_turb) {
92  rhoAlpha_lo = cell_data(i,j,k-1,Rho_comp) * mu_eff
93  + mu_turb(i,j,k-1,EddyDiff::Mom_v);
94  rhoAlpha_hi = cell_data(i,j,k ,Rho_comp) * mu_eff
95  + mu_turb(i,j,k ,EddyDiff::Mom_v);
96  }
97  else if (l_turb) // with MolecDiffType::Constant or None
98  {
99  rhoAlpha_lo = mu_eff + mu_turb(i,j,k-1,EddyDiff::Mom_v);
100  rhoAlpha_hi = mu_eff + mu_turb(i,j,k ,EddyDiff::Mom_v);
101  }
102  else if (l_consA) // without an LES/PBL model
103  {
104  rhoAlpha_lo = cell_data(i,j,k-1,Rho_comp) * mu_eff;
105  rhoAlpha_hi = cell_data(i,j,k ,Rho_comp) * mu_eff;
106  }
107  else // with MolecDiffType::Constant or None - without an LES/PBL model
108  {
109  rhoAlpha_lo = mu_eff;
110  rhoAlpha_hi = mu_eff;
111  }
112 }
#define Rho_comp
Definition: ERF_IndexDefines.H:42
@ Mom_v
Definition: ERF_IndexDefines.H:252

◆ getRhoAlphaForFaces() [2/2]

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,
const int  eddy_comp = EddyDiff::Mom_v 
)

Average rhoAlpha from cell centers to lower and upper z-edges of staggered faces.

Parameters
[in]iface i-index
[in]jface j-index
[in]kface k-index
[in]ioffx-direction staggering offset
[in]joffy-direction staggering offset
[out]rhoAlpha_lorhoAlpha averaged to the lower z-edge
[out]rhoAlpha_hirhoAlpha averaged to the upper z-edge
[in]cell_dataconserved cell-centered state
[in]mu_turbturbulent viscosity
[in]mu_effeffective molecular viscosity. NOTE: unlike the mu_eff in ERF_MakeTauTerms.cpp and ComputeStress*, this includes the factor of 2 only for the w (diagonal) correction stress, because the u/v (off-diagonal) correction strains already carry a factor of 1/2.
[in]l_consAflag for conservative constant-alpha diffusion
[in]l_turbflag for turbulent diffusion
[in]eddy_compeddy-viscosity component to average (EddyDiff::Mom_v, or EddyDiff::Mom_h for the terrain-metric coefficient)
31 {
32  if (l_consA && l_turb) {
33  rhoAlpha_lo = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
34  + cell_data(i,j,k-1,Rho_comp ) + cell_data(i-ioff,j-joff,k-1,Rho_comp ) ) * mu_eff
35  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
36  + mu_turb(i,j,k-1,eddy_comp) + mu_turb(i-ioff,j-joff,k-1,eddy_comp) );
37  rhoAlpha_hi = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
38  + cell_data(i,j,k+1,Rho_comp ) + cell_data(i-ioff,j-joff,k+1,Rho_comp ) ) * mu_eff
39  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
40  + mu_turb(i,j,k+1,eddy_comp) + mu_turb(i-ioff,j-joff,k+1,eddy_comp) );
41  }
42  else if (l_turb) // with MolecDiffType::Constant or None
43  {
44  rhoAlpha_lo = mu_eff
45  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
46  + mu_turb(i,j,k-1,eddy_comp) + mu_turb(i-ioff,j-joff,k-1,eddy_comp) );
47  rhoAlpha_hi = mu_eff
48  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
49  + mu_turb(i,j,k+1,eddy_comp) + mu_turb(i-ioff,j-joff,k+1,eddy_comp) );
50  }
51  else if (l_consA) // without an LES/PBL model
52  {
53  rhoAlpha_lo = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
54  + cell_data(i,j,k-1,Rho_comp ) + cell_data(i-ioff,j-joff,k-1,Rho_comp ) ) * mu_eff;
55  rhoAlpha_hi = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
56  + cell_data(i,j,k+1,Rho_comp ) + cell_data(i-ioff,j-joff,k+1,Rho_comp ) ) * mu_eff;
57  }
58  else // with MolecDiffType::Constant or None - without an LES/PBL model
59  {
60  rhoAlpha_lo = mu_eff;
61  rhoAlpha_hi = mu_eff;
62  }
63 }
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:42

Referenced by ImplicitDiffForMomLU_N(), ImplicitDiffForMomLU_S(), and ImplicitDiffForMomLU_T().

Here is the caller graph for this function: