Initial implementation of moist_lapse_rate()
This commit is contained in:
parent
b45a6f27c5
commit
0aad130001
1 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
LAPSE_RATE_DRY = 9.8 / 1000 # degrees C per km
|
||||
LAPSE_RATE_MOIST = 4.0 / 1000
|
||||
|
||||
def kelvin(c: float) -> float:
|
||||
return 273.15 + c
|
||||
|
||||
def vapor_pressure(dewpoint: float) -> float:
|
||||
"""
|
||||
Return the pressure of vapor in a parcel of a given dewpoint.
|
||||
|
@ -56,3 +59,15 @@ def lapse(temp: float, delta: float, rate=LAPSE_RATE_DRY) -> float:
|
|||
given increase in height (in meters).
|
||||
"""
|
||||
return temp - (rate * delta)
|
||||
|
||||
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
|
||||
T = kelvin(temp)
|
||||
|
||||
return g * (1 + (Hv * r) / (Rsd * T)) \
|
||||
/ (Cpd + ((Hv**2 * r) / (Rsw * T**2)))
|
||||
|
|
Loading…
Add table
Reference in a new issue