PySDM_examples.Berry_1967.settings
1from typing import Optional 2 3import numpy as np 4from pystrict import strict 5 6from PySDM import Formulae 7from PySDM.dynamics.collisions import collision_kernels 8from PySDM.initialisation import spectra 9from PySDM.physics import si 10 11 12@strict 13class Settings: 14 def __init__( 15 self, 16 steps: Optional[list] = None, 17 terminal_velocity_variant: str = "GunnKinzer1949", 18 ): 19 steps = steps or [200 * i for i in range(10)] 20 21 self.formulae = Formulae(terminal_velocity=terminal_velocity_variant) 22 self.init_x_min = self.formulae.trivia.volume(radius=3.94 * si.micrometre) 23 self.init_x_max = self.formulae.trivia.volume(radius=25 * si.micrometres) 24 25 self.n_sd = 2**13 26 self.n_part = 239 / si.cm**3 27 self.X0 = self.formulae.trivia.volume(radius=10 * si.micrometres) 28 self.dv = ( 29 1e1 * si.metres**3 30 ) # 1e6 -> overflows on ThrustRTC (32-bit int multiplicities) 31 self.norm_factor = self.n_part * self.dv 32 self.rho = self.formulae.constants.rho_w 33 self.dt = 1 * si.seconds 34 self.adaptive = False 35 self.seed = 44 36 self._steps = steps 37 self.kernel = collision_kernels.Geometric(collection_efficiency=1) 38 self.spectrum = spectra.Exponential(norm_factor=self.norm_factor, scale=self.X0) 39 40 # Note 220 instead of 200 for smoothing 41 self.radius_bins_edges = np.logspace( 42 np.log10(3.94 * si.um), np.log10(220 * si.um), num=100, endpoint=True 43 ) 44 45 @property 46 def output_steps(self): 47 return [int(step / self.dt) for step in self._steps]
@strict
class
Settings:
13@strict 14class Settings: 15 def __init__( 16 self, 17 steps: Optional[list] = None, 18 terminal_velocity_variant: str = "GunnKinzer1949", 19 ): 20 steps = steps or [200 * i for i in range(10)] 21 22 self.formulae = Formulae(terminal_velocity=terminal_velocity_variant) 23 self.init_x_min = self.formulae.trivia.volume(radius=3.94 * si.micrometre) 24 self.init_x_max = self.formulae.trivia.volume(radius=25 * si.micrometres) 25 26 self.n_sd = 2**13 27 self.n_part = 239 / si.cm**3 28 self.X0 = self.formulae.trivia.volume(radius=10 * si.micrometres) 29 self.dv = ( 30 1e1 * si.metres**3 31 ) # 1e6 -> overflows on ThrustRTC (32-bit int multiplicities) 32 self.norm_factor = self.n_part * self.dv 33 self.rho = self.formulae.constants.rho_w 34 self.dt = 1 * si.seconds 35 self.adaptive = False 36 self.seed = 44 37 self._steps = steps 38 self.kernel = collision_kernels.Geometric(collection_efficiency=1) 39 self.spectrum = spectra.Exponential(norm_factor=self.norm_factor, scale=self.X0) 40 41 # Note 220 instead of 200 for smoothing 42 self.radius_bins_edges = np.logspace( 43 np.log10(3.94 * si.um), np.log10(220 * si.um), num=100, endpoint=True 44 ) 45 46 @property 47 def output_steps(self): 48 return [int(step / self.dt) for step in self._steps]
Settings( steps: Optional[list] = None, terminal_velocity_variant: str = 'GunnKinzer1949')
15 def __init__( 16 self, 17 steps: Optional[list] = None, 18 terminal_velocity_variant: str = "GunnKinzer1949", 19 ): 20 steps = steps or [200 * i for i in range(10)] 21 22 self.formulae = Formulae(terminal_velocity=terminal_velocity_variant) 23 self.init_x_min = self.formulae.trivia.volume(radius=3.94 * si.micrometre) 24 self.init_x_max = self.formulae.trivia.volume(radius=25 * si.micrometres) 25 26 self.n_sd = 2**13 27 self.n_part = 239 / si.cm**3 28 self.X0 = self.formulae.trivia.volume(radius=10 * si.micrometres) 29 self.dv = ( 30 1e1 * si.metres**3 31 ) # 1e6 -> overflows on ThrustRTC (32-bit int multiplicities) 32 self.norm_factor = self.n_part * self.dv 33 self.rho = self.formulae.constants.rho_w 34 self.dt = 1 * si.seconds 35 self.adaptive = False 36 self.seed = 44 37 self._steps = steps 38 self.kernel = collision_kernels.Geometric(collection_efficiency=1) 39 self.spectrum = spectra.Exponential(norm_factor=self.norm_factor, scale=self.X0) 40 41 # Note 220 instead of 200 for smoothing 42 self.radius_bins_edges = np.logspace( 43 np.log10(3.94 * si.um), np.log10(220 * si.um), num=100, endpoint=True 44 )