PySDM_examples.Jensen_and_Nugent_2017.settings
1from typing import Optional 2 3from pystrict import strict 4from PySDM import Formulae 5from PySDM.physics import si 6from PySDM.initialisation.spectra import Lognormal, Sum 7 8INITIAL_RELATIVE_HUMIDITY = 0.8561 9INITIAL_TEMPERATURE = 284.3 * si.K 10INITIAL_PRESSURE = 938.5 * si.hPa 11INITIAL_ALTITUDE = 600 * si.metres 12 13 14@strict 15class Settings: 16 def __init__(self, *, aerosol: str, cloud_type: str, dt: Optional[float] = None): 17 self.p0 = INITIAL_PRESSURE 18 self.RH0 = INITIAL_RELATIVE_HUMIDITY 19 self.T0 = INITIAL_TEMPERATURE 20 self.z0 = INITIAL_ALTITUDE 21 self.t_end_of_ascent = 1500 * si.s if cloud_type == "Sc" else None 22 self.dt = dt or 1 * si.s # TODO #1266: not found in the paper yet 23 24 self.kappa = 1.28 # Table 1 from Petters & Kreidenweis 2007 25 26 self.formulae = Formulae( 27 saturation_vapour_pressure="FlatauWalkoCotton", # TODO #1266: Bolton 28 diffusion_kinetics="GrabowskiEtAl2011", 29 diffusion_thermics="GrabowskiEtAl2011", 30 constants={ 31 # values from appendix B 32 "MAC": 0.036, 33 "HAC": 0.7, 34 }, 35 ) 36 37 self.vertical_velocity = { 38 # Table 2 in the paper 39 "Sc": lambda t: (1 if t < self.t_end_of_ascent else -1) * 0.4 * si.m / si.s, 40 "Cu": 2 * si.m / si.s, 41 }[cloud_type] 42 43 self.dry_radii_spectrum = { 44 # Table 1 in the paper 45 "modified polluted": Sum( 46 ( 47 Lognormal( 48 norm_factor=48 / si.cm**3, m_mode=0.029 * si.um, s_geom=1.36 49 ), 50 Lognormal( 51 norm_factor=114 / si.cm**3, m_mode=0.071 * si.um, s_geom=1.57 52 ), 53 ) 54 ), 55 "pristine": Sum( 56 ( 57 Lognormal( 58 norm_factor=125 / si.cm**3, m_mode=0.011 * si.um, s_geom=1.2 59 ), 60 Lognormal( 61 norm_factor=65 / si.cm**3, m_mode=0.06 * si.um, s_geom=1.7 62 ), 63 ) 64 ), 65 }[aerosol]
INITIAL_RELATIVE_HUMIDITY =
0.8561
INITIAL_TEMPERATURE =
284.3
INITIAL_PRESSURE =
93850.0
INITIAL_ALTITUDE =
600.0
@strict
class
Settings:
15@strict 16class Settings: 17 def __init__(self, *, aerosol: str, cloud_type: str, dt: Optional[float] = None): 18 self.p0 = INITIAL_PRESSURE 19 self.RH0 = INITIAL_RELATIVE_HUMIDITY 20 self.T0 = INITIAL_TEMPERATURE 21 self.z0 = INITIAL_ALTITUDE 22 self.t_end_of_ascent = 1500 * si.s if cloud_type == "Sc" else None 23 self.dt = dt or 1 * si.s # TODO #1266: not found in the paper yet 24 25 self.kappa = 1.28 # Table 1 from Petters & Kreidenweis 2007 26 27 self.formulae = Formulae( 28 saturation_vapour_pressure="FlatauWalkoCotton", # TODO #1266: Bolton 29 diffusion_kinetics="GrabowskiEtAl2011", 30 diffusion_thermics="GrabowskiEtAl2011", 31 constants={ 32 # values from appendix B 33 "MAC": 0.036, 34 "HAC": 0.7, 35 }, 36 ) 37 38 self.vertical_velocity = { 39 # Table 2 in the paper 40 "Sc": lambda t: (1 if t < self.t_end_of_ascent else -1) * 0.4 * si.m / si.s, 41 "Cu": 2 * si.m / si.s, 42 }[cloud_type] 43 44 self.dry_radii_spectrum = { 45 # Table 1 in the paper 46 "modified polluted": Sum( 47 ( 48 Lognormal( 49 norm_factor=48 / si.cm**3, m_mode=0.029 * si.um, s_geom=1.36 50 ), 51 Lognormal( 52 norm_factor=114 / si.cm**3, m_mode=0.071 * si.um, s_geom=1.57 53 ), 54 ) 55 ), 56 "pristine": Sum( 57 ( 58 Lognormal( 59 norm_factor=125 / si.cm**3, m_mode=0.011 * si.um, s_geom=1.2 60 ), 61 Lognormal( 62 norm_factor=65 / si.cm**3, m_mode=0.06 * si.um, s_geom=1.7 63 ), 64 ) 65 ), 66 }[aerosol]
Settings(*, aerosol: str, cloud_type: str, dt: Optional[float] = None)
17 def __init__(self, *, aerosol: str, cloud_type: str, dt: Optional[float] = None): 18 self.p0 = INITIAL_PRESSURE 19 self.RH0 = INITIAL_RELATIVE_HUMIDITY 20 self.T0 = INITIAL_TEMPERATURE 21 self.z0 = INITIAL_ALTITUDE 22 self.t_end_of_ascent = 1500 * si.s if cloud_type == "Sc" else None 23 self.dt = dt or 1 * si.s # TODO #1266: not found in the paper yet 24 25 self.kappa = 1.28 # Table 1 from Petters & Kreidenweis 2007 26 27 self.formulae = Formulae( 28 saturation_vapour_pressure="FlatauWalkoCotton", # TODO #1266: Bolton 29 diffusion_kinetics="GrabowskiEtAl2011", 30 diffusion_thermics="GrabowskiEtAl2011", 31 constants={ 32 # values from appendix B 33 "MAC": 0.036, 34 "HAC": 0.7, 35 }, 36 ) 37 38 self.vertical_velocity = { 39 # Table 2 in the paper 40 "Sc": lambda t: (1 if t < self.t_end_of_ascent else -1) * 0.4 * si.m / si.s, 41 "Cu": 2 * si.m / si.s, 42 }[cloud_type] 43 44 self.dry_radii_spectrum = { 45 # Table 1 in the paper 46 "modified polluted": Sum( 47 ( 48 Lognormal( 49 norm_factor=48 / si.cm**3, m_mode=0.029 * si.um, s_geom=1.36 50 ), 51 Lognormal( 52 norm_factor=114 / si.cm**3, m_mode=0.071 * si.um, s_geom=1.57 53 ), 54 ) 55 ), 56 "pristine": Sum( 57 ( 58 Lognormal( 59 norm_factor=125 / si.cm**3, m_mode=0.011 * si.um, s_geom=1.2 60 ), 61 Lognormal( 62 norm_factor=65 / si.cm**3, m_mode=0.06 * si.um, s_geom=1.7 63 ), 64 ) 65 ), 66 }[aerosol]