-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adding Cloudy tendencies #159
Conversation
5e6e36c
to
916c50a
Compare
Add to-do-list updates Update CloudyMoisture Add cloudy params + activation WIP on advection Fixing advection with dolla-dolla-i final touches now it's unstable with activation fix the activation issue making the results work... Setup the col-sed only case final touches on col_sed + plots working on making it stable fix the activation source term updates to plotting
916c50a
to
7ce8cee
Compare
arg_type = String | ||
default = "NonEquilibriumMoisture" | ||
"--prognostic_vars" |
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'm very happy to commit to one prognostic variable choice. Do you have a preference for theta or T? We should delete the other from CI and tendency options too
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 prefer T, because in PySDM KiD and also in Shipway and Hill T is fixed.
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.
Agreed on 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.
Sajjad, this all looks fantastic -- thank you for merging my commits with the new KiD structure!
test/create_parameters.jl
Outdated
@@ -85,4 +86,36 @@ function create_kid_parameters(toml_dict) | |||
return kid_params | |||
end | |||
Base.broadcastable(x::KID.Parameters.KinematicDriverParameters) = Ref(x) | |||
|
|||
function create_cloudy_parameters(NM, FT) |
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.
Could you add some docstring explaining what is happening here? Or link to Cloudy documentation if it's explained there? I'm asking about NM / 3
, 1e6
and 1e-9
in norms
, 5e0
in kernel_func
, 5e-10
1e-6
in KernelTensors
and CoalescenceData
and vel
, etc.
src/Common/tendency.jl
Outdated
@. q_rai = q_(Y.moments.:($$rain_mass_ind), ρ) | ||
@. moments = Y.moments | ||
|
||
tmp = @. cloudy_precompute_aux_precip_helper(cloudy_params, moments, pdists) |
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'm not very good at this, but I think that the way the Cloudy tendencies are added, both here and in 1D model, is allocating. Maybe instead we could create additional variables that we need for Cloudy and put them in scratch
for temporary things that need to be stored during computations (like supersaturation, maybe pdists
?) and in aux
for the ones that need to be precomputed for tendencies.
I was trying to write all the other tendencies like
@inline function precompute_aux_important_sources!
source_term = aux.scratch.tmp
(; stored_variable) = aux.microph_variables
@. source_term = some_micro_foo(stored_variable)
@. aux.important_sources = to_sources(-source_term, source_term)
end
@inline function important_sources_tendency!
precompute_aux_important_sources!
@. dY.ρq_tot += aux.thermo_variables.ρ * aux.important_sources.q_tot
end
It is more complicated for Cloudy than the other microphysics models. There are software office hours on Wednesday. If we can't figure it out by then, maybe we could submit it as a request to help then?
Thank you for adding Cloudy to KiD! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
==========================================
- Coverage 81.13% 72.34% -8.79%
==========================================
Files 28 28
Lines 1834 1884 +50
==========================================
- Hits 1488 1363 -125
- Misses 346 521 +175 ☔ View full report in Codecov by Sentry. |
src/K1DModel/tendency.jl
Outdated
|
||
aerosol_distribution = | ||
CMAM.AerosolDistribution((CMAM.Mode_κ(r_dry, std_dry, N_aer, (FT(1),), (FT(1),), (FT(0),), (κ,)),)) | ||
N_act = CMAA.N_activated_per_mode(activation_params, aerosol_distribution, air_params, thermo_params, T, p, w, q)[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.
This is out of date with the aerosol activation PR that I merged, apologies!
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.
Can we use this one: CMAA.total_N_activated
? Or does it have to be only one aerosol mode for Cloudy right now?
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.
Thank you for adding more meaningful tests and Cloudy!
I think the aerosol activation needs to be updated with what I merged. IS everything else good to be merged?
Purpose
To-do
Content