# Implementation of Navier-Stokes Equation for Ocean Waves

I am doing an undergraduate research to model ocean waves in shallow waters in real time. I am trying to base my research on Navier-Stokes equations since they produce the most accurate mathematical results. As a start I am supposed to study an existing implementation of the 3D Navier-Stokes equations.

Where can I find a most suitable implementation for the purpose of my research?

I also came across a set of equations called the shallow water equations derived from the Navier-Stokes equations. Are there any suitable implementations of them as well?

Also can I know the different approaches that exist in solving these equations with pros and cons....

• Welcome to scicomp! I took the liberty of fixing some spelling issues (note that it is "Stokes", not "Strokes". Jun 1 '14 at 8:46
• If you can say more about what your intended application is and what kind of hardware you will run on, that would help narrow down the list of potential solvers. Jun 1 '14 at 8:54

Numerical solvers for 3D Navier-Stokes: I assume you mean for incompressible fluids. This is a huge question; there are many methods and many codes out there.

Shallow water equations: Again, there are very many methods and codes. I will point you to the ones that I know best. Both are part of Clawpack.

• PyClaw - General hyperbolic conservation law solver that includes 1D and 2D shallow water solvers. The interface is Python. Includes MPI parallelism. I would go with this option if you will only handle idealized problems.
• GeoClaw - A widely used code for modeling tsunamis, storm surges, and flooding. The interface is partly Python and partly Fortran. Includes adaptive mesh refinement and OpenMP parallelism. I would go with this option if you intend to incorporate things like real-world bathymetry in your simulations.
• What I am trying to do is as follows: There are many numerical models available to model shallow water ocean waves in real-time for simulators. However. researchers have neglected 3D Navier-Stokes equations given that they are computationally expensive for real time simulations. I am trying to study whether a refinement to this can help us develop a more accurate mathematical model for Shallow Water Waves in real-time. So as a start I need to study an existing implementation of the 3D Navier-Stokes equation. I see that there are many out there. I want to know which one to pick. Jun 1 '14 at 15:35

I found an implementation of Shallow Water equations in FreeFEM++ using finite volume method in the FreeFEM++ wiki. Have a look at the paper.

The most important limitation of the shallow water equation is arguably that overturning waves can not be represented. People in graphics have tried to overcome this limitation, consider e.g. this paper. I'm not sure if this model readily extends to physically accurate solutions.

As for the implementation of the shallow water equation, a good point to start your research might be using the most simple option, namely a finite difference approach. You can find a MATLAB implementation here. The actual simulation loop fits in one line.