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)
- `Mem.free` is deprecated HOT 1
- Add in documentation for user defined vertical diffusivity profile in the hydrostatic model HOT 3
- Error in AveragedTimeInterval Output HOT 32
- Documentation 2.0 HOT 3
- Egregious errors in `NonhydrostaticModel` simulations on `ImmersedBoundaryGrid` when nonhydrostatic pressure is not separated HOT 21
- `cell_advection_timescale` (and CFL) does not account for `Flat` topologies HOT 1
- Support passing keyword arguments to `jldopen` when using `FieldTimeSeries` HOT 1
- `PartialCellBottom` needs to be adapted correctly for the GPU when using a `HydrostaticFreeSurfaceModel` HOT 4
- Performance benchmarks section of the README is super out of date HOT 3
- `view` fails on a `Field` indexed from `FieldTimeSeries`
- Ocenanigans license HOT 5
- Reducing parameter space usage by `LatitudeLongitudeGrid` HOT 3
- Why do we need 4 halo points in the vertical for `VectorInvariant(vertical_scheme=Centered())`? HOT 2
- `xspacings` is broken for `ImmersedBoundaryGrid`
- Change free surface displacement name from `η` to `displacement` for `HydrostaticFreeSurfaceModel` HOT 1
- Docstring for `WENOVectorInvariant` is too terse and does not have examples
- Bottom drag on immersed boundaries may differ if implemented with `Forcing` vs `ImmersedBoundaryCondition`
- Convert code blocks documenting `ImmersedBoundaryCondition` to doctests HOT 10
- Re-licensing Oceananigans under Apache 2.0
- Do `intrinsic_vector` and `extrinsic_vector` belong in `Operators`? HOT 8
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.