Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isotopic relaxation timescales comparison #1494

Draft
wants to merge 58 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9796bf2
add file timescales_comparison.ipynb
AgnieszkaZaba Jan 8, 2025
fbdcfcc
Merge branch 'main' into isotopes
AgnieszkaZaba Jan 8, 2025
915452c
move formulae definition to common.py
AgnieszkaZaba Jan 9, 2025
a9d90b1
remove instantiations from Bolin's common file; create r_dr_dt_fun
AgnieszkaZaba Jan 20, 2025
9a3755b
Merge branch 'open-atmos:main' into isotopes
AgnieszkaZaba Jan 27, 2025
9c611f7
add tau for miyake; update comparison
AgnieszkaZaba Jan 20, 2025
044878a
remove copied formulae
AgnieszkaZaba Jan 23, 2025
88b1c3a
remove unused variables
AgnieszkaZaba Jan 26, 2025
aca2a69
add new tau formula without assumptions
AgnieszkaZaba Jan 28, 2025
84a0ecb
restore previous tau function
AgnieszkaZaba Jan 28, 2025
4b8af60
fix names
AgnieszkaZaba Jan 28, 2025
9cb8050
fix number of arguments
AgnieszkaZaba Jan 28, 2025
518fcf3
fix third cell (following devops tests)
AgnieszkaZaba Jan 28, 2025
24be222
remove leftover test
AgnieszkaZaba Jan 28, 2025
cf524e6
fix pylint hints
AgnieszkaZaba Jan 30, 2025
c26d076
fix Bolin's table1 to match common structure
AgnieszkaZaba Feb 7, 2025
980664b
separate calculation of ca from tau
AgnieszkaZaba Feb 7, 2025
faef274
create a common class
AgnieszkaZaba Feb 7, 2025
011efc0
add plot with comparison; add check for value of c1
AgnieszkaZaba Feb 7, 2025
1edb47b
address pylint and devops errors
AgnieszkaZaba Feb 7, 2025
91308c2
update Bolin's table_1 to common.py changes
AgnieszkaZaba Feb 7, 2025
3634266
remove unused arguments; change printing output
AgnieszkaZaba Feb 7, 2025
a6e6e8e
move formulae inside class
AgnieszkaZaba Feb 7, 2025
8e547ad
add pandas dataframe
AgnieszkaZaba Feb 10, 2025
16780bc
add units to dataframe
AgnieszkaZaba Feb 10, 2025
0f7db99
add timescales relation plot
AgnieszkaZaba Feb 10, 2025
193372f
fix labels
AgnieszkaZaba Feb 10, 2025
44b92eb
update todo
AgnieszkaZaba Feb 10, 2025
01b517f
add ratio_3H from Grahams Law;
AgnieszkaZaba Feb 10, 2025
2295dd4
add relaxation timescales Jouzel'75, Stewart'75
AgnieszkaZaba Feb 12, 2025
add3e24
rename relaxation time scale to emphasise Sylwester Arabas contribution
AgnieszkaZaba Feb 12, 2025
4ea3033
change tau function by applying Mason's k factor
AgnieszkaZaba Feb 14, 2025
e4f2fb3
add Mason's T0 to Tinf factor
AgnieszkaZaba Feb 14, 2025
9c75c60
add new comparisons
AgnieszkaZaba Feb 25, 2025
8a7afe4
fix Bolin's example to match common file
AgnieszkaZaba Mar 2, 2025
70a6993
change c1 function to match Bolin paper
AgnieszkaZaba Mar 3, 2025
33fbd01
add f to f_iso function as an example notebook
AgnieszkaZaba Mar 5, 2025
8b4d0b3
add radii dependence plot
AgnieszkaZaba Mar 9, 2025
7881b4e
add plots for vent_coeff_ratio of temperature and radii
AgnieszkaZaba Mar 9, 2025
26ee526
address pylint hints
AgnieszkaZaba Mar 9, 2025
488e92f
add badges and colab header
AgnieszkaZaba Mar 9, 2025
b866f4d
add fig 1 from Pruppacher and Rasmussen
AgnieszkaZaba Mar 10, 2025
9c2cc49
update
AgnieszkaZaba Mar 11, 2025
c33b56d
cleanup
AgnieszkaZaba Mar 11, 2025
1803f07
add imports to init
AgnieszkaZaba Mar 11, 2025
b2962d3
fix Zaba and Arabas timescale
AgnieszkaZaba Mar 11, 2025
cac2343
fix Zaba and Arabas timescale
AgnieszkaZaba Mar 11, 2025
49c5e8b
fix ZabaAndArabas formula for tau; remove unused import
AgnieszkaZaba Mar 12, 2025
62252f4
new plot for different RH and isotopes
AgnieszkaZaba Mar 14, 2025
8d446d4
delete copy-pased code in notebook;
AgnieszkaZaba Mar 16, 2025
6c81127
add missing argument
AgnieszkaZaba Mar 17, 2025
815ab72
new plots with different e_iso
AgnieszkaZaba Mar 19, 2025
92f3200
fix tau formula again
AgnieszkaZaba Mar 26, 2025
9ab1bb6
add pvs_water to tau formula; clean comparison file and add FIXME and…
AgnieszkaZaba Mar 27, 2025
e38b9d2
add alpha of altitude plot
AgnieszkaZaba Mar 28, 2025
d1162b9
cleanup leftovers in vent_coeff; change name of alpha_of_altitude.ipynb
AgnieszkaZaba Mar 28, 2025
7dd365e
cleanup again
AgnieszkaZaba Mar 28, 2025
ca4c1a5
Merge branch 'main' into isotopes
AgnieszkaZaba Apr 9, 2025
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: 6 additions & 0 deletions PySDM/physics/isotope_diffusivity_ratios/grahams_law.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ def ratio_2H(const, temperature): # pylint: disable=unused-argument
return (
(2 * const.M_1H + const.M_16O) / (const.M_2H + const.M_1H + const.M_16O)
) ** const.ONE_HALF

@staticmethod
def ratio_3H(const, temperature): # pylint: disable=unused-argument
return (
(2 * const.M_1H + const.M_16O) / (const.M_3H + const.M_1H + const.M_16O)
) ** const.ONE_HALF
38 changes: 36 additions & 2 deletions PySDM/physics/isotope_relaxation_timescale/bolin_1958.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,42 @@ 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 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(const, radius, r_dr_dt):
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
19 changes: 19 additions & 0 deletions PySDM/physics/isotope_relaxation_timescale/jouzel_et_al_1975.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""eq. 7 in [Jouzel et al 1975](https://doi.org/10.1029/JC080i036p05015)"""


class JouzelEtAl1975:
@staticmethod
# pylint: disable=too-many-arguments
def tau(const, e_s, D_iso, M_iso, vent_coeff_iso, radius, alpha, temperature):
"""relaxation time for stationary droplet??"""
return (
radius**2
* alpha
* const.rho_w
* temperature
/ 3
/ vent_coeff_iso
/ D_iso
/ e_s
/ M_iso
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions PySDM/physics/isotope_relaxation_timescale/stewart_1975.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""eq. 7 in [Stewart 1975](https://doi.org/10.1029/JC080i009p01133)"""


class Stewart1975:
@staticmethod
# pylint: disable=too-many-arguments
def tau(const, e_s, Dn, M_iso, vent_coeff, radius, alpha, temperature):
"""relaxation time for stationary droplet; Dn denotes D^n"""
return (
radius**2
* alpha
* const.rho_w
* temperature
/ 3
/ vent_coeff
/ Dn
/ e_s
/ M_iso
)
28 changes: 28 additions & 0 deletions PySDM/physics/isotope_relaxation_timescale/zaba_and_arabas_2025.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""isotope relaxation timescale"""


class ZabaAndArabas2025:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

@staticmethod
def tau(
const,
radius,
alpha,
D_iso,
vent_coeff_iso,
rho_env,
M_iso,
temperature,
Rv,
pvs_iso,
):
return (
alpha
* radius**2
/ 3
* const.rho_w
/ D_iso
/ vent_coeff_iso
/ const.Mv
* Rv
/ (rho_env / M_iso - pvs_iso / const.R_STR / temperature)
)
71 changes: 71 additions & 0 deletions examples/PySDM_examples/Bolin_1958/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
from PySDM import Formulae


class IsotopeTimescale:
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)
self.D_iso = self.formulae.isotope_diffusivity_ratios.ratio_3H(self.temperature)
self.K = 44.0 # any non-zero value
self.pvs_water = self.formulae.saturation_vapour_pressure.pvs_water(
self.temperature
)
self.alpha = self.formulae.isotope_equilibrium_fractionation_factors.alpha_i_3H(
self.temperature
) # check i/l
self.M_iso = self.formulae.constants.M_3H

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(self, RH, RH_eq, lv):
return self.formulae.drop_growth.r_dr_dt(
T=self.temperature,
pvs=self.pvs_water,
D=self.D,
K=self.K,
ventilation_factor=self.vent_coeff_fun(),
RH=RH,
RH_eq=RH_eq,
lv=lv,
)

def c1_coeff(self, *, vent_coeff_iso, rho_env, pvs_iso):
return self.formulae.isotope_relaxation_timescale.c1_coeff(
vent_coeff_iso=vent_coeff_iso,
vent_coeff=self.vent_coeff_fun(),
D_iso=self.D_iso,
D=self.D,
alpha=self.alpha,
rho_env_iso=self.formulae.constants.VSMOW_R_3H,
rho_env=rho_env,
M_iso=self.M_iso,
pvs_iso=pvs_iso, # any number
pvs_water=self.pvs_water,
temperature=self.temperature,
)
Loading
Loading