Replies: 1 comment 1 reply
-
Thanks a lot @slayoo What I don't understand is this part in the implicit step within the condensation methods backend. Here 'water_vapour_mixing_ratio' is modified directly. It might be that the naming of 'water_vapour_mixing_ratio' in this case is misleading and is in fact the predicted variable or a temporary variable for sub stepping. I just want to confirm that the method is applied correctly here since its hard to follow function calls in this routine. PySDM/PySDM/backends/impl_numba/methods/condensation_methods.py Lines 257 to 355 in 4ff7b64 Where is the predicted vars set to the current vars? In Moist.notify() predicted and current are not swapped, instead predicted is set to None. Likely so that the function returns directly next call in case the predicted vars was not needed. But would it not make sense to make to set predicted here for the case that multiple dynamics want to accesses the predicted vars? PySDM/PySDM/environments/impl/moist.py Line 116 in 4ff7b64 |
Beta Was this translation helpful? Give feedback.
-
CC: @tluettm
The
Moist
environments feature a logic which defines two sets of thermodynamic state variables: "current" and "predicted".These are swapped at the end of each timestep from
Particulator._notify_observers()
in which it is ensured that theenvironment.notify()
is the last one called among allnotify()
methods:PySDM/PySDM/particulator.py
Lines 49 to 60 in 4ff7b64
All environments inheriting from
Moist
(likeParcel
,Kinematic_1D
andKinematic_2D
) require that theAmbientThermodynamics
"dynamic" is added to the builder uponParticulator
instantiation. TheAmbientThermodynamics.__call__()
method is where theenvironment.sync()
is called which is expected to update the thermodynamic state with new "forcings" (be it due to advection in multi-dimensional envs, or due to adiabatic ascent in the parcel env):PySDM/PySDM/dynamics/ambient_thermodynamics.py
Lines 9 to 17 in 4ff7b64
This updated state goes into the "predicted" dataset:
PySDM/PySDM/environments/impl/moist.py
Line 100 in 4ff7b64
So, in each timestep, the microphysics dynamics have access to both "current" and "predicted" thermodynamic states. The "current" state should not be modified, while modifying the "predicted" state effectively constitutes the definition of the thermodynamic tendencies:
PySDM/PySDM/particulator.py
Lines 119 to 120 in 4ff7b64
Multiple dynamics may modify the "predicted" state. Access to the "predicted" vars is provided with
Moist.get_predicted()
, while access to the "current" state is provided byMoist.__getitem__()
. The swapping of these two states, which happens inMoist.notify()
effectively leads to "application" of the accumulated tendencies:PySDM/PySDM/environments/impl/moist.py
Lines 110 to 116 in 4ff7b64
Beta Was this translation helpful? Give feedback.
All reactions