ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Wstar.H
Go to the documentation of this file.
1 #ifndef ERF_UTILS_WSTAR_H_
2 #define ERF_UTILS_WSTAR_H_
3 
4 #include <ERF_Constants.H>
5 
6 /*
7  * Calculate the convective velocity scale
8  */
9 
10 AMREX_GPU_DEVICE
11 AMREX_FORCE_INLINE
12 amrex::Real
13 calc_wstar (const amrex::Real& ust,
14  const amrex::Real& tst,
15  const amrex::Real& qst,
16  const amrex::Real& pblh,
17  const amrex::Real& th,
18  const amrex::Real& thv,
19  const amrex::Real& qv = 0.0)
20 {
21  amrex::Real hfx = -ust*tst; // <theta'w'>
22  if (hfx <= 0) {
23  return 0.0;
24  }
25  if (qv > 0) {
26  // have moisture -- estimate buoyancy flux, <thetav'w'> (Stull 4.4.5d)
27  hfx = hfx*(1 + 0.61*qv) + 0.61*th*(-ust*qst);
28  }
29  return std::cbrt(CONST_GRAV / thv * pblh * hfx);
30 }
31 
32 AMREX_GPU_DEVICE
33 AMREX_FORCE_INLINE
34 amrex::Real
35 calc_wstar (const amrex::Real& hfx,
36  const amrex::Real& pblh,
37  const amrex::Real& thv)
38 {
39  if (hfx <= 0) {
40  return 0.0;
41  } else {
42  return std::cbrt(CONST_GRAV / thv * pblh * hfx);
43  }
44 }
45 #endif
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real calc_wstar(const amrex::Real &ust, const amrex::Real &tst, const amrex::Real &qst, const amrex::Real &pblh, const amrex::Real &th, const amrex::Real &thv, const amrex::Real &qv=0.0)
Definition: ERF_Wstar.H:13
@ qv
Definition: ERF_Kessler.H:36