-
Notifications
You must be signed in to change notification settings - Fork 26
Moisture fixer #4105
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?
Moisture fixer #4105
Conversation
1fdcec3 to
948f1c6
Compare
948f1c6 to
f84a95c
Compare
sajjadazimi
left a comment
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! I just left a comment about how we compute qv. We can define a function for computing qv (depending on microphyiscs model) and then apply the fixer on a list of tracers (moisture_species) without checking moisture and microphyiscs models. But feel free to merge as is and leave this to future PRs.
| qᵥ = @. lazy( | ||
| specific(Y.c.ρq_tot - Y.c.ρq_liq - Y.c.ρq_ice - Y.c.ρq_rai - Y.c.ρq_sno, | ||
| Y.c.ρ), |
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 we can define a function to return vapor specific humidity as it is used multiple times at different places. This way we don't have to check the microphysics model; we can have a list of tracers and return if the tracer does not exist and fix if it exists.
|
|
||
| # NOTE: This will zero out all momentum tendencies in the EDMFX advection test, | ||
| if moisture_model isa NonEquilMoistModel && | ||
| microphysics_model isa Microphysics1Moment && |
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.
We can apply the fixer for both 1M or 2M microphysics models.
| if moisture_model isa NonEquilMoistModel && | ||
| microphysics_model isa Microphysics1Moment && | ||
| p.atmos.water.moisture_fixer | ||
| moisture_species = (@name(c.ρq_liq), @name(c.ρq_ice), | ||
| @name(c.ρq_rai), @name(c.ρq_sno), | ||
| ) | ||
| qᵥ = @. lazy( | ||
| specific(Y.c.ρq_tot - Y.c.ρq_liq - Y.c.ρq_ice - Y.c.ρq_rai - Y.c.ρq_sno, | ||
| Y.c.ρ), | ||
| ) | ||
|
|
||
| MatrixFields.unrolled_foreach( | ||
| moisture_species, | ||
| ) do (ρq_name) | ||
| ᶜρq = MatrixFields.get_field(Y, ρq_name) | ||
| ᶜρqₜ = MatrixFields.get_field(Yₜ, ρq_name) | ||
| ᶜq = @. lazy(specific(ᶜρq, Y.c.ρ)) | ||
| # Increase the grid mean small tracers if negative, | ||
| # using mass from grid mean vapor. | ||
| @. ᶜρqₜ += Y.c.ρ * moisture_fixer(ᶜq, qᵥ, p.dt) | ||
| end | ||
| end |
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 think it would be better to move this to a function under src/parameterized_tendencies/microphysics.
| cloud_model::CM = nothing | ||
| noneq_cloud_formation_mode::NCFM = nothing | ||
| call_cloud_diagnostics_per_stage::CCDPS = nothing | ||
| moisture_fixer::MF = false |
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.
| moisture_fixer::MF = false | |
| moisture_fixer::Bool = false |
(I don't think we need an extra type here)
|
Looks good to me, thanks! I just left some minor comments. |
Adds a tendency that adjusts negative small cloud and precipitation values towards zero at the expense of water vapor. Switched off by default to prevent it from masking other problems.