# Open source codes for 2D instationary Navier Stokes equations

What open source tool can be recommended for solving 2D instationary Navier Stokes equations (in simple geometries, but with high Reynolds numbers)? Most packages I found, I'm not very lucky with. OpenFOAM seems to be very powerful, but I think it would take some time to learn using it. FEniCS has a Navier Stokes demo, but only for the stationary case and I'm not sure if it will work for large Reynolds number. Are there any other good options? In the best case, I would like not to write new code, but just provide the geometry, boundy conditions, and data for the initial timestep.

• How do you want to account for the high Reynolds number? Do you want to do turbulence modelling? Then you should look out for finite volume implementations. – Jan Oct 18 '13 at 13:31

Before I answer your question, I just want to clarify one key point: Solving PDE's, like Navier Stokes equations, requires a two step process:

1. Geometry Discretization (meshing)

2. Solution of the linear equations

Usually this is done with two separate programs. Meshing can be a very costly operation by itself and should be done carefully according to the user's accuracy requirements. There are many freeware programs that accomplish this. If your geometry is not too complicated, and prefer using a GUI interface, I'd recommend something like NETGEN or GMSH (both available as apps on Ubuntu).

Solvers also require a lot of user input beyond the basic boundary and initial conditions. Particularly for the Navier Stokes equations, you'll have to the specify the type of time stepping scheme and parameters for the linear solver. Both of these can have a significant impact on the accuracy of your solution. There are, in fact, many many many different freeware solvers out there for the navier stokes equations. The trick is finding a solver that can input your mesh data type. If I'm not mistaken, I believe NETGEN and GMSH both produce file types that can be imported onto ELMER, a free finite element solver available also on UBUNTU.

There are, of course, many other options and probably better ones that what I've recommended here. But this should be able to get you started.

• In my case, geometry discretization does not play a crucial role, as I want to solve the Navier Stokes equations in a simple 2D box without any holes. – Thomas W. Oct 18 '13 at 19:54

OpenFOAM has turbulence models built in, which is helpful. I think it's easier to use OpenFOAM as a black-box solver than to modify its internals (which I found was very difficult given the lack of developer documentation and OpenFOAM coding style). If you're solving the Navier-Stokes equations, there's probably already a solver available in OpenFOAM, in which case, most of the work would be importing a geometry and writing input files. The documentation for these steps is decent, so OpenFOAM might be a good option for you if you want to use a finite volume code.

If this is all you need, you might have a look at FreeFem++. There are several working examples (look at the manual, sections 3.9 for a simple example, 3.11 with turbulence), it is very easy to use and you can change the geometry easily, without having to create a mesh with another software.

(However, you have to stick with 2D, and it's not a real library).

I would suggest gerris. It does not have a very steep learning curve for simple problems/configurations and it is still being actively developed. It also has adaptive mesh refinement and you can import complex geometry from CAD software. For simpler geometry like boxes, cylinders etc. you can directly define them in the input file. Try starting with tutorial page and you may want to check the examples section for more complex problems. It also comes as a package in debian systems so installation should not be a problem if you are on a linux system.

I can recommend the one that I'm working on - caffa-sst.

It is a 2d finite volume code written in Fortran. It works for structured, non-orthogonal body-fitted meshes (mesh generator included).

I started with the CAFFA code from Ferziger and Peric book, and added $k-\omega$ SST model by Menter, Automatic Wall Treatment, least-square gradient calculation, flux limited schemes for convection terms (like MUSCL), Paraview output, etc.

Haven't work on it for almost a year, but I still plan to upgrade it more.