-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add "Flexible Microphysics" option, based on Cloudy.jl #333
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #333 +/- ##
==========================================
- Coverage 98.11% 96.16% -1.95%
==========================================
Files 35 36 +1
Lines 1165 1225 +60
==========================================
+ Hits 1143 1178 +35
- Misses 22 47 +25 ☔ View full report in Codecov by Sentry. |
@@ -0,0 +1,39 @@ | |||
# Microphysics Flexible | |||
|
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.
You should also add the docs page you are creating to the docs make file. Maybe somewhere here:
CloudMicrophysics.jl/docs/make.jl
Line 41 in e2e1a54
"Non-equilibrium cloud formation" => "MicrophysicsNonEq.md", |
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.
👍
|
||
The `MicrophysicsFlexible.jl` module relies on the extension defined in `ext/CloudyExt.jl`, based on a flexible N-moment microphysics scheme built in the external package `Cloudy.jl`. This option currently handles warm-rain processes including coalescence, condensation/evaporation, and sedimentation (terminal velocity). Unlike typical moment-based schemes which distinguish between categories such as rain and cloud, and which determine rates of conversion between categories (the canonical autoconversion, accretion, and self-collection), this option gives the user the flexibility to define as many or as few moments as they please, with these coalescence-based processes being solved directly without relying on conversion rates. Likewise, the rate of condensation/evaporation is defined through the rate of diffusion of water vapor to/from the surface of droplets defined by the subdistributions which underpin the method. The user has not only the flexibility to specify the number of moments (and therefore the complexity/accuracy) to use, but also the assumed size distributions corresponding to these moments. For instance, one might define a 5-moment implementation using an Exponential mode for smaller cloud droplets, plus a Gamma mode for larger rain droplets. Or, more creatively, perhaps a 12-moment implementation comprised of four Gamma modes. | ||
|
||
Options for dynamics and size distributions are under continuous development in the `Cloudy.jl` package, thus only the default and suggested use cases are described in detail here. |
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.
Maybe it would be good to add a link to Cloudy documentation, paper or repo somewhere? Especially since w don't want to explain the details of how the collisions or condensation are handled
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.
👍
docs/src/MicrophysicsFlexible.md
Outdated
|---------------------|------------------------------------------|----------------------------| | ||
| ``pdists`` | Vector of subdistributions corresponding | ``[Exponential, Gamma]`` | | ||
| | to the moments | | | ||
| ``mom`` | Prognostic moments, in the same order as | ``[0, 0, 0, 0, 0]`` | |
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.
Does it mean that by default I have two distributions - one Exponential
and one Gamma
? Which sizes do they refer to? And why by default do I have the 0
moment 5 times? (It probably just shows I should read Cloudy docs...
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.
Actually these have changed, and the Cloudy docs aren't helpful... I"ll try to make it more self explanatory
src/MicrophysicsFlexible.jl
Outdated
weighted_vt(clinfo) | ||
|
||
- `clinfo` - kwarg structure containing pdists, moments, and coalescence parameters | ||
Returns the integrated fall speeds corresponding to the rate of change of prognostic moments |
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.
Would it be correct to say moment-weighted terminal velocities?
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.
Yes!
docs/src/MicrophysicsFlexible.md
Outdated
| ``KernelFunc`` | Form of the coalescence kernel function | ``LongKernelFunction`` | | ||
| ``mass_thresholds`` | Particle size thresholds for coalescence | ``[10.0, Inf]`` | | ||
| | integration | | | ||
| ``kernel order`` | Polynomial order for the approx. kernel | ``1`` | |
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.
The CLSetup
has more fields than what the table shows? Are they not meant to be changed by the user?
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.
Correct, unless the user really knows what they're doing ;)
TT.@test length(clinfo.mom) == 5 | ||
TT.@test length(clinfo.NProgMoms) == 2 | ||
|
||
# Test coalescence |
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.
Should the mass be conserved in this approach when doing collisions? Could we test that?
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.
Yes, but these tests are already covered in Cloudy.jl so I think it would be redundant here
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.
These tests are only to check that the new features/structs that are created in CM.jl work. But, if you think it would be useful to create some redundant tests, I can absolutely do so! Let's open an issue if so.
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.
It's fine. Lets add as many tests as is necessary to test that Cloudy can be used in CM.
""" | ||
ODE problem definitions | ||
""" | ||
function parcel_model_cloudy(dY, Y, p, t) |
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.
I'll think about how to unify the OG parcel model with the Cloudy parcel model. But it's ok to have two separate ones for now. My only concern is that we won't see anywhere if this example stops working. So you could add the plot to the docs somewhere (then the docs will break if things break). Or move it to tests.
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.
Let's address in this in a future PR, where I will also add a box model test case and such "smoke tests". I'll open an issue.
Purpose
Creates a flexible many-moment microphysics option based on the computational framework of Cloudy.jl.
To-do
Next steps:
Content
Note: GPU and performance tests are not and will not be included in the initial integration.