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)
 

Function Documentation

◆ getRhoAlphaForFaces()

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 does not include the factor of 2, because the u/v correction strains 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)
30 {
31  if (l_consA && l_turb) {
32  rhoAlpha_lo = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
33  + cell_data(i,j,k-1,Rho_comp ) + cell_data(i-ioff,j-joff,k-1,Rho_comp ) ) * mu_eff
34  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
35  + mu_turb(i,j,k-1,eddy_comp) + mu_turb(i-ioff,j-joff,k-1,eddy_comp) );
36  rhoAlpha_hi = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
37  + cell_data(i,j,k+1,Rho_comp ) + cell_data(i-ioff,j-joff,k+1,Rho_comp ) ) * mu_eff
38  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
39  + mu_turb(i,j,k+1,eddy_comp) + mu_turb(i-ioff,j-joff,k+1,eddy_comp) );
40  }
41  else if (l_turb) // with MolecDiffType::Constant or None
42  {
43  rhoAlpha_lo = mu_eff
44  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
45  + mu_turb(i,j,k-1,eddy_comp) + mu_turb(i-ioff,j-joff,k-1,eddy_comp) );
46  rhoAlpha_hi = mu_eff
47  + fourth * ( mu_turb(i,j,k ,eddy_comp) + mu_turb(i-ioff,j-joff,k ,eddy_comp)
48  + mu_turb(i,j,k+1,eddy_comp) + mu_turb(i-ioff,j-joff,k+1,eddy_comp) );
49  }
50  else if (l_consA) // without an LES/PBL model
51  {
52  rhoAlpha_lo = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
53  + cell_data(i,j,k-1,Rho_comp ) + cell_data(i-ioff,j-joff,k-1,Rho_comp ) ) * mu_eff;
54  rhoAlpha_hi = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
55  + cell_data(i,j,k+1,Rho_comp ) + cell_data(i-ioff,j-joff,k+1,Rho_comp ) ) * mu_eff;
56  }
57  else // with MolecDiffType::Constant or None - without an LES/PBL model
58  {
59  rhoAlpha_lo = mu_eff;
60  rhoAlpha_hi = mu_eff;
61  }
62 }
#define Rho_comp
Definition: ERF_IndexDefines.H:53
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: