-
Notifications
You must be signed in to change notification settings - Fork 26
Add cloud top height diagnostic #4023
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
base: main
Are you sure you want to change the base?
Conversation
5b0819b
to
afbf27f
Compare
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.
LGTM. Thanks!
src/diagnostics/core_diagnostics.jl
Outdated
|
||
ct_constants = CAP.microphysics_cloud_params(cache.params).ct_constants | ||
|
||
q_cond = @. lazy(clw + cli) |
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.
q_cond = @. lazy(clw + cli) | |
# Condensate density (kg/m^3) | |
q_cond = @. lazy(state.c.ρ * (q_liq + q_ice)) |
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.
@tapios why do you want this to be per volume? (Doing it this way would require changing the threshold and k constants to also be per volume, which I wasn't initially doing)
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 the same you had before, isn't it? There were two multiplications by density in l. 1133/1134 before, and I replaced by the one multiplication here. I was wondering why it was there but thought you had reasons for it. It does make more sense to me to have the thresholds be on specific humidity (i.e., by mass).
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.
Oops you're right! I'll just remove it.
05d339b
to
28fbf53
Compare
28fbf53
to
2ab1cf9
Compare
ct_constants = CAP.microphysics_cloud_params(cache.params).ct_constants | ||
|
||
# Condensate density (kg/m^3) | ||
q_cond = @. lazy(state.c.ρ * (q_liq + q_ice)) |
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 better to show densities (per volume) with something else maybe L
or ρq
# 2. Create a numerically stabilized exponential weight to favor higher altitudes | ||
az = @. lazy(ct_constants.a * z) | ||
max_az = maximum(az) # This prevents overflow in the exp() call | ||
exp_az_stabilized = @. lazy(exp(az - max_az)) |
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 parameter a
is dimensional (1/m) unless the variable exp_az_stabilized
is given by exp(a(z/zmax - 1))
q_cond = @. lazy(state.c.ρ * (q_liq + q_ice)) | ||
|
||
# 1. Create the "cloudiness" mask using the sigmoid function | ||
w = @. lazy(1 / (1 + exp(-(state.c.ρ * ct_constants.k) * (q_cond - (state.state.c.ρ * ct_constants.thresh))))) |
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 can also try multiplying the mask by condensate mass signal itself to get rid of noise.
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.
Also, here k is dimensional (m^6
) too.
This diagnostic calculates a resolution invariant cloud top height. It is sensitive to three parameters that have been added to ClimaParams -- "cloud_top_threshold," "cloud_top_k," and "cloud_top_a." Results are sensitive to parameter choices. I hand tuned to get somewhat decent default parameters with these results:
