PySDM_examples.deJong_Mackay_et_al_2023.settings1D
1from typing import Iterable 2 3import numpy as np 4from PySDM_examples.Shipway_and_Hill_2012 import Settings as SettingsSH 5 6from PySDM import Formulae 7from PySDM.dynamics.collisions.breakup_efficiencies import ConstEb 8from PySDM.dynamics.collisions.breakup_fragmentations import Gaussian, Straub2010Nf 9from PySDM.dynamics.collisions.coalescence_efficiencies import ConstEc, Straub2010Ec 10from PySDM.physics import si 11 12 13class Settings1D(SettingsSH): 14 def __dir__(self) -> Iterable[str]: 15 return ( 16 "n_sd_per_gridbox", 17 "p0", 18 "kappa", 19 "rho_times_w_1", 20 "particles_per_volume_STP", 21 "dt", 22 "dz", 23 "precip", 24 "breakup", 25 "stochastic_breakup", 26 "z_max", 27 "t_max", 28 "cloud_water_radius_range", 29 "rain_water_radius_range", 30 "r_bins_edges_dry", 31 "r_bins_edges", 32 "save_spec_at", 33 ) 34 35 def __init__( 36 self, 37 *, 38 old_buggy_density_formula: bool, 39 n_sd_per_gridbox: int, 40 p0: float = 1007 * si.hPa, # as used in Olesik et al. 2022 (GMD) 41 kappa: float = 1, 42 rho_times_w_1: float = 2 * si.m / si.s * si.kg / si.m**3, 43 particles_per_volume_STP: int = 50 / si.cm**3, 44 dt: float = 1 * si.s, 45 dz: float = 25 * si.m, 46 z_max: float = 3000 * si.m, 47 t_max: float = 3600 * si.s, 48 precip: bool = True, 49 breakup: bool = False, 50 stochastic_breakup: bool = False, 51 warn_breakup_overflow: bool = False, 52 output_every_n_steps: int = 1, 53 save_spec_at=(), 54 ): 55 if stochastic_breakup: 56 self.coalescence_efficiency = Straub2010Ec() 57 self.fragmentation_function = Straub2010Nf(vmin=1 * si.um**3) 58 else: 59 self.coalescence_efficiency = ConstEc(Ec=0.95) 60 frag_scale_r = 30 * si.um 61 frag_scale_v = frag_scale_r**3 * 4 / 3 * np.pi 62 self.fragmentation_function = Gaussian( 63 mu=frag_scale_v, 64 sigma=frag_scale_v / 2, 65 vmin=(1 * si.um) ** 3, 66 nfmax=20, 67 ) 68 69 super().__init__( 70 n_sd_per_gridbox=n_sd_per_gridbox, 71 p0=p0, 72 kappa=kappa, 73 rho_times_w_1=rho_times_w_1, 74 particles_per_volume_STP=particles_per_volume_STP, 75 dt=dt, 76 dz=dz, 77 z_max=z_max, 78 t_max=t_max, 79 precip=precip, 80 formulae=Formulae( 81 fragmentation_function=self.fragmentation_function.__class__.__name__ 82 ), 83 save_spec_and_attr_times=save_spec_at, 84 old_buggy_density_formula=old_buggy_density_formula, 85 ) 86 self.breakup = breakup 87 self.stochastic_breakup = stochastic_breakup 88 89 self.breakup_efficiency = ConstEb(Eb=1.0) 90 91 self.warn_breakup_overflow = warn_breakup_overflow 92 self.output_steps = range(0, self.nt, output_every_n_steps)
14class Settings1D(SettingsSH): 15 def __dir__(self) -> Iterable[str]: 16 return ( 17 "n_sd_per_gridbox", 18 "p0", 19 "kappa", 20 "rho_times_w_1", 21 "particles_per_volume_STP", 22 "dt", 23 "dz", 24 "precip", 25 "breakup", 26 "stochastic_breakup", 27 "z_max", 28 "t_max", 29 "cloud_water_radius_range", 30 "rain_water_radius_range", 31 "r_bins_edges_dry", 32 "r_bins_edges", 33 "save_spec_at", 34 ) 35 36 def __init__( 37 self, 38 *, 39 old_buggy_density_formula: bool, 40 n_sd_per_gridbox: int, 41 p0: float = 1007 * si.hPa, # as used in Olesik et al. 2022 (GMD) 42 kappa: float = 1, 43 rho_times_w_1: float = 2 * si.m / si.s * si.kg / si.m**3, 44 particles_per_volume_STP: int = 50 / si.cm**3, 45 dt: float = 1 * si.s, 46 dz: float = 25 * si.m, 47 z_max: float = 3000 * si.m, 48 t_max: float = 3600 * si.s, 49 precip: bool = True, 50 breakup: bool = False, 51 stochastic_breakup: bool = False, 52 warn_breakup_overflow: bool = False, 53 output_every_n_steps: int = 1, 54 save_spec_at=(), 55 ): 56 if stochastic_breakup: 57 self.coalescence_efficiency = Straub2010Ec() 58 self.fragmentation_function = Straub2010Nf(vmin=1 * si.um**3) 59 else: 60 self.coalescence_efficiency = ConstEc(Ec=0.95) 61 frag_scale_r = 30 * si.um 62 frag_scale_v = frag_scale_r**3 * 4 / 3 * np.pi 63 self.fragmentation_function = Gaussian( 64 mu=frag_scale_v, 65 sigma=frag_scale_v / 2, 66 vmin=(1 * si.um) ** 3, 67 nfmax=20, 68 ) 69 70 super().__init__( 71 n_sd_per_gridbox=n_sd_per_gridbox, 72 p0=p0, 73 kappa=kappa, 74 rho_times_w_1=rho_times_w_1, 75 particles_per_volume_STP=particles_per_volume_STP, 76 dt=dt, 77 dz=dz, 78 z_max=z_max, 79 t_max=t_max, 80 precip=precip, 81 formulae=Formulae( 82 fragmentation_function=self.fragmentation_function.__class__.__name__ 83 ), 84 save_spec_and_attr_times=save_spec_at, 85 old_buggy_density_formula=old_buggy_density_formula, 86 ) 87 self.breakup = breakup 88 self.stochastic_breakup = stochastic_breakup 89 90 self.breakup_efficiency = ConstEb(Eb=1.0) 91 92 self.warn_breakup_overflow = warn_breakup_overflow 93 self.output_steps = range(0, self.nt, output_every_n_steps)
Settings1D( *, old_buggy_density_formula: bool, n_sd_per_gridbox: int, p0: float = 100700.0, kappa: float = 1, rho_times_w_1: float = 2.0, particles_per_volume_STP: int = 49999999.99999999, dt: float = 1.0, dz: float = 25.0, z_max: float = 3000.0, t_max: float = 3600.0, precip: bool = True, breakup: bool = False, stochastic_breakup: bool = False, warn_breakup_overflow: bool = False, output_every_n_steps: int = 1, save_spec_at=())
36 def __init__( 37 self, 38 *, 39 old_buggy_density_formula: bool, 40 n_sd_per_gridbox: int, 41 p0: float = 1007 * si.hPa, # as used in Olesik et al. 2022 (GMD) 42 kappa: float = 1, 43 rho_times_w_1: float = 2 * si.m / si.s * si.kg / si.m**3, 44 particles_per_volume_STP: int = 50 / si.cm**3, 45 dt: float = 1 * si.s, 46 dz: float = 25 * si.m, 47 z_max: float = 3000 * si.m, 48 t_max: float = 3600 * si.s, 49 precip: bool = True, 50 breakup: bool = False, 51 stochastic_breakup: bool = False, 52 warn_breakup_overflow: bool = False, 53 output_every_n_steps: int = 1, 54 save_spec_at=(), 55 ): 56 if stochastic_breakup: 57 self.coalescence_efficiency = Straub2010Ec() 58 self.fragmentation_function = Straub2010Nf(vmin=1 * si.um**3) 59 else: 60 self.coalescence_efficiency = ConstEc(Ec=0.95) 61 frag_scale_r = 30 * si.um 62 frag_scale_v = frag_scale_r**3 * 4 / 3 * np.pi 63 self.fragmentation_function = Gaussian( 64 mu=frag_scale_v, 65 sigma=frag_scale_v / 2, 66 vmin=(1 * si.um) ** 3, 67 nfmax=20, 68 ) 69 70 super().__init__( 71 n_sd_per_gridbox=n_sd_per_gridbox, 72 p0=p0, 73 kappa=kappa, 74 rho_times_w_1=rho_times_w_1, 75 particles_per_volume_STP=particles_per_volume_STP, 76 dt=dt, 77 dz=dz, 78 z_max=z_max, 79 t_max=t_max, 80 precip=precip, 81 formulae=Formulae( 82 fragmentation_function=self.fragmentation_function.__class__.__name__ 83 ), 84 save_spec_and_attr_times=save_spec_at, 85 old_buggy_density_formula=old_buggy_density_formula, 86 ) 87 self.breakup = breakup 88 self.stochastic_breakup = stochastic_breakup 89 90 self.breakup_efficiency = ConstEb(Eb=1.0) 91 92 self.warn_breakup_overflow = warn_breakup_overflow 93 self.output_steps = range(0, self.nt, output_every_n_steps)
Inherited Members
- PySDM_examples.Shipway_and_Hill_2012.settings.Settings
- formulae
- n_sd_per_gridbox
- p0
- kappa
- rho_times_w_1
- particles_per_volume_STP
- dt
- dz
- precip
- enable_condensation
- z_part
- z_max
- t_max
- collision_kernel
- rho_times_w
- particle_reservoir_depth
- wet_radius_spectrum_per_mass_of_dry_air
- water_vapour_mixing_ratio
- thd
- rhod0
- rhod
- mpdata_settings
- condensation_rtol_x
- condensation_rtol_thd
- condensation_adaptive
- condensation_update_thd
- coalescence_adaptive
- number_of_bins
- r_bins_edges_dry
- r_bins_edges
- cloud_water_radius_range
- cloud_water_radius_range_igel
- rain_water_radius_range
- rain_water_radius_range_igel
- save_spec_and_attr_times
- n_sd
- nz
- nt