Move thermo series functions to thermo.py
This commit is contained in:
parent
9be71c7e44
commit
50cdf4052d
1 changed files with 36 additions and 0 deletions
|
@ -2,6 +2,8 @@ import math
|
||||||
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
from xmet.series import Series
|
||||||
|
|
||||||
LAPSE_RATE_DRY = 9.8 / 1000 # degrees C per km
|
LAPSE_RATE_DRY = 9.8 / 1000 # degrees C per km
|
||||||
LAPSE_RATE_MOIST = 4.0 / 1000
|
LAPSE_RATE_MOIST = 4.0 / 1000
|
||||||
|
|
||||||
|
@ -141,3 +143,37 @@ def loft_parcel(start_temp: float,
|
||||||
pressure = PRESSURE_MIN
|
pressure = PRESSURE_MIN
|
||||||
else:
|
else:
|
||||||
pressure -= step
|
pressure -= step
|
||||||
|
|
||||||
|
def follow_dry_adiabat(temp: float, pressure: float) -> Series:
|
||||||
|
series = Series()
|
||||||
|
|
||||||
|
for level in loft_parcel(temp, pressure, lambda t, p: LAPSE_RATE_DRY):
|
||||||
|
t2, p2 = level
|
||||||
|
|
||||||
|
series[p2] = t2
|
||||||
|
|
||||||
|
return series
|
||||||
|
|
||||||
|
def follow_moist_adiabat(temp: float, pressure: float) -> Series:
|
||||||
|
series = Series()
|
||||||
|
|
||||||
|
for level in loft_parcel(temp, pressure, moist_lapse_rate):
|
||||||
|
t2, p2 = level
|
||||||
|
|
||||||
|
series[p2] = t2
|
||||||
|
|
||||||
|
return series
|
||||||
|
|
||||||
|
def follow_saturated_mixing_ratio(temp: float, pressure: float) -> Series:
|
||||||
|
series = dict()
|
||||||
|
|
||||||
|
ratio = saturated_mixing_ratio(temp, pressure)
|
||||||
|
|
||||||
|
p2 = pressure
|
||||||
|
|
||||||
|
while p2 >= PRESSURE_MIN:
|
||||||
|
series[p2] = mixing_ratio_temp(ratio, p2)
|
||||||
|
|
||||||
|
p2 -= 10
|
||||||
|
|
||||||
|
return series
|
||||||
|
|
Loading…
Add table
Reference in a new issue