Use saturated mixing ratio in moist lapse rate

This commit is contained in:
XANTRONIX 2025-03-05 01:13:28 -05:00
parent 6bb92a45b8
commit 5a22a5fd37

View file

@ -59,11 +59,11 @@ def lapse(temp: float, delta: float, rate=LAPSE_RATE_DRY) -> float:
def moist_lapse_rate(temp: float, dewpoint: float, pressure: float) -> float:
g = 9.8076
Hv = 2501000
r = mixing_ratio(dewpoint, pressure)
Rsd = 287
Rsw = 461.5
Cpd = 1003.5
r = saturated_mixing_ratio(dewpoint, pressure)
T = kelvin(temp)
return g * (1 + (Hv * r) / (Rsd * T)) \
/ (Cpd + ((Hv**2 * r) / (Rsw * T**2)))
/ (Cpd + (((Hv**2) * r) / (Rsw * (T**2))))