-
Notifications
You must be signed in to change notification settings - Fork 40
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
AgnieszkaZaba
wants to merge
58
commits into
open-atmos:main
Choose a base branch
from
AgnieszkaZaba:isotopes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 fbdcfcc
Merge branch 'main' into isotopes
AgnieszkaZaba 915452c
move formulae definition to common.py
AgnieszkaZaba a9d90b1
remove instantiations from Bolin's common file; create r_dr_dt_fun
AgnieszkaZaba 9a3755b
Merge branch 'open-atmos:main' into isotopes
AgnieszkaZaba 9c611f7
add tau for miyake; update comparison
AgnieszkaZaba 044878a
remove copied formulae
AgnieszkaZaba 88b1c3a
remove unused variables
AgnieszkaZaba aca2a69
add new tau formula without assumptions
AgnieszkaZaba 84a0ecb
restore previous tau function
AgnieszkaZaba 4b8af60
fix names
AgnieszkaZaba 9cb8050
fix number of arguments
AgnieszkaZaba 518fcf3
fix third cell (following devops tests)
AgnieszkaZaba 24be222
remove leftover test
AgnieszkaZaba cf524e6
fix pylint hints
AgnieszkaZaba c26d076
fix Bolin's table1 to match common structure
AgnieszkaZaba 980664b
separate calculation of ca from tau
AgnieszkaZaba faef274
create a common class
AgnieszkaZaba 011efc0
add plot with comparison; add check for value of c1
AgnieszkaZaba 1edb47b
address pylint and devops errors
AgnieszkaZaba 91308c2
update Bolin's table_1 to common.py changes
AgnieszkaZaba 3634266
remove unused arguments; change printing output
AgnieszkaZaba a6e6e8e
move formulae inside class
AgnieszkaZaba 8e547ad
add pandas dataframe
AgnieszkaZaba 16780bc
add units to dataframe
AgnieszkaZaba 0f7db99
add timescales relation plot
AgnieszkaZaba 193372f
fix labels
AgnieszkaZaba 44b92eb
update todo
AgnieszkaZaba 01b517f
add ratio_3H from Grahams Law;
AgnieszkaZaba 2295dd4
add relaxation timescales Jouzel'75, Stewart'75
AgnieszkaZaba add3e24
rename relaxation time scale to emphasise Sylwester Arabas contribution
AgnieszkaZaba 4ea3033
change tau function by applying Mason's k factor
AgnieszkaZaba e4f2fb3
add Mason's T0 to Tinf factor
AgnieszkaZaba 9c75c60
add new comparisons
AgnieszkaZaba 8a7afe4
fix Bolin's example to match common file
AgnieszkaZaba 70a6993
change c1 function to match Bolin paper
AgnieszkaZaba 33fbd01
add f to f_iso function as an example notebook
AgnieszkaZaba 8b4d0b3
add radii dependence plot
AgnieszkaZaba 7881b4e
add plots for vent_coeff_ratio of temperature and radii
AgnieszkaZaba 26ee526
address pylint hints
AgnieszkaZaba 488e92f
add badges and colab header
AgnieszkaZaba b866f4d
add fig 1 from Pruppacher and Rasmussen
AgnieszkaZaba 9c2cc49
update
AgnieszkaZaba c33b56d
cleanup
AgnieszkaZaba 1803f07
add imports to init
AgnieszkaZaba b2962d3
fix Zaba and Arabas timescale
AgnieszkaZaba cac2343
fix Zaba and Arabas timescale
AgnieszkaZaba 49c5e8b
fix ZabaAndArabas formula for tau; remove unused import
AgnieszkaZaba 62252f4
new plot for different RH and isotopes
AgnieszkaZaba 8d446d4
delete copy-pased code in notebook;
AgnieszkaZaba 6c81127
add missing argument
AgnieszkaZaba 815ab72
new plots with different e_iso
AgnieszkaZaba 92f3200
fix tau formula again
AgnieszkaZaba 9ab1bb6
add pvs_water to tau formula; clean comparison file and add FIXME and…
AgnieszkaZaba e38b9d2
add alpha of altitude plot
AgnieszkaZaba d1162b9
cleanup leftovers in vent_coeff; change name of alpha_of_altitude.ipynb
AgnieszkaZaba 7dd365e
cleanup again
AgnieszkaZaba ca4c1a5
Merge branch 'main' into isotopes
AgnieszkaZaba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
PySDM/physics/isotope_relaxation_timescale/jouzel_et_al_1975.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
PySDM/physics/isotope_relaxation_timescale/stewart_1975.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
PySDM/physics/isotope_relaxation_timescale/zaba_and_arabas_2025.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""isotope relaxation timescale""" | ||
|
||
|
||
class ZabaAndArabas2025: | ||
@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) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄