CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Recompile turbulence model in OpenFoam (

qtian November 20, 2007 14:44

Hey, folks, I want to learn
Hey, folks,

I want to learn how to recompile turbulence models in OpenFoam. I did some tests as following.

I modified the turbulenceModel.H file by multiplying the effect viscosity by 2. Then use "wmake libso" to recompile the turbulence model.

virtual tmp<volscalarfield> nuEff() const
return tmp<volscalarfield>
new volScalarField("nuEff", 2*nut() + 2*nu())

I restarted a new simulaiton and the new results I got are almost exactly same as the previous one without changing the turbulence model. This makes me wondering whether I did right thing about recompiling the turbulence model. Can anyone give me some comments and suggestions? Thanks.



cedric_duprat November 20, 2007 16:45

Hi Quinn, maybe you forgot to
Hi Quinn,
maybe you forgot to recompile again your solver (wmake).
because it did't change, you have to do a "touch *.C"
and then recompile to take into account ou modification in turbulence.H
hope it helps,

qtian November 20, 2007 17:14

Cedric, Thanks for your rep

Thanks for your reply. I did recompile my simpleFoam solver with wmake. I did this after I recompiled the turbulence model. I don't know why the solver did not "see" the changes I made. Is there any other thing I did not consider? Thanks


cedric_duprat November 21, 2007 04:08

Quinn, your solver didn't see
your solver didn't see the changes because the solver didn't change.
that's why I told you to do a "touch simpleFoam.C" before compiling your solver.
The touch command updates the access and modification times of the named files to the current time and date. The command is useful because some commands rely on a file's access and modification times.
So the compilation will take into account your new library.
If it still doesn't work, maybe it is because it's not the right file to change :o)


qtian November 21, 2007 10:28

Cedric, Thanks for the clar

Thanks for the clarification. I was thinking that "wclean" will do the same job as "touch" command.

I am rerunning my simulation now. Hopefully it will work this time. Thanks again for your help.


qtian November 21, 2007 13:54

Unfortunately, even though I "
Unfortunately, even though I "touch" source file and recompiled it after I modified the turbulence model, my new simulation results is still same as before. This time, I multiplied effective viscosity by 1000 and I am not suppose to have the same results.

When I started the new simulation, I just cloned from the old simulaiton and started the new simulation from the last step of the old simulation. Will this be a problem? Is the old solver imbeded in the old case file?

If anyone know what I did wrong, please give me some suggestion. I am realy stuck here. Your help is appreciated.


qtian November 26, 2007 15:15

Hello, folks, I deleted "k
Hello, folks,

I deleted "kOmegaSST/kOmegaSST.C" from turbulence model make/files and recompiled turbulence model with "wmake libso". I also recompiled my simpleFoam solver. What surprised me is that I can still use kOmegaSST model for my simulation after I removed the kOmegaSST.C file.

At the end of the compilation, I also got a message like this "/home/qtian/OpenFOAM/OpenFOAM-1.4/lib/linuxGcc4DPOpt/libincompressibleTurbulenc' is up to date."

Can anyone tell me what is the problem? I have been stuck here for several days. Please give me some help if you can. Thanks for your help.


qtian November 26, 2007 16:51

hello, all, I figured it ou
hello, all,

I figured it out what is the problem. Just for the record,since I had the same name "" at $(FOAM_LIBBIN) and $(FOAM_USER_LIBBIN), OpenFOAM solver used the one under $(FOAM_USER_LIBBIN). The make/files for turbulence model update the new lib in the $(FOAM_LIBBIN) folder. That is why simpleFoam solver did not "see" my change in turbulence model.


All times are GMT -4. The time now is 23:40.