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)
 
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
87 {
88  if (l_consA && l_turb) {
89  rhoAlpha_lo = cell_data(i,j,k-1,Rho_comp) * mu_eff
90  + mu_turb(i,j,k-1,EddyDiff::Mom_v);
91  rhoAlpha_hi = cell_data(i,j,k ,Rho_comp) * mu_eff
92  + mu_turb(i,j,k ,EddyDiff::Mom_v);
93  }
94  else if (l_turb) // with MolecDiffType::Constant or None
95  {
96  rhoAlpha_lo = mu_eff + mu_turb(i,j,k-1,EddyDiff::Mom_v);
97  rhoAlpha_hi = mu_eff + mu_turb(i,j,k ,EddyDiff::Mom_v);
98  }
99  else if (l_consA) // without an LES/PBL model
100  {
101  rhoAlpha_lo = cell_data(i,j,k-1,Rho_comp) * mu_eff;
102  rhoAlpha_hi = cell_data(i,j,k ,Rho_comp) * mu_eff;
103  }
104  else // with MolecDiffType::Constant or None - without an LES/PBL model
105  {
106  rhoAlpha_lo = mu_eff;
107  rhoAlpha_hi = mu_eff;
108  }
109 }
#define Rho_comp
Definition: ERF_IndexDefines.H:36
@ Mom_v
Definition: ERF_IndexDefines.H:211

◆ 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 
)

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
28 {
29  if (l_consA && l_turb) {
30  rhoAlpha_lo = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
31  + cell_data(i,j,k-1,Rho_comp ) + cell_data(i-ioff,j-joff,k-1,Rho_comp ) ) * mu_eff
32  + fourth * ( mu_turb(i,j,k ,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k ,EddyDiff::Mom_v)
33  + mu_turb(i,j,k-1,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k-1,EddyDiff::Mom_v) );
34  rhoAlpha_hi = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
35  + cell_data(i,j,k+1,Rho_comp ) + cell_data(i-ioff,j-joff,k+1,Rho_comp ) ) * mu_eff
36  + fourth * ( mu_turb(i,j,k ,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k ,EddyDiff::Mom_v)
37  + mu_turb(i,j,k+1,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k+1,EddyDiff::Mom_v) );
38  }
39  else if (l_turb) // with MolecDiffType::Constant or None
40  {
41  rhoAlpha_lo = mu_eff
42  + fourth * ( mu_turb(i,j,k ,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k ,EddyDiff::Mom_v)
43  + mu_turb(i,j,k-1,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k-1,EddyDiff::Mom_v) );
44  rhoAlpha_hi = mu_eff
45  + fourth * ( mu_turb(i,j,k ,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k ,EddyDiff::Mom_v)
46  + mu_turb(i,j,k+1,EddyDiff::Mom_v) + mu_turb(i-ioff,j-joff,k+1,EddyDiff::Mom_v) );
47  }
48  else if (l_consA) // without an LES/PBL model
49  {
50  rhoAlpha_lo = fourth * ( cell_data(i,j,k ,Rho_comp ) + cell_data(i-ioff,j-joff,k ,Rho_comp )
51  + cell_data(i,j,k-1,Rho_comp ) + cell_data(i-ioff,j-joff,k-1,Rho_comp ) ) * mu_eff;
52  rhoAlpha_hi = 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  }
55  else // with MolecDiffType::Constant or None - without an LES/PBL model
56  {
57  rhoAlpha_lo = mu_eff;
58  rhoAlpha_hi = mu_eff;
59  }
60 }
constexpr amrex::Real fourth
Definition: ERF_Constants.H:14

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

Here is the caller graph for this function: