Skip to content

Commit a467abe

Browse files
isotopes: add tau(Bo, dm_dt_over_m) formulae to Trivia (where Bo is the "Bolin number") (#1669)
Co-authored-by: Sylwester Arabas <[email protected]>
1 parent 70fc9a9 commit a467abe

File tree

7 files changed

+50
-31
lines changed

7 files changed

+50
-31
lines changed

PySDM/physics/isotope_relaxation_timescale/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
from PySDM.impl.null_physics_class import Null
66
from .miyake_et_al_1968 import MiyakeEtAl1968
77
from .bolin_1958 import Bolin1958
8-
from .zaba_et_al import ZabaEtAl
98
from .jouzel_et_al_1975 import JouzelEtAl1975
9+
from .zaba_et_al import ZabaEtAl
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Timescale derived for tritium with assumption of zero ambient concentration - see text above
2-
Table 1 [Bolin 1958](https://digitallibrary.un.org/record/3892725)"""
1+
"""Bolin number"""
32

43
import numpy as np
54

@@ -11,5 +10,5 @@ def __init__(self, const):
1110
assert np.isfinite(const.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1)
1211

1312
@staticmethod
14-
def tau(const, dm_dt_over_m):
15-
return 1 / (const.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1 * dm_dt_over_m)
13+
def bolin_number(const):
14+
return const.BOLIN_ISOTOPE_TIMESCALE_COEFF_C1

PySDM/physics/trivia.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,10 @@ def poissonian_avoidance_function(r, dt):
161161
process with a constant rate `r`
162162
"""
163163
return np.exp(-r * dt)
164+
165+
@staticmethod
166+
def tau(Bo, dm_dt_over_m):
167+
"""
168+
see text above Table 1 [Bolin 1958](https://digitallibrary.un.org/record/3892725)
169+
"""
170+
return 1 / Bo / dm_dt_over_m

docs/bibliography.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,10 @@
682682
},
683683
"https://digitallibrary.un.org/record/3892725": {
684684
"usages": [
685-
"PySDM/physics/isotope_relaxation_timescale/bolin_1958.py",
686685
"PySDM/physics/constants_defaults.py",
687-
"examples/PySDM_examples/Bolin_1958/table_1.ipynb",
686+
"PySDM/physics/trivia.py",
688687
"examples/PySDM_examples/Bolin_1958/__init__.py",
688+
"examples/PySDM_examples/Bolin_1958/table_1.ipynb",
689689
"examples/PySDM_examples/Zaba_et_al/timescales_comparison.ipynb"
690690
],
691691
"label": "Bolin 1958 (Proc. 2nd UN Intl Conf. Peaceful Uses of Atomic Energy)",

examples/PySDM_examples/Bolin_1958/table_1.ipynb

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"id": "5e4e58050cc01f64",
2424
"metadata": {
2525
"ExecuteTime": {
26-
"end_time": "2025-06-27T18:55:07.411745Z",
27-
"start_time": "2025-06-27T18:55:07.401377Z"
26+
"end_time": "2025-08-12T13:56:32.855405Z",
27+
"start_time": "2025-08-12T13:56:32.851730Z"
2828
}
2929
},
3030
"source": [
@@ -35,15 +35,15 @@
3535
" pip_install_on_colab('PySDM-examples')"
3636
],
3737
"outputs": [],
38-
"execution_count": 5
38+
"execution_count": 1
3939
},
4040
{
4141
"cell_type": "code",
4242
"id": "95f360dc62f373f9",
4343
"metadata": {
4444
"ExecuteTime": {
45-
"end_time": "2025-06-27T18:55:08.148769Z",
46-
"start_time": "2025-06-27T18:55:08.144342Z"
45+
"end_time": "2025-08-12T13:56:35.553021Z",
46+
"start_time": "2025-08-12T13:56:32.868658Z"
4747
}
4848
},
4949
"source": [
@@ -54,13 +54,13 @@
5454
"from IPython.display import display"
5555
],
5656
"outputs": [],
57-
"execution_count": 6
57+
"execution_count": 2
5858
},
5959
{
6060
"metadata": {
6161
"ExecuteTime": {
62-
"end_time": "2025-06-27T18:55:08.549521Z",
63-
"start_time": "2025-06-27T18:55:08.517457Z"
62+
"end_time": "2025-08-12T13:56:38.312522Z",
63+
"start_time": "2025-08-12T13:56:35.612041Z"
6464
}
6565
},
6666
"cell_type": "code",
@@ -110,15 +110,15 @@
110110
],
111111
"id": "4a8c2bd612c892f2",
112112
"outputs": [],
113-
"execution_count": 7
113+
"execution_count": 3
114114
},
115115
{
116116
"cell_type": "code",
117117
"id": "340812de267c4290",
118118
"metadata": {
119119
"ExecuteTime": {
120-
"end_time": "2025-06-27T19:04:24.139475Z",
121-
"start_time": "2025-06-27T19:04:24.120075Z"
120+
"end_time": "2025-08-12T13:56:38.762219Z",
121+
"start_time": "2025-08-12T13:56:38.345299Z"
122122
}
123123
},
124124
"source": [
@@ -141,7 +141,8 @@
141141
" Fk=Fk,\n",
142142
" Fd=Fd,\n",
143143
")\n",
144-
"adjustment_time = formulae.isotope_relaxation_timescale.tau(\n",
144+
"adjustment_time = formulae.trivia.tau(\n",
145+
" Bo=formulae.isotope_relaxation_timescale.bolin_number(),\n",
145146
" dm_dt_over_m=(\n",
146147
" formulae.particle_shape_and_density.dm_dt_over_m(\n",
147148
" radii,\n",
@@ -265,15 +266,15 @@
265266
"output_type": "display_data"
266267
}
267268
],
268-
"execution_count": 14
269+
"execution_count": 4
269270
},
270271
{
271272
"cell_type": "code",
272273
"id": "0bef57bc-7e19-4a3f-8f77-6ec762e8f236",
273274
"metadata": {
274275
"ExecuteTime": {
275-
"end_time": "2025-06-27T18:41:40.340143Z",
276-
"start_time": "2025-06-03T21:24:22.478342Z"
276+
"end_time": "2025-08-12T13:56:38.799723Z",
277+
"start_time": "2025-08-12T13:56:38.798348Z"
277278
}
278279
},
279280
"source": [],

tests/unit_tests/physics/test_isotope_relaxation_timescale.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,15 @@ def test_unit_and_magnitude(paper, iso):
5858
assert 0 * si.s < result.to_base_units() < 10 * si.s
5959

6060

61-
def test_bolin_tritium_formula_unit():
61+
def test_bolin_number_unit():
6262
with DimensionalAnalysis():
6363
# arrange
6464
si = constants_defaults.si
65-
formulae = Formulae(
66-
isotope_relaxation_timescale="Bolin1958",
67-
constants={"BOLIN_ISOTOPE_TIMESCALE_COEFF_C1": 1 * si.dimensionless},
68-
)
69-
tau = formulae.isotope_relaxation_timescale.tau
65+
sut = isotope_relaxation_timescale.bolin_1958.Bolin1958.bolin_number
66+
formulae = Formulae()
7067

7168
# act
72-
sut = tau(dm_dt_over_m=1 / si.s)
69+
value = sut(formulae.constants)
7370

7471
# assert
75-
assert sut.check("[time]")
72+
assert value.check(si.dimensionless)

tests/unit_tests/physics/test_trivia.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
from scipy.special import erfinv # pylint: disable=no-name-in-module
55

6-
from PySDM import Formulae
6+
from PySDM import Formulae, physics
77
from PySDM.physics.dimensional_analysis import DimensionalAnalysis
88
from PySDM.physics import constants_defaults
99

@@ -113,3 +113,18 @@ def test_celsius_to_kelvin():
113113

114114
# assert
115115
assert temperature_in_kelvin == temperature_in_celsius + 273.15
116+
117+
@staticmethod
118+
@pytest.mark.parametrize(
119+
"bolin_number, dm_dt_over_m, expected_tau",
120+
((1, 2, 0.5), (2, 1, 0.5), (2, 2, 0.25)),
121+
)
122+
def test_tau(bolin_number, dm_dt_over_m, expected_tau):
123+
# arrange
124+
sut = physics.trivia.Trivia.tau
125+
126+
# act
127+
value = sut(Bo=bolin_number, dm_dt_over_m=dm_dt_over_m)
128+
129+
# assert
130+
np.testing.assert_almost_equal(actual=value, desired=expected_tau)

0 commit comments

Comments
 (0)