-
Notifications
You must be signed in to change notification settings - Fork 5
Implement a KinematicModel based on PrescribedVelocityFields #394
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
Conversation
| Set the velocity component `name` (`:u`, `:v`, or `:w`) to `value`. | ||
| Also updates the corresponding momentum field. | ||
| """ | ||
| function set_velocity!(model::AtmosphereModel, name::Symbol, value) |
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 set velocity as a function of time? I believe so, but I’m not certain.
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! For time-dependent velocity fields, you need to build them explicitly in advance of the model with PrescribedVelocityFields and then pass them into the model:
model = AtmosphereModel(grid; velocities=prescribed_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.
Initially I was thinking taht we wouldn't support set! at all, but it is actually simply enough if the velocities are ordinary Field.
For boundary conditinons, do you think that we should accept boundary conditions on the velocity field? eg something like
w_bcs = FieldBoundaryConditions(bottom=OpenBoundaryCondition(w_inlet))
boundary_conditions = (; w = w_bcs)
model = AtmosphereModel(grid; boundary_conditions)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 believe it should also be easy to have inlet boundary conditions with PrescribedVelocityFields (in that case no special thing is needed except defining functions w(z, t) that are non-zero at z=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.
Initially I was thinking taht we wouldn't support
set!at all, but it is actually simply enough if the velocities are ordinaryField.For boundary conditinons, do you think that we should accept boundary conditions on the velocity field? eg something like
w_bcs = FieldBoundaryConditions(bottom=OpenBoundaryCondition(w_inlet)) boundary_conditions = (; w = w_bcs) model = AtmosphereModel(grid; boundary_conditions)
Looks good to me!
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
|
Great! We now have a working kinematic model. While WENO is desirable, I think this should be good for now. |
@kaiyuan-cheng these results were generated by using a velocity field that satisfies the anelastic continuity equation. I looked into it and I think there are two cases that we want:
The first case is needed for P3 validation I think. Here's another reference for kinematic drivers: https://github.com/Adehill/KiD-A/blob/master/docs/KiD_2.3.2625.pdf note, our kinematic driver will support 1D, 2D, and 3D. |
|
@kaiyuan-cheng let me know if you agree! The divergence term is easy to add, and with that form we can still use WENO for |
The divergence term at the boundaries is necessary if we want to enforce mass continuity. Admittedly, I don’t understand why WENO works in this case but not in the previous one. |
Here's an explanation. The advection term is We don't have a WENO method to evaluate this term as is. Also note that on a staggered grid, this term must be evaluated at cell centers. However, neither However, we can rewrite this term because therefore The expression on the right has different numerical properties than the expression on the left. The term The second term is When we have CompressibleDynamics or AnelasticDynamics, this second term combines with the tendency term or vanishes (respectively). However with PrescribedDynamics, we want to keep this second term. |
| # Convenient method for letting the user specify only the divergence parameter | ||
| # and infer the others. | ||
| function PrescribedDynamics{Div}(density::D, | ||
| pressure::P, | ||
| surface_pressure::FT, | ||
| standard_pressure::FT) where {Div, D, P, FT} | ||
| return PrescribedDynamics{Div, D, P, FT}(density, pressure, surface_pressure, standard_pressure) | ||
| 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 added this method for resolving the method error when trying to run
| return PrescribedDynamics{divergence_correction}(density, pressure, p₀, pˢᵗ) |
PrescribedDynamics with a single type parameter, but in reality it requires 3 more and there was no method to actually do it. I presume you wanted something like this (and tests pass for me now), but feel free to adapt it if you were thinking something else.
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.
do we need a inner constructor then?
docs/make.jl
Outdated
| example_pages = [] # Empty for fast builds | ||
|
|
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 all green now, can this be removed? Do you want to add the new example to the list?
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 and yes
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>




This "kinematic driver" can be used to test microphysics schemes.