PySDM_examples.Abade_and_Albuquerque_2024.settings

 1from pystrict import strict
 2
 3from PySDM.backends import CPU
 4from PySDM.physics import si
 5from PySDM.initialisation.spectra import Lognormal
 6
 7
 8@strict
 9class Settings:
10    def __init__(
11        self,
12        *,
13        backend: CPU,
14        n_sd: int,
15        timestep: float,
16        # default values correspond to paper settings
17        singular: bool = True,
18        enable_immersion_freezing: bool = True,
19        enable_vapour_deposition_on_ice: bool = True,
20        inp_frac: float = 0.1,
21        kappa: float = 0.6,
22        updraft: float = 0.5 * si.m / si.s,
23    ):
24        self.backend = backend
25        self.n_sd = n_sd
26        self.timestep = timestep
27        self.enable_immersion_freezing = enable_immersion_freezing
28        self.enable_vapour_deposition_on_ice = enable_vapour_deposition_on_ice
29        self.singular = singular
30        self.initial_total_pressure = 1000 * si.hPa  # note: not given in the paper
31
32        self.initial_water_vapour_mixing_ratio = 1.5 * si.g / si.kg
33        self.parcel_linear_extent = 100 * si.m
34        self.updraft = updraft
35        self.freezing_inp_frac = inp_frac
36        self.freezing_inp_dry_radius = 0.5 * si.um
37
38        thd_0 = backend.formulae.state_variable_triplet.th_dry(
39            th_std=269 * si.K,
40            water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
41        )
42        rhod_0 = backend.formulae.state_variable_triplet.rho_d(
43            p=self.initial_total_pressure,
44            water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
45            theta_std=thd_0,
46        )
47
48        self.mass_of_dry_air = rhod_0 * backend.formulae.trivia.volume(
49            radius=self.parcel_linear_extent
50        )
51        self.soluble_aerosol = Lognormal(
52            norm_factor=200
53            / si.mg
54            * self.mass_of_dry_air,  # note: assuming per mg of dry air
55            m_mode=75 * si.nm,
56            s_geom=1.6,
57        )
58        self.kappa = kappa
59        self.initial_temperature = backend.formulae.state_variable_triplet.T(
60            rhod=rhod_0, thd=thd_0
61        )
@strict
class Settings:
 9@strict
10class Settings:
11    def __init__(
12        self,
13        *,
14        backend: CPU,
15        n_sd: int,
16        timestep: float,
17        # default values correspond to paper settings
18        singular: bool = True,
19        enable_immersion_freezing: bool = True,
20        enable_vapour_deposition_on_ice: bool = True,
21        inp_frac: float = 0.1,
22        kappa: float = 0.6,
23        updraft: float = 0.5 * si.m / si.s,
24    ):
25        self.backend = backend
26        self.n_sd = n_sd
27        self.timestep = timestep
28        self.enable_immersion_freezing = enable_immersion_freezing
29        self.enable_vapour_deposition_on_ice = enable_vapour_deposition_on_ice
30        self.singular = singular
31        self.initial_total_pressure = 1000 * si.hPa  # note: not given in the paper
32
33        self.initial_water_vapour_mixing_ratio = 1.5 * si.g / si.kg
34        self.parcel_linear_extent = 100 * si.m
35        self.updraft = updraft
36        self.freezing_inp_frac = inp_frac
37        self.freezing_inp_dry_radius = 0.5 * si.um
38
39        thd_0 = backend.formulae.state_variable_triplet.th_dry(
40            th_std=269 * si.K,
41            water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
42        )
43        rhod_0 = backend.formulae.state_variable_triplet.rho_d(
44            p=self.initial_total_pressure,
45            water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
46            theta_std=thd_0,
47        )
48
49        self.mass_of_dry_air = rhod_0 * backend.formulae.trivia.volume(
50            radius=self.parcel_linear_extent
51        )
52        self.soluble_aerosol = Lognormal(
53            norm_factor=200
54            / si.mg
55            * self.mass_of_dry_air,  # note: assuming per mg of dry air
56            m_mode=75 * si.nm,
57            s_geom=1.6,
58        )
59        self.kappa = kappa
60        self.initial_temperature = backend.formulae.state_variable_triplet.T(
61            rhod=rhod_0, thd=thd_0
62        )
Settings( *, backend: PySDM.backends.numba.Numba, n_sd: int, timestep: float, singular: bool = True, enable_immersion_freezing: bool = True, enable_vapour_deposition_on_ice: bool = True, inp_frac: float = 0.1, kappa: float = 0.6, updraft: float = 0.5)
11    def __init__(
12        self,
13        *,
14        backend: CPU,
15        n_sd: int,
16        timestep: float,
17        # default values correspond to paper settings
18        singular: bool = True,
19        enable_immersion_freezing: bool = True,
20        enable_vapour_deposition_on_ice: bool = True,
21        inp_frac: float = 0.1,
22        kappa: float = 0.6,
23        updraft: float = 0.5 * si.m / si.s,
24    ):
25        self.backend = backend
26        self.n_sd = n_sd
27        self.timestep = timestep
28        self.enable_immersion_freezing = enable_immersion_freezing
29        self.enable_vapour_deposition_on_ice = enable_vapour_deposition_on_ice
30        self.singular = singular
31        self.initial_total_pressure = 1000 * si.hPa  # note: not given in the paper
32
33        self.initial_water_vapour_mixing_ratio = 1.5 * si.g / si.kg
34        self.parcel_linear_extent = 100 * si.m
35        self.updraft = updraft
36        self.freezing_inp_frac = inp_frac
37        self.freezing_inp_dry_radius = 0.5 * si.um
38
39        thd_0 = backend.formulae.state_variable_triplet.th_dry(
40            th_std=269 * si.K,
41            water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
42        )
43        rhod_0 = backend.formulae.state_variable_triplet.rho_d(
44            p=self.initial_total_pressure,
45            water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
46            theta_std=thd_0,
47        )
48
49        self.mass_of_dry_air = rhod_0 * backend.formulae.trivia.volume(
50            radius=self.parcel_linear_extent
51        )
52        self.soluble_aerosol = Lognormal(
53            norm_factor=200
54            / si.mg
55            * self.mass_of_dry_air,  # note: assuming per mg of dry air
56            m_mode=75 * si.nm,
57            s_geom=1.6,
58        )
59        self.kappa = kappa
60        self.initial_temperature = backend.formulae.state_variable_triplet.T(
61            rhod=rhod_0, thd=thd_0
62        )
backend
n_sd
timestep
enable_immersion_freezing
enable_vapour_deposition_on_ice
singular
initial_total_pressure
initial_water_vapour_mixing_ratio
parcel_linear_extent
updraft
freezing_inp_frac
freezing_inp_dry_radius
mass_of_dry_air
soluble_aerosol
kappa
initial_temperature