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 RhoQc_comp,
14  const int RhoQr_comp)
15 {
16  amrex::Real thetav = cell_data(i,j,k,RhoTheta_comp) / cell_data(i,j,k,Rho_comp);
17 
18  if (RhoQr_comp > 0) {
19  thetav *= (1.0 + 0.61 * cell_data(i,j,k,RhoQv_comp) / cell_data(i,j,k,Rho_comp)
20  - cell_data(i,j,k,RhoQc_comp) / cell_data(i,j,k,Rho_comp)
21  - cell_data(i,j,k,RhoQr_comp) / cell_data(i,j,k,Rho_comp));
22  } else if (RhoQv_comp > 0) {
23  thetav *= (1.0 + 0.61 * cell_data(i,j,k,RhoQ1_comp) / cell_data(i,j,k,Rho_comp)
24  - cell_data(i,j,k,RhoQc_comp) / cell_data(i,j,k,Rho_comp));
25  }
26 
27  return thetav;
28 }
29 #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 RhoQc_comp, const int RhoQr_comp)
Definition: ERF_Thetav.H:10