Giter Club home page Giter Club logo

Comments (6)

glwagner avatar glwagner commented on May 22, 2024

Where is the momentum equation implemented?

from oceananigans.jl.

ali-ramadhan avatar ali-ramadhan commented on May 22, 2024

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.

from oceananigans.jl.

glwagner avatar glwagner commented on May 22, 2024

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.

from oceananigans.jl.

ali-ramadhan avatar ali-ramadhan commented on May 22, 2024

from oceananigans.jl.

ali-ramadhan avatar ali-ramadhan commented on May 22, 2024

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.

from oceananigans.jl.

ali-ramadhan avatar ali-ramadhan commented on May 22, 2024

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

from oceananigans.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.