PySDM_examples.Niedermeier_et_al_2014.settings

 1from typing import Optional
 2
 3from pystrict import strict
 4
 5from PySDM import Formulae
 6from PySDM.physics import si
 7
 8
 9@strict
10class Settings:
11    def __init__(
12        self,
13        *,
14        formulae: Optional[Formulae],
15        ccn_sampling_n: int = 11,
16        in_sampling_n: int = 20,
17        initial_temperature: float,
18        timestep: float
19    ):
20        self.ccn_sampling_n = ccn_sampling_n
21        self.in_sampling_n = in_sampling_n
22
23        self.timestep = timestep
24        self.initial_temperature = initial_temperature
25        self.formulae = formulae
26
27        self.initial_relative_humidity = 0.985
28        self.vertical_velocity = 20 * si.cm / si.s
29        self.displacement = 300 * si.m
30        self.kappa = 0.53  # ammonium sulfate (Tab. 1 in P&K07)
31        self.mass_of_dry_air = 1e3 * si.kg
32
33        # note: 2000 um in the paper... but it gives 0 concentrations
34        self.ccn_dry_diameter_range = (10 * si.nm, 353 * si.nm)
35
36    @property
37    def p0(self):
38        return 1000 * si.hPa
39
40    @property
41    def pv0(self):
42        pvs = self.formulae.saturation_vapour_pressure.pvs_water(self.T0)
43        return self.initial_relative_humidity * pvs
44
45    @property
46    def initial_water_vapour_mixing_ratio(self):
47        pv0 = self.pv0
48        return self.formulae.constants.eps * pv0 / (self.p0 - pv0)
49
50    @property
51    def T0(self):
52        return self.initial_temperature
53
54    @property
55    def rhod0(self):
56        rho_v = self.pv0 / self.formulae.constants.Rv / self.T0
57        return rho_v / self.initial_water_vapour_mixing_ratio
@strict
class Settings:
10@strict
11class Settings:
12    def __init__(
13        self,
14        *,
15        formulae: Optional[Formulae],
16        ccn_sampling_n: int = 11,
17        in_sampling_n: int = 20,
18        initial_temperature: float,
19        timestep: float
20    ):
21        self.ccn_sampling_n = ccn_sampling_n
22        self.in_sampling_n = in_sampling_n
23
24        self.timestep = timestep
25        self.initial_temperature = initial_temperature
26        self.formulae = formulae
27
28        self.initial_relative_humidity = 0.985
29        self.vertical_velocity = 20 * si.cm / si.s
30        self.displacement = 300 * si.m
31        self.kappa = 0.53  # ammonium sulfate (Tab. 1 in P&K07)
32        self.mass_of_dry_air = 1e3 * si.kg
33
34        # note: 2000 um in the paper... but it gives 0 concentrations
35        self.ccn_dry_diameter_range = (10 * si.nm, 353 * si.nm)
36
37    @property
38    def p0(self):
39        return 1000 * si.hPa
40
41    @property
42    def pv0(self):
43        pvs = self.formulae.saturation_vapour_pressure.pvs_water(self.T0)
44        return self.initial_relative_humidity * pvs
45
46    @property
47    def initial_water_vapour_mixing_ratio(self):
48        pv0 = self.pv0
49        return self.formulae.constants.eps * pv0 / (self.p0 - pv0)
50
51    @property
52    def T0(self):
53        return self.initial_temperature
54
55    @property
56    def rhod0(self):
57        rho_v = self.pv0 / self.formulae.constants.Rv / self.T0
58        return rho_v / self.initial_water_vapour_mixing_ratio
Settings( *, formulae: Optional[PySDM.formulae.Formulae], ccn_sampling_n: int = 11, in_sampling_n: int = 20, initial_temperature: float, timestep: float)
12    def __init__(
13        self,
14        *,
15        formulae: Optional[Formulae],
16        ccn_sampling_n: int = 11,
17        in_sampling_n: int = 20,
18        initial_temperature: float,
19        timestep: float
20    ):
21        self.ccn_sampling_n = ccn_sampling_n
22        self.in_sampling_n = in_sampling_n
23
24        self.timestep = timestep
25        self.initial_temperature = initial_temperature
26        self.formulae = formulae
27
28        self.initial_relative_humidity = 0.985
29        self.vertical_velocity = 20 * si.cm / si.s
30        self.displacement = 300 * si.m
31        self.kappa = 0.53  # ammonium sulfate (Tab. 1 in P&K07)
32        self.mass_of_dry_air = 1e3 * si.kg
33
34        # note: 2000 um in the paper... but it gives 0 concentrations
35        self.ccn_dry_diameter_range = (10 * si.nm, 353 * si.nm)
ccn_sampling_n
in_sampling_n
timestep
initial_temperature
formulae
initial_relative_humidity
vertical_velocity
displacement
kappa
mass_of_dry_air
ccn_dry_diameter_range
p0
37    @property
38    def p0(self):
39        return 1000 * si.hPa
pv0
41    @property
42    def pv0(self):
43        pvs = self.formulae.saturation_vapour_pressure.pvs_water(self.T0)
44        return self.initial_relative_humidity * pvs
initial_water_vapour_mixing_ratio
46    @property
47    def initial_water_vapour_mixing_ratio(self):
48        pv0 = self.pv0
49        return self.formulae.constants.eps * pv0 / (self.p0 - pv0)
T0
51    @property
52    def T0(self):
53        return self.initial_temperature
rhod0
55    @property
56    def rhod0(self):
57        rho_v = self.pv0 / self.formulae.constants.Rv / self.T0
58        return rho_v / self.initial_water_vapour_mixing_ratio