Skip to content
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

Closed
ali-ramadhan opened this issue Feb 9, 2019 · 6 comments
Closed
Labels
abstractions 🎨 Whatever that means

Comments

@ali-ramadhan
Copy link
Member

E.g. turn off/on momentum advection or Coriolis. Could be very useful for debugging.

@ali-ramadhan ali-ramadhan added the feature 🌟 Something new and shiny label Feb 9, 2019
@glwagner
Copy link
Member

Where is the momentum equation implemented?

@ali-ramadhan
Copy link
Member Author

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 bc.bottom_bc == :no_slip ends up imposing no slip at the top as well.

@glwagner
Copy link
Member

I propose that we modify the contents of this loop:

  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.

@ali-ramadhan
Copy link
Member Author

ali-ramadhan commented Feb 12, 2019 via email

@ali-ramadhan ali-ramadhan added this to the v0.5 milestone Feb 13, 2019
@ali-ramadhan
Copy link
Member Author

ali-ramadhan commented Feb 18, 2019

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.

@ali-ramadhan ali-ramadhan added abstractions 🎨 Whatever that means and removed feature 🌟 Something new and shiny labels Mar 2, 2019
@ali-ramadhan ali-ramadhan removed this from the v0.5 milestone Mar 6, 2019
@ali-ramadhan
Copy link
Member Author

Closing this issue as it's been kind of absorbed into a larger issue around having an equation abstraction: #259

ali-ramadhan added a commit that referenced this issue Oct 19, 2020
Drafting a DYCOMS verification experiment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abstractions 🎨 Whatever that means
Projects
None yet
Development

No branches or pull requests

2 participants