Skip to content

Commit f02b634

Browse files
committed
add isotopes to simulation kinematic 2d
1 parent f4931b6 commit f02b634

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

examples/PySDM_examples/Strzabala_2026/__init__.py

Whitespace-only changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "initial_id",
7+
"metadata": {
8+
"collapsed": true
9+
},
10+
"outputs": [],
11+
"source": [
12+
"from PySDM_examples.Arabas_et_al_2015 import Settings, SpinUp\n",
13+
"from PySDM_examples.utils.kinematic_2d import Simulation"
14+
]
15+
},
16+
{
17+
"metadata": {},
18+
"cell_type": "code",
19+
"outputs": [],
20+
"execution_count": null,
21+
"source": [
22+
"settings = Settings()\n",
23+
"storage = Storage()\n",
24+
"simulation = Simulation(settings, storage, SpinUp=SpinUp)\n",
25+
"advectees_init_profiles = {\n",
26+
" \"HDO vapour mixing ratio\": np.full(shape=settings.grid[1], fill_value=1e-6),\n",
27+
" \"H18O vapour mixing ratio\": np.full(shape=settings.grid[1], fill_value=1e-6),\n",
28+
" \"H17O vapour mixing ratio\": np.full(shape=settings.grid[1], fill_value=1e-6),\n",
29+
"}\n",
30+
"simulation.reinit(additional_advectees_initial_profiles=advectees_init_profiles)"
31+
],
32+
"id": "c340b54ecdfefc85"
33+
}
34+
],
35+
"metadata": {
36+
"kernelspec": {
37+
"display_name": "Python 3",
38+
"language": "python",
39+
"name": "python3"
40+
},
41+
"language_info": {
42+
"codemirror_mode": {
43+
"name": "ipython",
44+
"version": 2
45+
},
46+
"file_extension": ".py",
47+
"mimetype": "text/x-python",
48+
"name": "python",
49+
"nbconvert_exporter": "python",
50+
"pygments_lexer": "ipython2",
51+
"version": "2.7.6"
52+
}
53+
},
54+
"nbformat": 4,
55+
"nbformat_minor": 5
56+
}

examples/PySDM_examples/utils/kinematic_2d/simulation.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import numpy as np
2+
from numpy import ndarray
3+
24
from PySDM_examples.utils.kinematic_2d.make_default_product_collection import (
35
make_default_product_collection,
46
)
@@ -32,7 +34,11 @@ def __init__(self, settings, storage, SpinUp, backend_class=CPU):
3234
def products(self):
3335
return self.particulator.products
3436

35-
def reinit(self, products=None):
37+
def reinit(
38+
self,
39+
products=None,
40+
additional_advectees_initial_profiles: Dict[str, ndarray] = None,
41+
):
3642
formulae = self.settings.formulae
3743
backend = self.backend_class(formulae=formulae)
3844
environment = Kinematic2D(
@@ -70,6 +76,7 @@ def reinit(self, products=None):
7076
initial_profiles = {
7177
"th": self.settings.initial_dry_potential_temperature_profile,
7278
"water_vapour_mixing_ratio": self.settings.initial_vapour_mixing_ratio_profile,
79+
**(additional_advectees_initial_profiles or {}),
7380
}
7481
advectees = dict(
7582
(

0 commit comments

Comments
 (0)