283 amrex::Real t1, q1, dt, dq;
285 amrex::Real r1b, c1, c2, c3;
286 constexpr amrex::Real dttol = 1.e-4;
287 constexpr amrex::Real dqtol = 1.e-4;
288 amrex::Real enin, enout;
290 c3 = 287.04*(7.5*log(10.))/
Cp_d;
301 if (p <= 5.*es || qs <= 0. || qs >= 0.5 || t < tmin || t >
tmax) {
324 c2 = std::pow(t + 36., 2);
325 r1b = c2/(c2 + c1*qs);
326 qvd = r1b * (q - qs);
327 tsp = t + ((hltalt/
Cp_d)*qvd);
331 qsat(tsp, p, es, qsp, &gam, &enout);
336 for(
auto l = 1; l < iter; ++l) {
339 dgdt = -
Cp_d * (1 + gam);
343 dt = abs(t1 - tsp)/t1;
356 qsp = (enin -
Cp_d*tsp)/hltalt;
364 qsat(tsp, p, es, q1, &gam, &enout);
368 dq = abs(q1 - qsp)/std::max(q1,1.e-12);
372 if (dt < dttol && dq < dqtol) {
378 if (abs((enin-enout)/(enin+enout)) > 1.e-4) status = 8;
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE void calc_hltalt(const amrex::Real &t, amrex::Real &hltalt, amrex::Real *tterm=nullptr)
Definition: ERF_WaterVaporSaturation.H:90
static constexpr amrex::Real tmax
Definition: ERF_WaterVaporSaturation.H:33
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE void qsat(const amrex::Real &t, const amrex::Real &p, amrex::Real &es, amrex::Real &qs, amrex::Real *gam=nullptr, amrex::Real *dqsdt=nullptr, amrex::Real *enthalpy=nullptr)
Definition: ERF_WaterVaporSaturation.H:152
static constexpr amrex::Real tmin
Definition: ERF_WaterVaporSaturation.H:32
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE void qsat_water(const amrex::Real &t, const amrex::Real &p, amrex::Real &es, amrex::Real &qs, amrex::Real *gam=nullptr, amrex::Real *dqsdt=nullptr, amrex::Real *enthalpy=nullptr)
Definition: ERF_WaterVaporSaturation.H:191
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real tq_enthalpy(const amrex::Real &t, const amrex::Real &q, const amrex::Real &hltalt)
Definition: ERF_WaterVaporSaturation.H:67