ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Thetav.H
Go to the documentation of this file.
1 #ifndef ERF_UTILS_THETAV_H_
2 #define ERF_UTILS_THETAV_H_
3 /*
4  * Calculate virtual potential temperature, returning potential temperature in
5  * the absence of moisture.
6  */
7 AMREX_GPU_DEVICE
8 AMREX_FORCE_INLINE
9 amrex::Real
10 Thetav (int i, int j, int k,
11  const amrex::Array4<const amrex::Real>& cell_data,
12  const int RhoQv_comp,
13  const int RhoQr_comp)
14 {
15  amrex::Real thetav = cell_data(i,j,k,RhoTheta_comp) / cell_data(i,j,k,Rho_comp);
16 
17  if (RhoQr_comp > 0) {
18  thetav *= (1.0 + 0.61 * cell_data(i,j,k,RhoQv_comp) / cell_data(i,j,k,Rho_comp)
19  - cell_data(i,j,k,RhoQr_comp) / cell_data(i,j,k,Rho_comp));
20  } else if (RhoQv_comp > 0) {
21  thetav *= (1.0 + 0.61 * cell_data(i,j,k,RhoQ1_comp) / cell_data(i,j,k,Rho_comp));
22  }
23 
24  return thetav;
25 }
26 #endif
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Thetav(int i, int j, int k, const amrex::Array4< const amrex::Real > &cell_data, const int RhoQv_comp, const int RhoQr_comp)
Definition: ERF_Thetav.H:10