PySDM_examples.Shima_et_al_2009.tutorial_settings

 1from typing import Optional
 2
 3import numpy as np
 4from pystrict import strict
 5
 6from PySDM import Formulae
 7from PySDM.dynamics.collisions.collision_kernels import Golovin
 8from PySDM.initialisation import spectra
 9from PySDM.physics import si
10
11
12@strict
13class Settings:
14    def __init__(self, steps: Optional[list] = None):
15        steps = steps or [0, 1200, 2400, 3600]
16        self.formulae = Formulae()
17        self.n_sd = 2**13
18        self.n_part = 2**23 / si.metre**3
19        self.X0 = self.formulae.trivia.volume(radius=30.531 * si.micrometres)
20        self.dv = 1e6 * si.metres**3
21        self.norm_factor = self.n_part * self.dv
22        self.rho = 1000 * si.kilogram / si.metre**3
23        self.dt = 1 * si.seconds
24        self.adaptive = False
25        self.seed = 44
26        self.steps = steps
27        self.kernel = Golovin(b=1.5e3 / si.second)
28        self.spectrum = spectra.Exponential(norm_factor=self.norm_factor, scale=self.X0)
29        self.radius_bins_edges = np.logspace(
30            np.log10(10 * si.um), np.log10(5e4 * si.um), num=256, endpoint=True
31        )
32
33    @property
34    def output_steps(self):
35        return [int(step / self.dt) for step in self.steps]
@strict
class Settings:
13@strict
14class Settings:
15    def __init__(self, steps: Optional[list] = None):
16        steps = steps or [0, 1200, 2400, 3600]
17        self.formulae = Formulae()
18        self.n_sd = 2**13
19        self.n_part = 2**23 / si.metre**3
20        self.X0 = self.formulae.trivia.volume(radius=30.531 * si.micrometres)
21        self.dv = 1e6 * si.metres**3
22        self.norm_factor = self.n_part * self.dv
23        self.rho = 1000 * si.kilogram / si.metre**3
24        self.dt = 1 * si.seconds
25        self.adaptive = False
26        self.seed = 44
27        self.steps = steps
28        self.kernel = Golovin(b=1.5e3 / si.second)
29        self.spectrum = spectra.Exponential(norm_factor=self.norm_factor, scale=self.X0)
30        self.radius_bins_edges = np.logspace(
31            np.log10(10 * si.um), np.log10(5e4 * si.um), num=256, endpoint=True
32        )
33
34    @property
35    def output_steps(self):
36        return [int(step / self.dt) for step in self.steps]
Settings(steps: Optional[list] = None)
15    def __init__(self, steps: Optional[list] = None):
16        steps = steps or [0, 1200, 2400, 3600]
17        self.formulae = Formulae()
18        self.n_sd = 2**13
19        self.n_part = 2**23 / si.metre**3
20        self.X0 = self.formulae.trivia.volume(radius=30.531 * si.micrometres)
21        self.dv = 1e6 * si.metres**3
22        self.norm_factor = self.n_part * self.dv
23        self.rho = 1000 * si.kilogram / si.metre**3
24        self.dt = 1 * si.seconds
25        self.adaptive = False
26        self.seed = 44
27        self.steps = steps
28        self.kernel = Golovin(b=1.5e3 / si.second)
29        self.spectrum = spectra.Exponential(norm_factor=self.norm_factor, scale=self.X0)
30        self.radius_bins_edges = np.logspace(
31            np.log10(10 * si.um), np.log10(5e4 * si.um), num=256, endpoint=True
32        )
formulae
n_sd
n_part
X0
dv
norm_factor
rho
dt
adaptive
seed
steps
kernel
spectrum
radius_bins_edges
output_steps
34    @property
35    def output_steps(self):
36        return [int(step / self.dt) for step in self.steps]