CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Modified interFoam compilation fails (

voingiappone December 12, 2012 03:03

Modified interFoam compilation fails (SOLVED)

I have been looking for a solution for a mixing time determination problem in the postprocessing section and I have been introduced for the first time to the modification of OpenFOAM solvers. That created another bigger problem I don't seem to be able to solve.

Despite the addition of temperature in the simpleFoam worked as expected, I cannot compile the interFoam solver.... even before making any modification! The error I get is:


Make/linux64GccDPOpt/tracer_interFoam.o: In function `main':
tracer_interFoam.C:(.text.startup+0xe8c): undefined reference to `Foam::incompressible::turbulenceModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&)'
collect2: ld returned 1 exit status
make: *** [/home/piota/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/tracer_interFoam] Error 1

I desperately searched inside the source to find something to solve the problem and I ended up identifying (probably) the .H file which causes trouble. I found that the references are in the turbulenceModel.H file which includes the volFieldsFwd.H file that defines fvPatchField and fvsPatchField.

I tried with my 0 (zero) knowledge to comment out the definitions of functions and run wmake again but it was obviously complaining that no definition of the variables was done.

Is there anybody who has an idea why the "out of the box" compiling of interFoam fails miserably like this??

Thank you in advance

voingiappone December 12, 2012 03:50

to enrich the discussion I just found a bug which look similar to my error.

That got solved but unfortunately the same does not apply to my case.
I suspect it can be of some help though....

voingiappone December 12, 2012 04:51

And then.....
he finally found the solution!! :D:D:D

I used the bug reported in the link in the previous post to do a comparison with my case. The compiler was complaining about the Foam::incompressible::turbulenceModel:: while the bug was reporting a complain about the Foam::interfaceProperties::interfaceProperties that could be solved by the -linterfaceProperties in the proper options file.

As in my case I already had it linked and as I was having problems with the "turbulence" I immediately realized that the problems were quite similar. I headed then for the /OpenFOAM-1.6/lib/linux64GccDPOpt folder and identified the library I needed (
I modified the options file including the proper line and making it looking like this:


    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \

    -linterfaceProperties \
    -lincompressibleTransportModels \
    -lincompressibleRASModels \
    -lincompressibleLESModels \
    -lfiniteVolume \

run wmake and ended up with a working interFoam executable!

It took me one day to figure out how to do this trivial thing but I worked out all by my self, so it was a good study session.

I'll leave it here for any future reference!


sbusmayer September 18, 2013 09:41

Dear voingiappone, I read your posts and am trying to calculate residence time of a potable water tank that has an inlet and outlet. I want to use a tracer with the same characteristics as the water and visualize the concentration at the outlet over time.

Did you use Temperature as a tracer or Concentration?

I'm guessing that you succeeded with your case, so would like to ask if you could share with me your codes please?

Really appreciate your help!

voingiappone September 19, 2013 04:29

Samanta, thanks for the interest in my posts!


Originally Posted by sbusmayer (Post 452390)
Did you use Temperature as a tracer or Concentration?

I used a "passive scalar" that is, I added de-novo another equation in the InterFOAM which is solved separately from the main one. I used the same approach used with the temperature in icofoam (you probably already know this Have you tried that tutorial? I strongly suggest you to try it as it is not time consuming at all and you can learn a lot of things. It helps expecially when you will try to add other things later!

By the way the equation you want to end up with is:

\frac{\partial C}{\partial t}+\nabla \cdot \phi C + \nabla\cdot D \nabla C = 0

which reads in the code as


+ fvm::div(phi, C)
+ fvm::laplacian(D, C)

Once that you have your equation in the solver you can use the diffusion coefficient for the tracer you want to simulate (I used NaCl with D=2 e-9) and you are good to go!

I think you can get everything working in half a day so try it.
If you will fail for some reason I will send the files but I will have to modify them back as I added tons of new modifications after this one. I am also not so sure that the modifications are compatible in all OF versions.

Let me know.


sbusmayer September 20, 2013 17:33

Dear voingiappone,
Thank you SO MUCH for your reply! It really helped me to understand what to do for now.
I used a modified icoFoam with NaCl as tracer in my tank geometry =)

My following steps are:
1) Just give a pulse of the tracer at t=0 for about 1min, and then plot the concentration curve at the outlet. Have you done this?
2) Add turbulence - Do you think pimpleFoam would do?

Thx mate!!

voingiappone October 1, 2013 03:47

Samanta, I wrote my reply back in the other thread.

All times are GMT -4. The time now is 00:59.