Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify polynomial coeffs for qsat #1678

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Source/ERF_Constants.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ constexpr amrex::Real Cp_l = 4200.0;

constexpr amrex::Real L_v = 2.5e6; // latent heat of vaporization (J / kg)

constexpr amrex::Real p_0 = 1.0e5; // reference surface pressure [Pa]
constexpr amrex::Real Gamma = 1.4; // c_p / c_v [-]
constexpr amrex::Real KAPPA = 0.41; // von Karman constant
constexpr amrex::Real p_0 = 1.0e5; // reference surface pressure [Pa]
constexpr amrex::Real Gamma = 1.4; // c_p / c_v [-]
constexpr amrex::Real KAPPA = 0.41; // von Karman constant
constexpr amrex::Real CONST_GRAV = 9.81;

// Derived Constants
Expand Down
46 changes: 23 additions & 23 deletions Source/Utils/Microphysics_Utils.H
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,37 @@ amrex::Real erf_esatw (amrex::Real t) {
}
return esatw;
#else
amrex::Real a0 = 6.11239921;
amrex::Real a1 = 0.443987641;
amrex::Real a2 = 0.142986287e-1;
amrex::Real a3 = 0.264847430e-3;
amrex::Real a4 = 0.302950461e-5;
amrex::Real a5 = 0.206739458e-7;
amrex::Real a6 = 0.640689451e-10;
// From Flatau (1992) "Polynomial Fits to SVP"

// For T in the range of -85 to 70 [C]
amrex::Real a0 = 6.11239921;
amrex::Real a1 = 0.443987641;
amrex::Real a2 = 0.142986287e-1;
amrex::Real a3 = 0.264847430e-3;
amrex::Real a4 = 0.302950461e-5;
amrex::Real a5 = 0.206739458e-7;
amrex::Real a6 = 0.640689451e-10;
amrex::Real a7 = -0.952447341e-13;
amrex::Real a8 = -0.976195544e-15;

amrex::Real a0i = 6.11147274;
amrex::Real a1i = 0.503160820;
amrex::Real a2i = 0.188439774e-1;
amrex::Real a3i = 0.420895665e-3;
amrex::Real a4i = 0.615021634e-5;
amrex::Real a5i = 0.602588177e-7;
amrex::Real a6i = 0.385852041e-9;
amrex::Real a7i = 0.146898966e-11;
amrex::Real a8i = 0.252751365e-14;
// For T in the range of 0 to 100 [C]
amrex::Real a0i = 6.11220713;
amrex::Real a1i = 0.443944344;
amrex::Real a2i = 0.143195336e-1;
amrex::Real a3i = 0.263350515e-3;
amrex::Real a4i = 0.310636053e-5;
amrex::Real a5i = 0.185218710e-7;
amrex::Real a6i = 0.103440324e-9;
amrex::Real a7i = -0.468258100e-12;
amrex::Real a8i = 0.466533033e-15;

amrex::Real Tc = std::max(-80.0, t-273.16);
amrex::Real Tc = std::max(-80.0, t-273.15);

amrex::Real esatw;
if (t<=273.15){
esatw = (a0 + Tc*(a1 +Tc*(a2 +Tc*(a3 +Tc*(a4 +Tc*(a5 +Tc*(a6 +Tc*(a7 +a8 *Tc))))))))*100.;
esatw = (a0 + Tc*(a1 +Tc*(a2 +Tc*(a3 +Tc*(a4 +Tc*(a5 +Tc*(a6 +Tc*(a7 +a8 *Tc))))))));
}else{
esatw = (a0i + Tc*(a1i+Tc*(a2i+Tc*(a3i+Tc*(a4i+Tc*(a5i+Tc*(a6i+Tc*(a7i+a8i*Tc))))))))*100.;
esatw = (a0i + Tc*(a1i+Tc*(a2i+Tc*(a3i+Tc*(a4i+Tc*(a5i+Tc*(a6i+Tc*(a7i+a8i*Tc))))))));
}
return esatw;
#endif
Expand Down Expand Up @@ -154,11 +158,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void erf_qsatw (amrex::Real t, amrex::Real p, amrex::Real &qsatw) {
amrex::Real esatw;
esatw = erf_esatw(t);
#if 1
qsatw = Rd_on_Rv*esatw/std::max(esatw,p-esatw);
#else
qsatw = esatw/(R_v*t);
#endif
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
Expand Down
Loading