10 Real grav, Real adTdz)
const {
11 Real step[] = {0.5, 0.5, 1.};
12 Real
temp = air->
w[IDN];
13 Real pres = air->
w[IPR];
15 Real latent[1 + NVAPOR];
17 for (
int rk = 0; rk < 4; ++rk) {
20 for (
int j = 0;
j < NCLOUD; ++
j) air->
c[
j] = 0;
23 for (
int i = 1; i <= NVAPOR; ++i) {
32 Real q_gas = 1., q_eps = 1.;
33 for (
int i = 1; i <= NVAPOR; ++i) {
37 for (
int j = 0;
j < NCLOUD; ++
j) {
42 Real g_ov_Rd = grav /
Rd_;
43 Real R_ov_Rd = q_gas / q_eps;
49 for (
int i = 1; i <= NVAPOR; ++i) latent[i] = 0;
55 dTdz[rk] = -chi[rk] * g_ov_Rd / R_ov_Rd + adTdz;
56 chi[rk] = -R_ov_Rd / g_ov_Rd * dTdz[rk];
61 air->
w[IDN] =
temp + dTdz[rk] * dz * step[rk];
66 1. / 6. * (dTdz[0] + 2. * dTdz[1] + 2. * dTdz[2] + dTdz[3]) * dz;
67 chi_avg = 1. / 6. * (chi[0] + 2. * chi[1] + 2. * chi[2] + chi[3]);
70 if (!(air->
w[IDN] > 0.)) air->
w[IDN] =
temp;
72 if (fabs(air->
w[IDN] -
temp) > 0.01) {
73 air->
w[IPR] = pres * pow(air->
w[IDN] /
temp, 1. / chi_avg);
76 pres * exp(-2. * g_ov_Rd * dz / (R_ov_Rd * (air->
w[IDN] +
temp)));
83 for (
int j = 0;
j < NCLOUD; ++
j) air->
c[
j] = 0;
RealArrayX TryEquilibriumTP_VaporCloud(AirParcel const &qfrac, int ivapor, Real cv_hat=0., bool misty=false) const
Calculate the equilibrium mole transfer by cloud reaction vapor -> cloud.
Real calDlnTDlnP(AirParcel const &qfrac, Real latent[]) const
Calculate moist adiabatic temperature gradient.
Real GetLatentHeatMole(int i, std::vector< Real > const &rates, Real temp) const
std::array< Real, Size > mu_ratio_
ratio of mean molecular weights
Real Rd_
ideal gas constant of dry air in J/kg
void EquilibrateTP(AirParcel *qfrac) const
void rk4IntegrateZ(AirParcel *qfrac, Real dlnp, Method method, Real grav, Real adlnTdlnP) const