open-atmos / PySDM

Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab
https://open-atmos.github.io/PySDM/
GNU General Public License v3.0
57 stars 34 forks source link

new state variable triplet: internal energy, total water (for CM.jl) #537

Closed abulenok closed 3 years ago

slayoo commented 3 years ago

@piotrbartman - please commit the relevant changes we've drafted in Kraków to some branch

@trontrytel - please post here the needed variable transformation definitions to be put in the formulae code

Greetings from Illinois! S.

slayoo commented 3 years ago

ping :)

trontrytel commented 3 years ago

The state vars are: the density rho (including dry air and water vapour), the total specific humidity and total specific energy.

  1. total specific humidity q_t = q_v + q_l + qi I think we just have to have access to super-droplet state and compute q_l and q_i based on it?

  2. total specific energy e_tot = e_kin + e_pot + e_int e_kin(u,v,w) = 1/2 (u^2+v^2+w^2) e_pot(z) = g * z e_int(T, q_t, q_l, q_i) = cv_m(q_t, q_l, q_i) * (T - _T_0) + (q_t - q_l) * e_int_v0 - q_i * (e_int_v0 + e_int_i0) cv_m = cv_d + (cv_v - cv_d) * q_t + (cv_l - cv_v) * q_l + (cv_i - cv_v) * q_i The constants are defined here: https://github.com/CliMA/CLIMAParameters.jl/blob/master/src/Planet/planet_parameters.jl

  3. Not sure if I'm not overcomplicating things with density. rho = p / T / (R_d * q_d + R_v * q_v) q_d = 1 - q_t p = p_d + p_v

I'll check tomorrow if you already have functions to compute the temperature T and the total pressure p in the super-droplet code. We should also have access to velocity and height.

slayoo commented 3 years ago

We should also have access to velocity and height.

PySDM expects fluid velocity to be represented using staggered grid wrt thermodynamic variables. This can, in principle, be also generalised, but for now I would stick to using and modifying e_int only. After all, as we have discussed in Kraków, for now Δe_tot = Δe_int from the perspective of PySDM (which is not entirely true as we might want to take into account the effect of precip on fluid momentum later on).

I'll check tomorrow if you already have functions to compute the temperature T and the total pressure p in the super-droplet code

We have formulae for computing T and p from (rho_d, thd, qv), need to bring in new ones for (e_int, rho_tot, q_t)... especially as q_PySDM ≠ q_CMachine !!! (mixing ratio vs. specific water contents). In fact, why not to rename all the "q" in PySDM to mixing_ratio or mixrat?

Now, I believe we have also to discuss supersaturation vs. values of q_l at t=n*Δt and t=(n+1)*Δt? PySDM will rely on supersaturation being "present" in the (e_int, rho_tot, q_t) triplet at t=n*Δt and then consume some of energy and vapour to lower the supersaturation when condensing, and we will then update (e_int, rho_tot, q_t) for t=(n+1)Δt accordingly, right?

trontrytel commented 3 years ago

Sounds correct to me.

On the Machine side we have two options for thermodynamics. One is assuming equilibrium and running saturation adjustment to obtain temperature. The other assumes nothing about equilibrium and therefore allows for supersaturation to be present. We might be better off coupling with the non-equilibrium version of the Machine? Here are some notes from the docs about it.

slayoo commented 3 years ago

Let me close this one until we come up with a good argument to support introducing such feature. Implementing it would require a great amount of work, getting high test coverage... very tricky!