diff --git a/PySDM/physics/isotope_relaxation_timescale/bolin_1958.py b/PySDM/physics/isotope_relaxation_timescale/bolin_1958.py
index dd73aedf9..1902ec58c 100644
--- a/PySDM/physics/isotope_relaxation_timescale/bolin_1958.py
+++ b/PySDM/physics/isotope_relaxation_timescale/bolin_1958.py
@@ -10,8 +10,60 @@ class Bolin1958: # pylint: disable=too-few-public-methods
def __init__(self, const):
assert np.isfinite(const.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1)
+ @staticmethod
+ # pylint: disable=too-many-arguments unused-argument
+ def tau_of_rdrdt(const, radius, r_dr_dt, alpha=0):
+ """timescale for evaporation of a falling drop with tritium"""
+ return -(radius**2) / 3 / r_dr_dt * const.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1
+
@staticmethod
# pylint: disable=too-many-arguments
- def tau(const, radius, r_dr_dt):
+ def c1_coeff(
+ const,
+ vent_coeff_iso,
+ vent_coeff,
+ D_iso,
+ D,
+ alpha,
+ rho_env_iso,
+ rho_env,
+ M_iso,
+ pvs_iso,
+ pvs_water,
+ temperature,
+ ):
+ return (
+ vent_coeff_iso
+ * D_iso
+ / vent_coeff
+ / D
+ / alpha
+ / pvs_iso
+ * pvs_water
+ * (rho_env_iso / M_iso - pvs_iso / const.R_str / temperature)
+ / (rho_env / const.Mv - pvs_water / const.R_str / temperature)
+ )
+
+ @staticmethod
+ # pylint: disable=too-many-arguments
+ def tau_of_rdrdt_c1(radius, r_dr_dt, c1_coeff):
"""timescale for evaporation of a falling drop with tritium"""
- return (-3 / radius**2 * r_dr_dt * const.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1) ** -1
+ return -(radius**2) / 3 / r_dr_dt / c1_coeff
+
+ @staticmethod
+ # pylint: disable=too-many-arguments
+ def tau_without_assumptions(
+ const, radius, alpha, D, vent_coeff, rho_env, M, temperature, pvs_water, pvs
+ ):
+ return (
+ alpha
+ * radius**2
+ / 3
+ * const.rho_w
+ / D
+ / vent_coeff
+ / const.Mv
+ * pvs
+ / pvs_water
+ / (rho_env / M - pvs / const.R_STR / temperature)
+ )
diff --git a/PySDM/physics/isotope_relaxation_timescale/miyake_et_al_1968.py b/PySDM/physics/isotope_relaxation_timescale/miyake_et_al_1968.py
index 56736930e..5c0ab1709 100644
--- a/PySDM/physics/isotope_relaxation_timescale/miyake_et_al_1968.py
+++ b/PySDM/physics/isotope_relaxation_timescale/miyake_et_al_1968.py
@@ -11,3 +11,8 @@ def tau(const, e_s, D, M, vent_coeff, radius, alpha, temperature):
return (radius**2 * alpha * const.rho_w * const.R_str * temperature) / (
3 * e_s * D * M * vent_coeff
)
+
+ @staticmethod
+ # pylint: disable=too-many-arguments unused-argument
+ def tau_of_rdrdt(const, radius, r_dr_dt, alpha):
+ return -(radius**2) / 3 / r_dr_dt * alpha
diff --git a/examples/PySDM_examples/Bolin_1958/common.py b/examples/PySDM_examples/Bolin_1958/common.py
new file mode 100644
index 000000000..72614fad9
--- /dev/null
+++ b/examples/PySDM_examples/Bolin_1958/common.py
@@ -0,0 +1,46 @@
+from functools import partial
+from PySDM import Formulae
+
+
+class IsotopeTimescaleCommon:
+ def __init__(self, settings, temperature, radii):
+ self.radii = radii
+ self.formulae = Formulae(**settings)
+ self.temperature = temperature
+ self.pressure = self.formulae.constants.p_STP
+ self.v_term = self.formulae.terminal_velocity.v_term(radii)
+ self.D = self.formulae.diffusion_thermics.D(T=self.temperature, p=self.pressure)
+
+ def vent_coeff_fun(self):
+ eta_air = self.formulae.air_dynamic_viscosity.eta_air(self.temperature)
+ air_density = self.pressure / self.formulae.constants.Rd / self.temperature
+
+ assert abs(air_density - 1) / air_density < 0.3
+
+ Re = self.formulae.particle_shape_and_density.reynolds_number(
+ radius=self.radii,
+ velocity_wrt_air=self.v_term,
+ dynamic_viscosity=eta_air,
+ density=air_density,
+ )
+ Sc = self.formulae.trivia.air_schmidt_number(
+ dynamic_viscosity=eta_air,
+ diffusivity=self.D,
+ density=air_density,
+ )
+
+ return self.formulae.ventilation.ventilation_coefficient(
+ sqrt_re_times_cbrt_sc=self.formulae.trivia.sqrt_re_times_cbrt_sc(
+ Re=Re, Sc=Sc
+ )
+ )
+
+ def r_dr_dt_fun(self, K):
+ return partial(
+ self.formulae.drop_growth.r_dr_dt,
+ T=self.temperature,
+ pvs=self.formulae.saturation_vapour_pressure.pvs_water(self.temperature),
+ D=self.D,
+ K=K,
+ ventilation_factor=self.vent_coeff_fun(),
+ )
diff --git a/examples/PySDM_examples/Bolin_1958/table_1.ipynb b/examples/PySDM_examples/Bolin_1958/table_1.ipynb
index add988a95..e15acb81d 100644
--- a/examples/PySDM_examples/Bolin_1958/table_1.ipynb
+++ b/examples/PySDM_examples/Bolin_1958/table_1.ipynb
@@ -21,8 +21,8 @@
"id": "5e4e58050cc01f64",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-12-05T21:30:20.214060Z",
- "start_time": "2024-12-05T21:30:20.209298Z"
+ "end_time": "2025-02-07T14:51:42.815887Z",
+ "start_time": "2025-02-07T14:51:42.812266Z"
}
},
"source": [
@@ -40,113 +40,84 @@
"id": "95f360dc62f373f9",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-12-05T21:30:21.622672Z",
- "start_time": "2024-12-05T21:30:20.218383Z"
+ "end_time": "2025-02-07T14:51:44.523180Z",
+ "start_time": "2025-02-07T14:51:42.819689Z"
}
},
"source": [
- "import numpy as np\n",
"import pandas\n",
+ "import numpy as np\n",
"from PySDM.physics import in_unit, si\n",
- "from PySDM import Formulae"
+ "from PySDM import Formulae\n",
+ "from PySDM_examples.Bolin_1958.common import IsotopeTimescaleCommon"
],
"outputs": [],
"execution_count": 2
},
{
- "cell_type": "code",
- "id": "e29a92d6680c4e51",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-12-05T21:30:21.689116Z",
- "start_time": "2024-12-05T21:30:21.687254Z"
+ "end_time": "2025-02-07T14:51:44.630655Z",
+ "start_time": "2025-02-07T14:51:44.613229Z"
}
},
- "source": "radii = np.asarray([0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.20]) * si.cm",
+ "cell_type": "code",
+ "source": [
+ "any_non_zero_value = 44.0\n",
+ "radii = np.asarray([0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.20]) * si.cm\n",
+ "formulae = Formulae(\n",
+ " terminal_velocity=\"RogersYau\",\n",
+ " drop_growth=\"Mason1951\",\n",
+ " diffusion_thermics=\"Neglect\",\n",
+ " saturation_vapour_pressure=\"AugustRocheMagnus\",\n",
+ " ventilation=\"Froessling1938\",\n",
+ " particle_shape_and_density=\"LiquidSpheres\",\n",
+ " air_dynamic_viscosity=\"ZografosEtAl1987\",\n",
+ " constants={\"BOLIN_ISOTOPE_TIMESCALE_COEFF_C1\": 1.63},\n",
+ " isotope_relaxation_timescale=\"Bolin1958\",\n",
+ ")\n",
+ "temperature = formulae.constants.T0 + 10 * si.K\n",
+ "iso_fun = IsotopeTimescaleCommon(settings=settings, temperature=temperature, radii=radii)\n",
+ "r_dr_dt = iso_fun.r_dr_dt_fun(K=any_non_zero_value)\n",
+ "adjustment_time = formulae.isotope_relaxation_timescale.tau_of_rdrdt(radius = radii, r_dr_dt = r_dr_dt(RH=0, RH_eq=1, lv=0))"
+ ],
+ "id": "4a8c2bd612c892f2",
"outputs": [],
"execution_count": 3
},
{
"metadata": {
"ExecuteTime": {
- "end_time": "2024-12-05T21:30:24.420354Z",
- "start_time": "2024-12-05T21:30:21.698737Z"
+ "end_time": "2025-02-07T14:51:44.647096Z",
+ "start_time": "2025-02-07T14:51:44.636800Z"
}
},
"cell_type": "code",
"source": [
- "formulae = Formulae(\n",
- " terminal_velocity='RogersYau',\n",
- " drop_growth='Mason1951',\n",
- " diffusion_thermics='Neglect',\n",
- " saturation_vapour_pressure='AugustRocheMagnus',\n",
- " ventilation='Froessling1938',\n",
- " particle_shape_and_density='LiquidSpheres',\n",
- " air_dynamic_viscosity='ZografosEtAl1987',\n",
- " constants={'BOLIN_ISOTOPE_TIMESCALE_COEFF_C1': 1.63},\n",
- " isotope_relaxation_timescale='Bolin1958',\n",
- ")\n",
- "const = formulae.constants\n",
- "any_non_zero_value = 44.\n",
- "temperature = const.T0 + 10 * si.K\n",
- "pressure = const.p_STP\n",
- "pvs = formulae.saturation_vapour_pressure.pvs_water(temperature)\n",
- "v_term = formulae.terminal_velocity.v_term(radii)\n",
- "eta_air=formulae.air_dynamic_viscosity.eta_air(temperature)\n",
- "D=formulae.diffusion_thermics.D(T=temperature, p=pressure)\n",
- "\n",
- "air_density = pressure/const.Rd/temperature\n",
- "assert abs(air_density - 1)/air_density <.3\n",
- "Re = formulae.particle_shape_and_density.reynolds_number(\n",
- " radius=radii,\n",
- " velocity_wrt_air=v_term,\n",
- " dynamic_viscosity=eta_air,\n",
- " density=air_density,\n",
- ")\n",
- "Sc = formulae.trivia.air_schmidt_number(\n",
- " dynamic_viscosity=eta_air, \n",
- " diffusivity=D, \n",
- " density=air_density,\n",
- ")\n",
- "F = formulae.ventilation.ventilation_coefficient(sqrt_re_times_cbrt_sc=Re**(1/2) * Sc**(1/3))\n",
- "\n",
- "r_dr_dt = formulae.drop_growth.r_dr_dt(\n",
- " RH_eq=1,\n",
- " T=temperature,\n",
- " RH=0,\n",
- " lv=0,\n",
- " pvs=pvs,\n",
- " D=D,\n",
- " K=any_non_zero_value,\n",
- " ventilation_factor=F\n",
- ")\n",
- "adjustment_time = formulae.isotope_relaxation_timescale.tau(radius = radii, r_dr_dt = r_dr_dt)\n",
- "\n",
- "\n",
"pandas.options.display.float_format = '{:>,.2g}'.format\n",
"data = pandas.DataFrame({\n",
" 'radius [cm]': in_unit(radii, si.cm),\n",
" 'adjustment time [s]': adjustment_time,\n",
- " 'terminal velocity [m/s]': v_term,\n",
- " 'distance [m]': v_term * adjustment_time,\n",
+ " 'terminal velocity [m/s]': iso_fun.v_term,\n",
+ " 'distance [m]': iso_fun.v_term * adjustment_time,\n",
"})\n",
"\n",
"data # pylint: disable=pointless-statement"
],
- "id": "314f42c310883cfa",
+ "id": "340812de267c4290",
"outputs": [
{
"data": {
"text/plain": [
" radius [cm] adjustment time [s] terminal velocity [m/s] distance [m]\n",
- "0 0.005 1.7 0.4 0.69\n",
- "1 0.01 5.4 0.8 4.3\n",
- "2 0.025 20 2 40\n",
- "3 0.05 48 4 1.9e+02\n",
- "4 0.075 81 5.5 4.4e+02\n",
- "5 0.1 1.2e+02 6.4 7.6e+02\n",
- "6 0.15 2e+02 7.8 1.6e+03\n",
- "7 0.2 3e+02 9 2.7e+03"
+ "0 0.005 4.6 0.4 1.8\n",
+ "1 0.01 14 0.8 11\n",
+ "2 0.025 54 2 1.1e+02\n",
+ "3 0.05 1.3e+02 4 5.1e+02\n",
+ "4 0.075 2.1e+02 5.5 1.2e+03\n",
+ "5 0.1 3.2e+02 6.4 2e+03\n",
+ "6 0.15 5.4e+02 7.8 4.2e+03\n",
+ "7 0.2 7.9e+02 9 7.1e+03"
],
"text/html": [
"
\n",
@@ -177,58 +148,58 @@
"
\n",
" 0 | \n",
" 0.005 | \n",
- " 1.7 | \n",
+ " 4.6 | \n",
" 0.4 | \n",
- " 0.69 | \n",
+ " 1.8 | \n",
"
\n",
"
\n",
" 1 | \n",
" 0.01 | \n",
- " 5.4 | \n",
+ " 14 | \n",
" 0.8 | \n",
- " 4.3 | \n",
+ " 11 | \n",
"
\n",
"
\n",
" 2 | \n",
" 0.025 | \n",
- " 20 | \n",
+ " 54 | \n",
" 2 | \n",
- " 40 | \n",
+ " 1.1e+02 | \n",
"
\n",
"
\n",
" 3 | \n",
" 0.05 | \n",
- " 48 | \n",
+ " 1.3e+02 | \n",
" 4 | \n",
- " 1.9e+02 | \n",
+ " 5.1e+02 | \n",
"
\n",
"
\n",
" 4 | \n",
" 0.075 | \n",
- " 81 | \n",
+ " 2.1e+02 | \n",
" 5.5 | \n",
- " 4.4e+02 | \n",
+ " 1.2e+03 | \n",
"
\n",
"
\n",
" 5 | \n",
" 0.1 | \n",
- " 1.2e+02 | \n",
+ " 3.2e+02 | \n",
" 6.4 | \n",
- " 7.6e+02 | \n",
+ " 2e+03 | \n",
"
\n",
"
\n",
" 6 | \n",
" 0.15 | \n",
- " 2e+02 | \n",
+ " 5.4e+02 | \n",
" 7.8 | \n",
- " 1.6e+03 | \n",
+ " 4.2e+03 | \n",
"
\n",
"
\n",
" 7 | \n",
" 0.2 | \n",
- " 3e+02 | \n",
+ " 7.9e+02 | \n",
" 9 | \n",
- " 2.7e+03 | \n",
+ " 7.1e+03 | \n",
"
\n",
" \n",
"\n",
@@ -241,6 +212,19 @@
}
],
"execution_count": 4
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T14:51:44.668885Z",
+ "start_time": "2025-02-07T14:51:44.666532Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "",
+ "id": "eeec7e163ba8c4ea",
+ "outputs": [],
+ "execution_count": null
}
],
"metadata": {
diff --git a/examples/PySDM_examples/Bolin_1958/timescales_comparison.ipynb b/examples/PySDM_examples/Bolin_1958/timescales_comparison.ipynb
new file mode 100644
index 000000000..52efba8b0
--- /dev/null
+++ b/examples/PySDM_examples/Bolin_1958/timescales_comparison.ipynb
@@ -0,0 +1,360 @@
+{
+ "cells": [
+ {
+ "metadata": {},
+ "cell_type": "markdown",
+ "source": [
+ "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PySDM/blob/main/examples/PySDM_examples/Bolin_1958/timescales_comparison.ipynb)\n",
+ "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PySDM.git/main?urlpath=lab/tree/examples/PySDM_examples/Bolin_1958/timescales_comparison.ipynb)\n",
+ "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PySDM/blob/main/examples/PySDM_examples/Bolin_1958/timescales_comparison.ipynb)"
+ ],
+ "id": "da62f9aa77468520"
+ },
+ {
+ "metadata": {},
+ "cell_type": "markdown",
+ "source": [
+ "#### Timescales comparison \n",
+ "##### Bolin\n",
+ "##### Gedzelman"
+ ],
+ "id": "c7eb55d509c585e9"
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.830842Z",
+ "start_time": "2025-02-07T15:35:20.825742Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import sys\n",
+ "if 'google.colab' in sys.modules:\n",
+ " !pip --quiet install open-atmos-jupyter-utils\n",
+ " from open_atmos_jupyter_utils import pip_install_on_colab\n",
+ " pip_install_on_colab('PySDM-examples')"
+ ],
+ "id": "f508348dd491651d",
+ "outputs": [],
+ "execution_count": 11
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.850507Z",
+ "start_time": "2025-02-07T15:35:20.847499Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import numpy as np\n",
+ "from PySDM.physics import si\n",
+ "from PySDM import Formulae\n",
+ "from PySDM_examples.Bolin_1958.common import IsotopeTimescaleCommon\n",
+ "from open_atmos_jupyter_utils import show_plot"
+ ],
+ "id": "c680144e7ad3b94a",
+ "outputs": [],
+ "execution_count": 12
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.872132Z",
+ "start_time": "2025-02-07T15:35:20.860889Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "any_non_zero_value = 44.0\n",
+ "radii = np.asarray([0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.20]) * si.cm\n",
+ "temperature = Formulae().constants.T0 + 10 * si.K\n",
+ "\n",
+ "settings = {\n",
+ " \"terminal_velocity\":\"RogersYau\",\n",
+ " \"drop_growth\":\"Mason1951\",\n",
+ " \"diffusion_thermics\":\"Neglect\",\n",
+ " \"saturation_vapour_pressure\":\"AugustRocheMagnus\",\n",
+ " \"ventilation\":\"Froessling1938\",\n",
+ " \"particle_shape_and_density\":\"LiquidSpheres\",\n",
+ " \"air_dynamic_viscosity\":\"ZografosEtAl1987\",\n",
+ "}\n",
+ "\n",
+ "variants = {\n",
+ " 'bolin': {\n",
+ " 'constants': {\"BOLIN_ISOTOPE_TIMESCALE_COEFF_C1\": 1.63},\n",
+ " 'isotope_relaxation_timescale': \"Bolin1958\",\n",
+ " },\n",
+ " 'miyake': {\n",
+ " 'isotope_relaxation_timescale': \"MiyakeEtAl1968\",\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "adjustment_time = {}"
+ ],
+ "id": "14eb5ccfadb724b4",
+ "outputs": [],
+ "execution_count": 13
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.881247Z",
+ "start_time": "2025-02-07T15:35:20.879536Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "## Bolin & Miyake",
+ "id": "fa60b9096c1e7645",
+ "outputs": [],
+ "execution_count": 14
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.891434Z",
+ "start_time": "2025-02-07T15:35:20.885737Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "for variant, kwargs in variants.items():\n",
+ " new_settings = {**kwargs, **settings}\n",
+ " iso_func = IsotopeTimescaleCommon(settings=new_settings, temperature=temperature, radii=radii)\n",
+ " r_dr_dt = iso_func.r_dr_dt_fun(K=any_non_zero_value)\n",
+ " adjustment_time[variant] = iso_func.formulae.isotope_relaxation_timescale.tau_of_rdrdt(\n",
+ " radius = radii,\n",
+ " r_dr_dt = r_dr_dt(RH=0, RH_eq=1, lv=0),\n",
+ " alpha=1\n",
+ " )"
+ ],
+ "id": "c5b65e0aa78917e9",
+ "outputs": [],
+ "execution_count": 15
+ },
+ {
+ "metadata": {},
+ "cell_type": "markdown",
+ "source": "## Bolin - check c1",
+ "id": "bbbe4fe40c27d3da"
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.901050Z",
+ "start_time": "2025-02-07T15:35:20.897307Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "iso_func = IsotopeTimescaleCommon(settings={**settings, **variants['bolin']}, temperature=temperature, radii=radii)\n",
+ "r_dr_dt = iso_func.r_dr_dt_fun(K=any_non_zero_value)\n",
+ "\n",
+ "vent_coeff = iso_func.vent_coeff_fun()\n",
+ "alpha = 0.75\n",
+ "c1_coeff = iso_func.formulae.isotope_relaxation_timescale.c1_coeff(\n",
+ " vent_coeff_iso = vent_coeff,\n",
+ " vent_coeff = vent_coeff,\n",
+ " D_iso = iso_func.D,\n",
+ " D = iso_func.D, \n",
+ " alpha = alpha,\n",
+ " rho_env_iso = 0,\n",
+ " rho_env = 0,\n",
+ " M_iso = 1, #any number const.M_3H,\n",
+ " pvs_iso = 1, #any number\n",
+ " pvs_water =1, #any number isotope_functions.formulae.saturation_vapour_pressure.pvs_water(temperature),\n",
+ " temperature = iso_func.temperature,\n",
+ ")\n",
+ "print(f\"c1 = {c1_coeff[0]:.2f},\\nBolin's c1 = {iso_func.formulae.constants.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1}\")\n",
+ "adjustment_time['bolin_c1'] = iso_func.formulae.isotope_relaxation_timescale.tau_of_rdrdt_c1(\n",
+ " radius = radii,\n",
+ " r_dr_dt = r_dr_dt(RH=0, RH_eq=1, lv=0),\n",
+ " c1_coeff = c1_coeff\n",
+ ")"
+ ],
+ "id": "d24be9aa792c4c95",
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "c1 = 1.33,\n",
+ "Bolin's c1 = 1.63\n"
+ ]
+ }
+ ],
+ "execution_count": 16
+ },
+ {
+ "metadata": {},
+ "cell_type": "markdown",
+ "source": [
+ "## Bolin without RH_env = 0 assumption\n",
+ "# TODO how to fix copy paste"
+ ],
+ "id": "a9f84676e11de4e8"
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:40.505491Z",
+ "start_time": "2025-02-07T15:35:40.498979Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "alpha = 0.75\n",
+ "c1_coeff = iso_func.formulae.isotope_relaxation_timescale.c1_coeff(\n",
+ " vent_coeff_iso = vent_coeff,\n",
+ " vent_coeff = vent_coeff,\n",
+ " D_iso = iso_func.D,\n",
+ " D = iso_func.D, \n",
+ " alpha = alpha,\n",
+ " rho_env_iso = iso_func.formulae.constants.VSMOW_R_2H, \n",
+ " rho_env = 0,\n",
+ " M_iso = iso_func.formulae.constants.M_3H,\n",
+ " pvs_iso = iso_func.formulae.saturation_vapour_pressure.pvs_water(temperature), #any number\n",
+ " pvs_water = iso_func.formulae.saturation_vapour_pressure.pvs_water(temperature),\n",
+ " temperature = iso_func.temperature,\n",
+ ")\n",
+ "print(f\"c1 = {c1_coeff[0]:.2f},\\nBolin's c1 = {iso_func.formulae.constants.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1}\")\n",
+ "adjustment_time['bolin_c1'] = iso_func.formulae.isotope_relaxation_timescale.tau_of_rdrdt_c1(\n",
+ " radius = radii,\n",
+ " r_dr_dt = r_dr_dt(RH=0, RH_eq=1, lv=0),\n",
+ " c1_coeff = c1_coeff\n",
+ ")"
+ ],
+ "id": "f5f11eb4ff50e22a",
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "c1 = 1.20,\n",
+ "Bolin's c1 = 1.63\n"
+ ]
+ }
+ ],
+ "execution_count": 20
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:20.926554Z",
+ "start_time": "2025-02-07T15:35:20.923786Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "adjustment_time",
+ "id": "2c00df07bb9ed47b",
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'bolin': array([ 4.58101402, 14.2607967 , 53.52400906, 128.5239839 ,\n",
+ " 214.34582876, 316.23237039, 542.50772639, 791.741067 ]),\n",
+ " 'miyake': array([ 2.81043805, 8.74895503, 32.83681537, 78.84906987,\n",
+ " 131.50050844, 194.00758919, 332.82682601, 485.73071595]),\n",
+ " 'bolin_c1': array([ 2.10782854, 6.56171627, 24.62761153, 59.13680241,\n",
+ " 98.62538133, 145.5056919 , 249.6201195 , 364.29803696])}"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "execution_count": 18
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:21.385005Z",
+ "start_time": "2025-02-07T15:35:21.006865Z"
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "fig, ax = plt.subplots()\n",
+ "for variant, time in adjustment_time.items():\n",
+ " ax.loglog(radii, time * si.s, label=variant)\n",
+ "ax.set_title('Isotopic relaxation timescale comparison in a log-log scale')\n",
+ "ax.set_xlabel('Log Radius [cm]')\n",
+ "ax.set_ylabel('Log Time [s]')\n",
+ "ax.legend()\n",
+ "show_plot('timescales_comparison.pdf')"
+ ],
+ "id": "52ad83d048dd7bbc",
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "
"
+ ],
+ "image/svg+xml": "\n\n\n"
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "HBox(children=(HTML(value=\"./timescales_comparison.pdf…"
+ ],
+ "application/vnd.jupyter.widget-view+json": {
+ "version_major": 2,
+ "version_minor": 0,
+ "model_id": "1a72fcfdd8d74be0bf3ad3178cac399f"
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "execution_count": 19
+ },
+ {
+ "metadata": {},
+ "cell_type": "markdown",
+ "source": "## ",
+ "id": "753a7cdce2bd8a86"
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-02-07T15:35:21.394478Z",
+ "start_time": "2025-02-07T15:35:21.393004Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "",
+ "id": "fa5a02ddaa0c2d15",
+ "outputs": [],
+ "execution_count": null
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.6"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/examples/PySDM_examples/Van_Hook_1968/fig_1.ipynb b/examples/PySDM_examples/Van_Hook_1968/fig_1.ipynb
index ae1f35635..5b5d2d4b5 100644
--- a/examples/PySDM_examples/Van_Hook_1968/fig_1.ipynb
+++ b/examples/PySDM_examples/Van_Hook_1968/fig_1.ipynb
@@ -20,1942 +20,82 @@
},
{
"cell_type": "code",
- "execution_count": 1,
"id": "5c681ecc",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-01-19T12:16:13.403381Z",
- "start_time": "2024-01-19T12:16:13.399235Z"
+ "end_time": "2025-01-28T11:27:40.728088Z",
+ "start_time": "2025-01-28T11:27:40.724635Z"
}
},
- "outputs": [],
"source": [
"import sys\n",
"if 'google.colab' in sys.modules:\n",
" !pip --quiet install open-atmos-jupyter-utils\n",
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
" pip_install_on_colab('PySDM-examples')"
- ]
+ ],
+ "outputs": [],
+ "execution_count": 1
},
{
"cell_type": "code",
- "execution_count": 2,
"id": "f6396e78",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-01-19T12:16:13.623380Z",
- "start_time": "2024-01-19T12:16:13.619648Z"
+ "end_time": "2025-01-28T11:27:42.662154Z",
+ "start_time": "2025-01-28T11:27:40.730040Z"
}
},
- "outputs": [],
"source": [
"from open_atmos_jupyter_utils import show_plot\n",
"from matplotlib import pyplot\n",
"from PySDM import Formulae\n",
"from PySDM.physics import si\n",
"import numpy as np"
- ]
+ ],
+ "outputs": [],
+ "execution_count": 2
},
{
"cell_type": "code",
- "execution_count": 3,
"id": "e08d4f87",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-01-19T12:16:14.646632Z",
- "start_time": "2024-01-19T12:16:14.640788Z"
+ "end_time": "2025-01-28T11:27:42.759802Z",
+ "start_time": "2025-01-28T11:27:42.741103Z"
}
},
- "outputs": [],
"source": [
"formulae = Formulae(isotope_equilibrium_fractionation_factors=\"VanHook1968\")\n",
"alphas = formulae.isotope_equilibrium_fractionation_factors"
- ]
+ ],
+ "outputs": [],
+ "execution_count": 3
},
{
"cell_type": "code",
- "execution_count": 4,
"id": "15b167a4",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-01-19T12:16:14.806376Z",
- "start_time": "2024-01-19T12:16:14.800961Z"
+ "end_time": "2025-01-28T11:27:42.767186Z",
+ "start_time": "2025-01-28T11:27:42.765814Z"
}
},
- "outputs": [],
"source": [
"N_POINTS = 64"
- ]
+ ],
+ "outputs": [],
+ "execution_count": 4
},
{
"cell_type": "code",
- "execution_count": 5,
"id": "59bf6c49",
"metadata": {
"ExecuteTime": {
- "end_time": "2024-01-19T12:16:26.804932Z",
- "start_time": "2024-01-19T12:16:25.036490Z"
+ "end_time": "2025-01-28T11:27:45.713238Z",
+ "start_time": "2025-01-28T11:27:42.775096Z"
}
},
- "outputs": [
- {
- "data": {
- "image/svg+xml": [
- "\n",
- "\n",
- "\n"
- ],
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "bc1bd92a62f648d5991e33095670a37e",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "HTML(value=\"./fig_1.pdf
\")"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
"source": [
"def trans_x(T):\n",
" return 1e3 / T\n",
@@ -1998,7 +138,66 @@
"pyplot.ylim(-2, 40)\n",
"\n",
"show_plot(\"fig_1.pdf\")"
- ]
+ ],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ ""
+ ],
+ "image/svg+xml": "\n\n\n"
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "HBox(children=(HTML(value=\"./fig_1.pdf
\"), HTML(value=\"