Comments (6)
Where is the momentum equation implemented?
from oceananigans.jl.
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.
I propose that we modify the contents of this loop:
-
Write small functions that correspond to the many self-contained and logically distinct steps in the loop.
-
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. -
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.
-
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 beNonHydrostatic
,Linearized
,Hydrostatic
, etc), or perhaps by classifying the model itself (e.g.HydrostaticModel
,NonHydrostaticModel
,LinearModel
). I think a newEquation
attribute of the model makes a lot of sense, because that type can be defined with parameters likeAdvectionOrder=4
, etc).
For reference, this is what AB3 looks like in FourierFlows.jl.
from oceananigans.jl.
from oceananigans.jl.
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.
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)
- Allow different advection schemes for momentum and tracers in `NonHydrostaticModel` HOT 1
- Regression test(s) for `SplitExplicitFreeSurface` HOT 2
- Ensure `simulation.Δt` is the same across MPI ranks HOT 1
- Global reductions for `Distributed` `Field`s
- Boundary condition ordering HOT 7
- Mid-Level Enzyme + Oceananigans Integration Test HOT 1
- Update docs to change `FieldSlicer` to `indices` HOT 1
- `interpolate` doesn't work with `Nothing` locations HOT 7
- Should the time step wizard take into account of background velocity in calculation of CFL number?
- Broadcasting slices of fields doesn't work as expected HOT 8
- bug with background fields? HOT 14
- Are we actually `@unroll`ing when we think we are? HOT 13
- Documentation for latest versions does not seem to be working HOT 3
- Slow initialization after updating to v0.90.0 HOT 32
- `compute_regionally` must be deprecated HOT 3
- Prescribing realistic bottom bathymetry HOT 3
- Fix up `ShallowWaterModel.jl`
- Nonhydrostatic pressure correction broken? HOT 6
- `JLD2OutputWriter` and `Checkpointer` don't work when `max_filesize` and `part` are specified. HOT 2
- Bugs in the Tilted Bottom Boundary Layer Example Code HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oceananigans.jl.