CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Building a custom solver on OpenFOAM 2.0 (

wschosta July 7, 2011 17:17

Building a custom solver on OpenFOAM 2.0
I have been working on a custom solver on OpenFOAM 1.7.1 for a few months now and today I decided to install OpenFOAM 2.0.0 and see if my solver would be able to install cross-version.

I was able to install OpenFOAM 2.0.0 without any problems whatsoever so I added my solver to the application directory and ran wmake and it ran almost to completion, returning an error in the last 5 lines:


Making dependency list for source file VofmhdFoam.C
SOURCE=VofmhdFoam.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/lnInclude -I/opt/openfoam200/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam200/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linuxGccDPOpt/VofmhdFoam.o
readPISOControls.H: In function ‘int main(int, char**)’:
readPISOControls.H:3:15: warning: unused variable ‘nCorr’
readPISOControls.H:8:10: warning: unused variable ‘momentumPredictor’
readBPISOControls.H:3:12: warning: unused variable ‘nBcorr’
g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/lnInclude -I/opt/openfoam200/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam200/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude  -fPIC -Xlinker --add-needed Make/linuxGccDPOpt/VofmhdFoam.o -L/opt/openfoam200/platforms/linuxGccDPOpt/lib \
        -ltwoPhaseInterfaceProperties -lincompressibleTransportModels -lincompressibleTurbulenceModel -lincompressibleRASModels -lincompressibleLESModels -lfiniteVolume -lOpenFOAM -ldl  -lm -o /opt/openfoam200/platforms/linuxGccDPOpt/bin/VofmhdFoam
Make/linuxGccDPOpt/VofmhdFoam.o: In function `main':
VofmhdFoam.C:(.text+0x7736): undefined reference to `Foam::incompressible::turbulenceModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&)'
collect2: ld returned 1 exit status
make: *** [/opt/openfoam200/platforms/linuxGccDPOpt/bin/VofmhdFoam] Error 1

Has anyone had similar errors and some guidance? Or are there any notable changes in OpenFOAM syntax between 1.7.1 and 2.0.0 that I'm not aware of?

Thanks in advance!

marupio July 8, 2011 15:07

That's a linker error. Two things I usually look for are:

1 - Make sure your compiled libraries are up to date. Did you finish compiling all the OpenFOAM 2.0.0 libraries? Did you make a change to the library you are linking?

2 - Did you include the required library in your Make/options file? (Looks like finiteVolume.) If you include only the headers in the solver, but fail to include the -lfiniteVolume in the Make/options, you will get this error.

All times are GMT -4. The time now is 17:09.