-
Notifications
You must be signed in to change notification settings - Fork 186
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
Ability to turn off/on certain terms in the momentum equations. #36
Comments
Where is the momentum equation implemented? |
Here is where the different terms in the u-momentum equation are calculated and added to the u source term. It's not super pretty but shouldn't be too hard to refactor it to be more readable. https://github.com/ali-ramadhan/Oceananigans.jl/blob/e1be1f0e3f067cdb4236eb5e7b962e0c772ce4d1/src/time_steppers.jl#L55-L77 In order: it's momentum advection -u∇u, Coriolis fv, hydrostatic pressure anomaly ∂xpHY′ encoding the buoyancy, and viscous dissipation 𝜈∇²u. There's also viscous drag added to the top and bottom to impose no-slip (sounds weird but it's the finite volume way of imposing an equal and opposite flux at the boundary to get zero velocity I think). There's a bug in that |
I propose that we modify the contents of this loop:
For reference, this is what AB3 looks like in FourierFlows.jl. |
These are great suggestions, definitely points 1-3 are easy to implement
and should make the time stepping code much more readable.
Point 4 might take a bit of restructuring so might be good to discuss but
points 1-3 have to be implemented first anyways
…On Mon, Feb 11, 2019, 8:17 PM Gregory L. Wagner ***@***.*** wrote:
I propose that we modify the contents of this loop
<https://github.com/ali-ramadhan/Oceananigans.jl/blob/e1be1f0e3f067cdb4236eb5e7b962e0c772ce4d1/src/time_steppers.jl#L34>
:
1.
Write small functions that correspond to the many self-contained and
logically distinct steps in the loop.
2.
Write a function that calls the correct sequence of small functions
for a particular physics implementation, independent of the time-stepping
--- calc_right_hand_side, or the like.
3.
Write a function that does the time-stepping. You can implement
Forward Euler timestepping trivially, and default to Adams Bashforth to
understand how this function differs for different time-steppers.
4.
Run multiple dispatch on the calc_right_hand_side function, either by
dispatching on a new attribute of the model (e.g., Equation, which
might be NonHydrostatic, Linearized, Hydrostatic, etc), or perhaps by
classifying the model itself (e.g. HydrostaticModel,
NonHydrostaticModel, LinearModel). I think a new Equation attribute of
the model makes a lot of sense, because that type can be defined with
parameters like AdvectionOrder=4, etc).
For reference, this is what AB3 looks like in FourierFlows.jl
<https://github.com/FourierFlows/FourierFlows.jl/blob/f7a87d4090123fc3c241bed621b64660a6f3596f/src/timesteppers.jl#L469>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/ali-ramadhan/Oceananigans.jl/issues/36#issuecomment-462570434>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATKyBfr4tRRfEgsJlRfyIB1XAAVwc34Nks5vMhY8gaJpZM4ayqJ3>
.
|
Forgot to mention that switching on and off terms was more for debugging purposes than changing the equation. If the physics looks wrong or if the solution is blowing up for some odd reason, turning terms off and on can help determine which term is the issue (or which term contains a bug). Turning off terms can also let us compare with some analytical solutions to Navier-Stokes, e.g. the spin-up of a barotropic gyre by sinusoidal wind stresses. |
Closing this issue as it's been kind of absorbed into a larger issue around having an equation abstraction: #259 |
Drafting a DYCOMS verification experiment
E.g. turn off/on momentum advection or Coriolis. Could be very useful for debugging.
The text was updated successfully, but these errors were encountered: