What is the best software for quickly implement and test a Reynolds Averaged Navier-Stokes turbulence model ?
It's really easy to implement models there, even if you do not know how to program in C++, everything is set up, and you can just follow the pattern. If you do know something about similar class interfaces/dynamic polymorphism using virtual functions, then it is exceptionally easy.
Model, explicit, or implicit, will involve manipulations on fields, and in OpenFOAM, field manipulation is really simple (Open Field Operaton And Manipulation), as you can see on e.g. page 21 of the OpenFOAM programming slides. Generic programming and function overloading allows for top level coding when it comes to model development: your code looks exactly as the governing equations you are solving, or the calculation you are doing on the fields.
On this level, the resulting code is automatically parallel, with a choice between various types of parallel libraries (flavorus of MPI and recently OpenMP). Testing the model is easy as well, the model will have (if you have just followed the structure of other models, existing turbulence models, viscosity models, etc, the code structure is always the same) automatically enabled run-time selectivity, which means that you can change parameters durign a run.
That's from the top of my head.... there are other advantages: the library is modular, supports highly advanced topological changes on arbirary unstructured meshes (sliding interfaces, refinement, mixing planes, etc), has top notch numerical solvers... all in all: it's really cool. :)
you can examine the hierarchy of of models here, then find a model in the source code using the locate command :
locate turbulenceModel.H brings you to the source directory of the abstract base class (root class, basic type of the turbulence model), in my case it is (src/turbulenceModels/incompressible/RAS).
After that, find the one that resembles your model, copy the code, rename the classes (if you are using a vim editor, try %s/oldName/newName/g in all the source files), and compile it as a part of your new library. Et voila, a new turbulence model, parallel, shiny, run-time modifiable, etc.
I would propose something different than previous post... I suggest you take some lightweight code like 'CAFFA' from Ferziger and Peric CFD book, available in 2dgt folder at this site. Everything is laid out in less then 2000 lines in front of you, no need to know anything about OOP. You will get more confidence because you know every line of the code.
What does it mean to implement a new turbulence model?
Having this source code, you will learn that in case of most RANS models, implementing a new turbulence model means doing following few things in subroutines dedicated to solving transport equation of a scalar:
- unsteady term - do nothing
- convection term - do nothing
- diffusion - change diffusion coefficients ($\sigma$'s in $k-\epsilon$)
- volume source terms (production, destruction)- you might have to change them. This is where coefficients of your new turbulence model come into play as well. You calculate them (source terms) explicitly using known values and mid-point rule for integration. It's really easy.
- eddy viscosity - go to routine where it's calculated, in worst case you will have to change one line of code to get new form of equation for it.
- boundary conditions - you usually change them too, except in a case when you're solving same transport equation as the one you already have implemented.
That's about it if you are working with RANS models.
Set up a channel case of $Re_\tau = 395$ for which there is available DNS database, and try to get matching in logarithmic velocity profile. Even without DNS there is well-known "Law of the wall" to help you. Every well tuned (in terms of coefficient values) turbulence model should reproduce it correctly. This will be validation or the answer to question are you solving the equations right. Then setup a test case intended for turbulence model verification, like some from ERCOFTAC database.