Skip to content

drop local thermodynamics (Abade & Aluquerque) #1681

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

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d5d7128
add ABIFM curves to A&A example Fig 2; introduce SINGULAR_HOMOGENEOUS…
slayoo Jun 24, 2025
21b9e82
add bib entries
slayoo Jun 24, 2025
1189bfa
addressing pylint hints
slayoo Jun 24, 2025
7be3b77
add the ABIFM/INAS caes to the smoke tests
slayoo Jun 25, 2025
522792f
adding realisations; removing conservation plot; add updraft as argum…
slayoo Jun 25, 2025
1883fca
wip on adding depiction of dependence of the realisation spread on n_sd
slayoo Jun 26, 2025
def99e7
progres bars
slayoo Jun 27, 2025
0ef8b10
A&A examples: reusing one backend in all simulations, depicting reali…
slayoo Jun 28, 2025
537a020
adding plots for different updrafts
slayoo Jun 28, 2025
3722100
version with more sds and larger updraft spread
slayoo Jun 29, 2025
9d3d0a8
fine tuning settings
slayoo Jun 29, 2025
c143be7
draft of basic adaptivity for vapour deposition on ice
slayoo Jul 1, 2025
d5995d2
Wed progress on adaptivity (incl. RH rtol)
slayoo Jul 2, 2025
bc0f91c
Merge branch 'deposition_drowth_basic_adaptivity' into abade_albuquer…
slayoo Jul 2, 2025
490d311
trying adaptivity with the A&A example - seems we have a bug (ambient…
slayoo Jul 3, 2025
0c9f45d
thermodynamic consistency within substepping for deposition
slayoo Jul 4, 2025
19c0505
Merge branch 'main' into abade_albuquerque_abifm
slayoo Jul 6, 2025
6f6c0df
conservation test for adaptivity in deposition; fix dthd calculation …
slayoo Jul 6, 2025
fe5a1ae
work in progress on testing and fixing mass conservation in adaptive …
slayoo Jul 7, 2025
cd5686d
adaptivity mass conservation fixed!
slayoo Jul 7, 2025
272bfb6
resolve merge conflicts
slayoo Jul 8, 2025
902d135
smoke test update
slayoo Jul 8, 2025
b3a2072
fixes, todo labels
slayoo Jul 8, 2025
012b771
fixes, todo labels, notebook regenerated
slayoo Jul 8, 2025
eb51fb5
adaptive=True by default
slayoo Jul 8, 2025
a910c80
fix notebook
slayoo Jul 8, 2025
989b337
early drafts of the new dynamic and attributes
slayoo Jul 8, 2025
3fc5423
fixing tests
slayoo Jul 8, 2025
b05f58d
update notebook header cell; address pylint hint
slayoo Jul 8, 2025
7d40e35
reverting bug prone change in var name, thanks to tests detected!
slayoo Jul 8, 2025
4c54627
fine-tune test settings
slayoo Jul 8, 2025
4ac66d6
add pylint-disable comments
slayoo Jul 8, 2025
dcf15b6
move pylint disable comment up
slayoo Jul 8, 2025
d89709a
Merge remote-tracking branch 'upstream/main' into abade_albuquerque_a…
slayoo Jul 8, 2025
baacda5
renormed tests, regnerated notebook
slayoo Jul 8, 2025
31d91e2
Merge branch 'abade_albuquerque_abifm' into abade_drop_local_thermody…
slayoo Jul 9, 2025
9ccfead
adding Kolmogorov timescale + test + more moilerplate code
slayoo Jul 9, 2025
9e2f247
Merge branch 'main' into abade_drop_local_thermodynamics
slayoo Jul 9, 2025
c21215c
towards a test
slayoo Jul 9, 2025
c7c3cbf
introducing drop- and cell-wise tendencies; per-droplet adaptivity; i…
slayoo Jul 11, 2025
83fbc2f
tendency logic
slayoo Jul 11, 2025
9f5ca0a
notes from Friday meeting
slayoo Jul 14, 2025
1b349d5
working "tau" (version before the meeting with PS)
slayoo Jul 15, 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
1 change: 1 addition & 0 deletions PySDM/attributes/physics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
from .terminal_velocity import TerminalVelocity
from .volume import Volume
from .reynolds_number import ReynoldsNumber
from . import local_thermodynamics
79 changes: 79 additions & 0 deletions PySDM/attributes/physics/local_thermodynamics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from ..impl import (
register_attribute,
ExtensiveAttribute,
DummyAttribute,
DerivedAttribute,
)


class DropwiseTendency(DummyAttribute):
def __init__(self, builder, *, name):
super().__init__(builder, name=name + " tendency")
builder.particulator.initialisers.append(self)

def setup(self):
self.data.data[:] = 0.0


class DropwiseThermodynamicVarRelaxed(
DummyAttribute
): # TODO: it should not be extensive - what happens with Qk and Tk when two droplets collide!
def __init__(self, builder, *, name):
super().__init__(builder, name=name)
builder.particulator.initialisers.append(self)

def setup(self):
self.data.data[:] = self.particulator.environment[
{
"dropwise water vapour mixing ratio": "water_vapour_mixing_ratio",
"dropwise dry air potential temperature": "thd",
}[self.name]
][self.particulator.attributes["cell id"].data]


class DropwiseThermodynamicVarAmbient(DropwiseThermodynamicVarRelaxed):
def __init__(self, builder, *, name):
super().__init__(builder, name=name)
builder.particulator.observers.append(
self
) # TODO: check if this is not too early/late for the update?

def notify(self):
self.setup()


def make_tendency_factory(name):
def _factory(builder):
return DropwiseTendency(builder, name=name)

return _factory


def make_relaxed_var_factory(name):
def _factory(builder):
return DropwiseThermodynamicVarRelaxed(builder, name=name)

return _factory


def make_ambient_var_factory(name):
def _factory(builder):
return DropwiseThermodynamicVarAmbient(builder, name=name)

return _factory


for var in (
"dropwise water vapour mixing ratio",
"dropwise dry air potential temperature",
):
register_attribute(name=f"{var} tendency")(make_tendency_factory(var))
register_attribute(
name=var, variant=lambda dynamics, _: "DropLocalThermodynamics" in dynamics
)(make_relaxed_var_factory(var))
register_attribute(
name=var, variant=lambda dynamics, _: "DropLocalThermodynamics" not in dynamics
)(make_ambient_var_factory(var))


# TODO: shouldn't it be defined as mass rather than mixing ratio? (like for multiplicity)
Loading
Loading