Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
da754fd
bump PySDM version
slayoo Apr 11, 2021
e865852
increasind sd count in B_et_al_fig_2
slayoo Apr 12, 2021
c92b39c
skipping CI condition for SD number in B_et_al_2021 fig 2
slayoo Apr 12, 2021
4dae7b2
skipping one run on CI in B_et_al_2021 example
slayoo Apr 14, 2021
f19be5f
synx with PySDM
slayoo Apr 16, 2021
243047d
Merge pull request #10 from slayoo/Partridge_et_al_example
slayoo Apr 16, 2021
9c256fe
missing __init__.py
slayoo Apr 16, 2021
77cb5b4
Merge pull request #11 from slayoo/Partridge_et_al_example
slayoo Apr 16, 2021
2ad8f1c
bump PySDM requirement in setup.py
slayoo Apr 17, 2021
80d47d4
sync with upcoming changes in PySDM
slayoo Apr 17, 2021
6419b77
Merge pull request #12 from slayoo/Partridge_et_al_example
slayoo Apr 18, 2021
4b8839a
bump PySDM requirement
slayoo Apr 18, 2021
abe2072
notebook update
slayoo Apr 19, 2021
6b2b381
Merge pull request #13 from slayoo/Partridge_et_al_example
slayoo Apr 19, 2021
382ba61
update to match PySDM physics refactor
slayoo Apr 21, 2021
06fcdc3
temporary PySDM requirement
slayoo Apr 21, 2021
61d4421
Merge branch 'main' into Partridge_et_al_example
slayoo Apr 21, 2021
fb93591
fix
slayoo Apr 21, 2021
7f045cd
Merge remote-tracking branch 'origin/Partridge_et_al_example' into Pa…
slayoo Apr 21, 2021
13eaf83
fixes
slayoo Apr 21, 2021
307f1b6
sync with PySDM
slayoo Apr 22, 2021
3556e37
bump PySDM requirement
slayoo Apr 22, 2021
ea131f0
import fix
slayoo Apr 22, 2021
1934615
coord parameter in AS settings
slayoo Apr 22, 2021
585da6c
removing drop temperature code
slayoo Apr 22, 2021
b5ddb19
bump PySDM req; demo fig sync
slayoo Apr 22, 2021
05cbdc9
fastmath as an argument to A&S settings ctor
slayoo Apr 23, 2021
1d611f4
bump PySDM req
slayoo Apr 24, 2021
9bf5c54
bump PySDM req; default dt cond range in AS example;
slayoo Apr 24, 2021
54bb966
bump PySDM req (sigma, RH_eq)
slayoo Apr 25, 2021
82d6378
fixing Yang example
slayoo Apr 25, 2021
e093799
fixing Yang example
slayoo Apr 25, 2021
cc8e198
sync to match formula updates
slayoo Apr 25, 2021
0ab8d34
sync to match formula updates (vol/rad in trivia)
slayoo Apr 25, 2021
2ab0c99
fixes
slayoo Apr 26, 2021
ee37d04
GH job name
slayoo Apr 26, 2021
d7b22c9
syncing S&H with formulae API update
slayoo Apr 26, 2021
820724f
bump PySDM req
slayoo Apr 26, 2021
812013d
fixing settings in S&H example
slayoo Apr 27, 2021
b1e52c2
bump PySDM req
slayoo Apr 27, 2021
5a3dfee
fixing Berry settings (volume)
slayoo Apr 29, 2021
fb74148
bump PySDM req
slayoo Apr 29, 2021
a34dbdd
sync with PySDM (displacement scheme)
slayoo Apr 29, 2021
5507c52
bump PySDM req.
slayoo Apr 29, 2021
0e7cb29
th_dry API sync
slayoo May 2, 2021
46c8169
formulae API sync
slayoo May 3, 2021
7817741
formulae API sync - PySDM version bump
slayoo May 3, 2021
1c620fd
formulae controls in demo_settings
slayoo May 5, 2021
6494e2c
more settings exposed in the ICMW gui
slayoo May 5, 2021
5eb6226
fixes + bump PySDM req
slayoo May 5, 2021
c19b5d6
bump PySDM req
slayoo May 5, 2021
8bc6fa4
fix simulation.py for S&H example
slayoo May 5, 2021
f8e1e77
random seed -> formulae
slayoo May 6, 2021
6741e6c
removing range/scale from products
slayoo May 6, 2021
231c611
fixes
slayoo May 6, 2021
66ff831
bump PySDM req
slayoo May 6, 2021
c952fe3
cleanups before merging
slayoo May 8, 2021
936502e
Merge pull request #14 from slayoo/Partridge_et_al_example
slayoo May 8, 2021
7bffd98
one warning less
slayoo May 9, 2021
dda7df7
Merge pull request #15 from slayoo/Partridge_et_al_example
slayoo May 9, 2021
0db2119
B_et_al_2021 wip
slayoo May 10, 2021
4fbb5b8
Merge pull request #16 from slayoo/Partridge_et_al_example
slayoo May 10, 2021
54e6a2f
clever __version__ setting in __init__.py
slayoo May 13, 2021
71f7004
Update main.yml
slayoo May 14, 2021
67e4597
use test-time-requirements.txt in GA CI script
slayoo May 14, 2021
6a022d7
Create test-time-requirements.txt
slayoo May 14, 2021
8e786b6
removing TODO
slayoo May 14, 2021
88efb3e
bump PyMPDATA requirement
slayoo May 14, 2021
23c4e18
bump PyMPDATA requirement again
slayoo May 14, 2021
cae116c
Merge pull request #17 from atmos-cloud-sim-uj/slayoo-patch-1
slayoo May 14, 2021
4a48f1a
bump PySDM requirement again
slayoo May 14, 2021
ab8030b
Merge pull request #18 from slayoo/Partridge_et_al_example
slayoo May 14, 2021
ba98f8e
save PyMPDATA version to netCDF file
slayoo May 14, 2021
31fb1cf
Merge pull request #19 from slayoo/Partridge_et_al_example
slayoo May 14, 2021
0372f5e
removing warning filters (as this should now be handled in a more gen…
slayoo May 15, 2021
266034e
bump PyMPDATA req + misc
slayoo May 15, 2021
48be07d
Merge pull request #20 from slayoo/Partridge_et_al_example
slayoo May 15, 2021
45a88e1
bump reqs
slayoo May 17, 2021
8e85347
bump PySDM req, drop version reqs for dependencies
slayoo May 17, 2021
a0fda51
skip setting __version__ if there is a VersionConflict
slayoo May 17, 2021
7dec8b2
bump PySDM req
slayoo May 17, 2021
fe43db7
TODO label [skip ci]
slayoo May 17, 2021
0213fdd
Merge pull request #21 from slayoo/Partridge_et_al_example
slayoo May 17, 2021
b44db9f
bump PySDM req
slayoo May 18, 2021
a803463
skip recording versions of packages for which version is not available
slayoo May 18, 2021
68dd6ab
Merge pull request #22 from slayoo/Partridge_et_al_example
slayoo May 18, 2021
b7044c1
saner update() code within _TimeseriesPlot
slayoo May 18, 2021
ce1804f
Merge pull request #23 from slayoo/Partridge_et_al_example
slayoo May 18, 2021
b970390
chemistry: J&P fig 2 example cleanup
slayoo May 18, 2021
762311f
Merge branch 'main' of github.com:atmos-cloud-sim-uj/PySDM-examples i…
slayoo May 18, 2021
2bbdc37
bump PySDM req
slayoo May 18, 2021
69a685a
dry_rho and dry_molar_mass in aq chem settings; bump PySDM req
slayoo May 18, 2021
24421fa
Merge pull request #24 from slayoo/Partridge_et_al_example
slayoo May 18, 2021
795209d
J&P example updates (fig 3 in particular)
slayoo May 18, 2021
571bd97
Merge pull request #25 from slayoo/Partridge_et_al_example
slayoo May 20, 2021
1d0e80b
bump PySDM req
slayoo May 20, 2021
ef67d2c
accepting GPU as scheme in MSc magic data() method
slayoo May 24, 2021
a34f388
Merge pull request #26 from slayoo/Partridge_et_al_example
slayoo May 24, 2021
1c86247
adding PeakSupersaturation product to Arabas_and_Shima example
piotrbartman May 26, 2021
e2d7354
Merge pull request #27 from piotrbartman/main
slayoo May 26, 2021
c2bab86
adapt to changes in PySDM
slayoo May 26, 2021
bc0bd1f
Merge pull request #28 from slayoo/Partridge_et_al_example
slayoo May 26, 2021
8e4a7a9
Update setup.py
slayoo May 26, 2021
32773f0
bump PySDM req
slayoo May 27, 2021
dfd22d2
updated chemistry plots; bump PySDM req
slayoo May 27, 2021
04fcb1b
Merge branch 'main' of github.com:atmos-cloud-sim-uj/PySDM-examples i…
slayoo May 27, 2021
8c64452
Merge pull request #29 from slayoo/Partridge_et_al_example
slayoo May 27, 2021
32cbeb1
fixing badges
slayoo May 30, 2021
0cba7d1
Merge pull request #30 from slayoo/Partridge_et_al_example
slayoo May 30, 2021
c72f108
bump PySDM req
slayoo May 30, 2021
5e09fcc
Merge pull request #31 from slayoo/Partridge_et_al_example
slayoo May 30, 2021
988dede
sync with PySDM updated on pH calculation methods
slayoo Jun 1, 2021
effbd1c
bump PySDM req; update J&P fig_2
slayoo Jun 1, 2021
f5cd262
adding a note
slayoo Jun 1, 2021
00f98eb
Merge pull request #32 from slayoo/Partridge_et_al_example
slayoo Jun 2, 2021
1073683
post-merge dependency update to point back to master branch
slayoo Jun 2, 2021
154a2ac
sync with PySDM API change (spectra moved to physics)
slayoo Jun 4, 2021
3154599
bump PySDM req
slayoo Jun 4, 2021
d63defc
Merge pull request #33 from slayoo/main
slayoo Jun 4, 2021
cba264a
post-merge requirement redirect to atmos-cloud-sim-uj
slayoo Jun 4, 2021
9a25a0e
extract Freezer and ProgbarUpdater to utils
piotrbartman Jun 8, 2021
037fbe2
Merge pull request #34 from piotrbartman/dev
slayoo Jun 8, 2021
1b245bb
TODO -> note
slayoo Jun 8, 2021
e52e3f3
Merge pull request #35 from slayoo/main
slayoo Jun 8, 2021
d48abfd
note -> TODO
slayoo Jun 8, 2021
18de3ea
Merge pull request #36 from slayoo/main
slayoo Jun 8, 2021
3d9037a
TODO -> note
slayoo Jun 8, 2021
30a78ee
export particles to VTK during run
abulenok Jun 12, 2021
18c23c4
Merge pull request #37 from abulenok/patch-1
slayoo Jun 12, 2021
adc5a3c
Update PySDM version
piotrbartman Jun 18, 2021
99c7063
adapting examples to spectrum moments
piotrbartman Jun 24, 2021
19ec723
Merge pull request #39 from atmos-cloud-sim-uj/spectrum_moments
piotrbartman Jun 25, 2021
f1c32eb
ypdate PySDM version
piotrbartman Jun 25, 2021
322312a
get 0 cell if first dimension equals 1
piotrbartman Jun 25, 2021
b2a1c86
Merge branch 'main' of https://github.com/atmos-cloud-sim-uj/PySDM-ex…
piotrbartman Jun 25, 2021
657de0f
Merge pull request #40 from atmos-cloud-sim-uj/spectrum_moments
piotrbartman Jun 25, 2021
0b7c0a8
PyMPDATA & PySDM version reqs moved from setup to test-time-requireme…
slayoo Jul 11, 2021
a709555
Merge pull request #41 from slayoo/pip
slayoo Jul 11, 2021
38cfb4e
sketches
trontrytel Aug 13, 2021
d58bd36
wip on Abdul-Razzak and Ghan comparison
trontrytel Aug 18, 2021
89b4a1d
ugly fix
trontrytel Aug 18, 2021
e060890
add colab badge
trontrytel Aug 18, 2021
b4c38a9
cleanup Yang
trontrytel Aug 18, 2021
fe409e9
everything in one notebook
trontrytel Aug 18, 2021
b6d7955
Update with r_factors
imdula Aug 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Status
name: PySDM-examples

defaults:
run:
Expand Down Expand Up @@ -27,11 +27,11 @@ jobs:
python-version: ${{ matrix.python-version }}

- run: |
pip install pytest nbconvert
pip install -r test-time-requirements.txt
- run: |
pip install -e .

# TODO #184 (https://github.com/numba/numba/issues/6350#issuecomment-728174860)
# https://github.com/numba/numba/issues/6350#issuecomment-728174860
- if: matrix.platform == 'ubuntu-latest'
env:
NUMBA_THREADING_LAYER: omp
Expand Down
10 changes: 7 additions & 3 deletions PySDM_examples/Arabas_and_Shima_2017/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
from PySDM.physics.constants import si
from PySDM.physics import constants as const, formulae as phys
from PySDM.dynamics import condensation
from PySDM.physics.formulae import Formulae
import numpy as np
from pystrict import strict


@strict
class Settings:
def __init__(self, w_avg: float, N_STP: float, r_dry: float, mass_of_dry_air: float):
def __init__(self, w_avg: float, N_STP: float, r_dry: float, mass_of_dry_air: float, coord: str = 'VolumeLogarithm'):
self.formulae = Formulae(saturation_vapour_pressure='AugustRocheMagnus', condensation_coordinate=coord)

self.p0 = 1000 * si.hectopascals
self.RH0 = .98
self.kappa = .2 # TODO #441
self.T0 = 300 * si.kelvin
self.z_half = 150 * si.metres

self.q0 = const.eps / (self.p0 / self.RH0 / phys.pvs(self.T0) - 1)
pvs = self.formulae.saturation_vapour_pressure.pvs_Celsius(self.T0 - const.T0)
self.q0 = const.eps / (self.p0 / self.RH0 / pvs - 1)
self.w_avg = w_avg
self.r_dry = r_dry
self.N_STP = N_STP
Expand All @@ -29,7 +33,7 @@ def __init__(self, w_avg: float, N_STP: float, r_dry: float, mass_of_dry_air: fl
self.rtol_x = condensation.default_rtol_x
self.rtol_thd = condensation.default_rtol_thd
self.coord = 'volume logarithm'
self.dt_cond_range = (1e-10 * si.s, 1 * si.s)
self.dt_cond_range = condensation.default_cond_range

@property
def dt_max(self):
Expand Down
13 changes: 7 additions & 6 deletions PySDM_examples/Arabas_and_Shima_2017/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, settings, backend=CPU):
while dt_output / self.n_substeps >= settings.dt_max: # TODO #334 dt_max
self.n_substeps += 1

builder = Builder(backend=backend, n_sd=1)
builder = Builder(backend=backend, n_sd=1, formulae=settings.formulae)
builder.set_environment(Parcel(
dt=dt_output / self.n_substeps,
mass_of_dry_air=settings.mass_of_dry_air,
Expand All @@ -43,11 +43,11 @@ def __init__(self, settings, backend=CPU):
))
attributes = {}
r_dry = np.array([settings.r_dry])
attributes['dry volume'] = phys.volume(radius=r_dry)
attributes['dry volume'] = settings.formulae.trivia.volume(radius=r_dry)
attributes['n'] = np.array([settings.n_in_dv], dtype=np.int64)
environment = builder.core.environment
r_wet = r_wet_init(r_dry, environment, np.zeros_like(attributes['n']), settings.kappa)
attributes['volume'] = phys.volume(radius=r_wet)
r_wet = r_wet_init(r_dry, environment, kappa=settings.kappa)
attributes['volume'] = settings.formulae.trivia.volume(radius=r_wet)
products = [
PySDM_products.ParticleMeanRadius(),
PySDM_products.CondensationTimestepMin(),
Expand All @@ -56,7 +56,8 @@ def __init__(self, settings, backend=CPU):
PySDM_products.Time(),
PySDM_products.ActivatingRate(),
PySDM_products.DeactivatingRate(),
PySDM_products.RipeningRate()
PySDM_products.RipeningRate(),
PySDM_products.PeakSupersaturation()
]

self.core = builder.build(attributes, products)
Expand All @@ -67,7 +68,7 @@ def save(self, output):
cell_id = 0
output["r"].append(self.core.products['radius_m1'].get(unit=const.si.metre)[cell_id])
output["dt_cond_min"].append(self.core.products['dt_cond_min'].get()[cell_id])
output["z"].append(self.core.products["z"].get())
output["z"].append(self.core.products["z"].get()[cell_id])
output["S"].append(self.core.products["RH_env"].get()[cell_id]/100 - 1)
output["t"].append(self.core.products["t"].get())

Expand Down
39 changes: 33 additions & 6 deletions PySDM_examples/Arabas_et_al_2015/demo_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import matplotlib
import matplotlib.pyplot as plt
import numpy as np

from PySDM import products

class _Plot:

Expand Down Expand Up @@ -37,9 +37,36 @@ def __init__(self, fig, ax, grid, size, product, show=False, lines=False, cmap='
self.lines['X'][1] = plt.plot([-1] * 2, zlim, **self.line_args)[0]
self.lines['Z'][1] = plt.plot(xlim, [-1] * 2, **self.line_args)[0]

data = np.full_like(self.nans, product.range[0])
product_range, product_scale = {
products.WaterMixingRatio: ((0, 1), 'linear'),
products.TotalParticleSpecificConcentration: ((20, 50), 'linear'),
products.TotalParticleConcentration: ((20, 50), 'linear'),
products.SuperDropletCount: ((0, 10), 'linear'),
products.ParticlesVolumeSpectrum: ((20, 50), 'linear'),
products.AerosolConcentration: ((1e0, 1e2), 'linear'),
products.CloudDropletConcentration: ((1e0, 1e2), 'linear'),
products.DrizzleConcentration: ((1e-3, 1e1), 'log'),
products.ParticleMeanRadius: ((1, 25), 'linear'),
products.CloudDropletEffectiveRadius: ((0, 25), 'linear'),
products.AerosolSpecificConcentration: ((0, 3e2), 'linear'),
products.WaterVapourMixingRatio: ((5, 7.5), 'linear'),
products.Temperature: ((275, 305), 'linear'),
products.RelativeHumidity: ((75, 105), 'linear'),
products.Pressure: ((90000, 100000), 'linear'),
products.DryAirPotentialTemperature: ((275, 300), 'linear'),
products.DryAirDensity: ((0.95, 1.3), 'linear'),
products.PeakSupersaturation: ((-1, 1), 'linear'),
products.RipeningRate: ((1e-1, 1e1), 'log'),
products.ActivatingRate: ((1e-1, 1e1), 'log'),
products.DeactivatingRate: ((1e-1, 1e1), 'log'),
products.CollisionRateDeficit: ((0, 1e10), 'linear'),
products.CollisionRate: ((0, 1e10), 'linear'),
products.CondensationTimestepMin: ((.01, 10), 'log'),
products.CondensationTimestepMax: ((.01, 10), 'log'),
products.CoalescenceTimestepMin: ((.01, 10), 'log'),
}[product.__class__]
data = np.full_like(self.nans, product_range[0])
label = f"{product.description} [{product.unit}]"
scale = product.scale

self.ax.set_xlabel('X [m]')
self.ax.set_ylabel('Z [m]')
Expand All @@ -48,11 +75,11 @@ def __init__(self, fig, ax, grid, size, product, show=False, lines=False, cmap='
origin='lower',
extent=(*xlim, *zlim),
cmap=cmap,
norm=matplotlib.colors.LogNorm() if scale == 'log' and np.isfinite(
norm=matplotlib.colors.LogNorm() if product_scale == 'log' and np.isfinite(
data).all() else None # TODO #37 this is always None!!!
)
plt.colorbar(self.im, ax=self.ax).set_label(label)
self.im.set_clim(vmin=product.range[0], vmax=product.range[1])
self.im.set_clim(vmin=product_range[0], vmax=product_range[1])
if show:
plt.show()

Expand Down Expand Up @@ -117,5 +144,5 @@ def update(self, data):
if data is not None:
self.ydata[0:len(data)] = data[:]
else:
self.ydata[0:len(data)] = np.nan
self.ydata[:] = np.nan
self.timeseries.set_ydata(self.ydata)
77 changes: 57 additions & 20 deletions PySDM_examples/Arabas_et_al_2015/demo_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@

from ..utils.widgets import IntSlider, FloatSlider, VBox, Checkbox, Accordion, Dropdown
from PySDM_examples.Arabas_et_al_2015.settings import Settings
from PySDM import physics
import numpy as np
import numba
import os
import inspect


class DemoSettings:
__dir__ = Settings.__dir__

def __init__(self):
settings = Settings()

self.ui_th_std0 = FloatSlider(description="$\\theta_0$ [K]", value=settings.th_std0, min=280, max=300)
self.ui_qv0 = FloatSlider(description="q$_{v0}$ [g/kg]", value=settings.qv0 * 1000, min=5, max=10)
self.ui_p0 = FloatSlider(description="p$_0$ [hPa]", value=settings.p0 / 100, min=900, max=1100)
Expand Down Expand Up @@ -43,10 +46,6 @@ def __init__(self):
self.ui_coalescence_adaptive = Checkbox(
value=settings.condensation_adaptive,
description='coalescence adaptive time-step')
self.ui_condensation_coord = Dropdown(
options=['volume', 'volume logarithm'],
value=settings.condensation_coord,
description='condensational variable coordinate')
self.ui_processes = [Checkbox(value=settings.processes[key], description=key) for key in settings.processes.keys()]
self.ui_sdpg = IntSlider(value=settings.n_sd_per_gridbox, description="n_sd/gridbox", min=1, max=1000)
self.fct_description = "MPDATA: flux-corrected transport option"
Expand All @@ -59,27 +58,65 @@ def __init__(self):
Checkbox(value=settings.mpdata_iga, description=self.iga_description),
IntSlider(value=settings.mpdata_iters, description=self.nit_description, min=1, max=5)
]
self.ui_formulae_options = [
Dropdown(
description=k,
options=physics.formulae._choices(getattr(physics, k)).keys(),
value=v.default
)
for k, v in inspect.signature(physics.Formulae.__init__).parameters.items()
if k not in ('self', 'fastmath', 'seed')
]
self.ui_formulae_options.append(
Checkbox(
value=inspect.signature(physics.Formulae.__init__).parameters['fastmath'].default,
description='fastmath'
)
)
self.ui_output_options = {
'interval': IntSlider(description='interval [s]', value=settings.output_interval, min=30, max=60*15),
'aerosol_radius_threshold': FloatSlider(
description='aerosol/cloud threshold [um]',
value=settings.aerosol_radius_threshold / physics.si.um,
min=.1, max=1, step=.1),
'drizzle_radius_threshold': IntSlider(
description='cloud/drizzle threshold [um]',
value=settings.drizzle_radius_threshold / physics.si.um,
min=10, max=100, step=5)
}

# TODO #37
self.v_bins = settings.v_bins
self.n_sd = settings.n_sd
self.r_bins_edges = settings.r_bins_edges
self.size = settings.size
self.rhod = settings.rhod
self.field_values = settings.field_values
self.aerosol_radius_threshold = settings.aerosol_radius_threshold
self.drizzle_radius_threshold = settings.drizzle_radius_threshold
self.stream_function = settings.stream_function
self.condensation_substeps = settings.condensation_substeps
self.condensation_dt_cond_range = settings.condensation_dt_cond_range
self.condensation_schedule = settings.condensation_schedule
self.kernel = settings.kernel
self.spectrum_per_mass_of_dry_air = settings.spectrum_per_mass_of_dry_air
self.n_spin_up = settings.n_spin_up
self.coalescence_dt_coal_range = settings.coalescence_dt_coal_range
self.coalescence_optimized_random = settings.coalescence_optimized_random
self.coalescence_substeps = settings.coalescence_substeps
self.output_interval = settings.output_interval
self.versions = settings.versions

for attr in ('n_sd', 'rhod', 'field_values', 'versions', 'n_spin_up', 'stream_function'):
setattr(self, attr, getattr(settings, attr))

@property
def aerosol_radius_threshold(self):
return self.ui_output_options['aerosol_radius_threshold'].value * physics.si.um

@property
def drizzle_radius_threshold(self):
return self.ui_output_options['drizzle_radius_threshold'].value * physics.si.um

@property
def output_interval(self):
return self.ui_output_options['interval'].value

@property
def formulae(self) -> physics.Formulae:
return physics.Formulae(
**{widget.description: widget.value for widget in self.ui_formulae_options}
)

@property
def steps_per_output_interval(self) -> int:
Expand Down Expand Up @@ -137,10 +174,6 @@ def condensation_adaptive(self):
def coalescence_adaptive(self):
return self.ui_coalescence_adaptive.value

@property
def condensation_coord(self):
return self.ui_condensation_coord.value

@property
def processes(self):
result = {}
Expand Down Expand Up @@ -186,10 +219,14 @@ def box(self):
VBox([*self.ui_processes]),
VBox([self.ui_nx, self.ui_nz, self.ui_sdpg, self.ui_dt, self.ui_simulation_time,
self.ui_condensation_rtol_x, self.ui_condensation_rtol_thd,
self.ui_condensation_adaptive, self.ui_coalescence_adaptive, self.ui_condensation_coord,
self.ui_condensation_adaptive, self.ui_coalescence_adaptive,
*self.ui_mpdata_options]),
VBox([*self.ui_formulae_options]),
VBox([*self.ui_output_options.values()])
])
layout.set_title(0, 'environment parameters')
layout.set_title(0, 'environment')
layout.set_title(1, 'processes')
layout.set_title(2, 'discretisation')
layout.set_title(3, 'physics')
layout.set_title(4, 'output')
return layout
2 changes: 1 addition & 1 deletion PySDM_examples/Arabas_et_al_2015/demo_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def reinit(self, products):
if len(val.shape) == 2
]

r_bins = phys.radius(volume=self.settings.v_bins)
r_bins = self.settings.r_bins_edges.copy()
const.convert_to(r_bins, const.si.micrometres)
self.spectrumOutput = Output()
with self.spectrumOutput:
Expand Down
7 changes: 2 additions & 5 deletions PySDM_examples/Arabas_et_al_2015/mpdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,5 @@ def wait(self):
self.thread.join()

def step(self):
try: # TODO #417: move this to within PyMPDATA
for mpdata in self.mpdatas.values():
mpdata.advance(1)
except NumbaExperimentalFeatureWarning:
pass
for mpdata in self.mpdatas.values():
mpdata.advance(1)
6 changes: 4 additions & 2 deletions PySDM_examples/Arabas_et_al_2015/netcdf_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ def _create_dimensions(self, ncdf):
ncdf.createDimension("T", len(self.settings.output_steps))
for index, label in enumerate(self.XZ):
ncdf.createDimension(label, self.settings.grid[index])
ncdf.createDimension("ParticleVolume", len(self.settings.v_bins) - 1)
ncdf.createDimension("ParticleVolume",
len(self.settings.formulae.trivia.volume(self.settings.r_bins_edges)) - 1)

def _create_variables(self, ncdf):
self.vars["T"] = ncdf.createVariable("T", "f", ["T"])
self.vars["T"].units = "seconds"

for index, label in enumerate(self.XZ):
self.vars[label] = ncdf.createVariable(label, "f", (label,))
self.vars[label][:] = (self.settings.size[index] / self.settings.grid[index]) * (1 / 2 + np.arange(self.settings.grid[index]))
self.vars[label][:] = ((self.settings.size[index] / self.settings.grid[index])
* (1 / 2 + np.arange(self.settings.grid[index])))
self.vars[label].units = "metres"

# TODO #340 ParticleVolume var
Expand Down
Loading