CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Adding liftDrag to Openfoam141 (

srinath May 31, 2008 22:46

Hello I have been trying to

I have been trying to add the liftdrag utility from OpenFoam-1.2 as per the post,

The only change i have done is to use the latest dev version from nFOAM-1.4.1-dev/
and cp -r the directory
/src/postProcessing to version 1.4.1/src/
I succesfully make the library

My problem comes when i try to make the liftDrag binary
This is the error i get

srinath@dell:~/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing/miscellaneous/l iftDrag$ wclean && wmake
Making dependency list for source file liftDrag.C
SOURCE=liftDrag.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/postProcessing/incompressible/lnIncl ude -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/transportModels -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/turbulenceModels -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/LESmodels -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/LESmodels/LESdeltas/lnInclude -IlnInclude -I. -I/home/srinath/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/liftDrag.o
liftDrag.C: In function 'int main(int, char**)':
liftDrag.C:140: error: 'dragCoefficient' was not declared in this scope
liftDrag.C:150: error: 'liftCoefficient' was not declared in this scope
liftDrag.C:161: error: 'momentCoefficient' was not declared in this scope
make: *** [Make/linuxGccDPOpt/liftDrag.o] Error 1

Has anyone tried adding the liftDrag utility to 1.4.1?

Any help will be much appreciated

msrinath80 June 1, 2008 15:34

I think you are missing liftDr
I think you are missing liftDrag.H where those coefficients are defined. See if you can find a liftDrag.H file.

srinath June 1, 2008 21:48

Hi Srinath I found that it
Hi Srinath

I found that it is picking up liftDrag.H. The problem was that liftDrag in version 1.4 is in a different namespace, so i did the following

I added the line
using namespace Foam::liftDrag to the liftDrag.C, found in /applications/utilities/postProcessing/miscellaneous/liftDrag$

It compiles then, but fails in the linking stage because it can't find
A find command didn't locate such a library, so i assumed ver1.4 has done away with it and removed the line -lfoamUtils found in

Now everything compiles and links properly.

Unfortunately things don't seem to be as good as they seem.
When i go to FoamX and execute
foamUtilities->postProcessing->miscellaneous->liftDrag, i get the following error.(I am running it on icofoam/cavity)

Time = 0
Reading U

Reading p

Inlet velocity: (1 0 0)
#0 Foam::error::printStack(Foam: in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/"
#2 Uninterpreted: [0xffffe420]
#3 Foam::liftDrag::momentCoefficient(Foam::GeometricF ield<foam::vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double,> const&, Foam::dimensioned<double> const&, Foam::word const&, Foam::Vector<double> const&, double const&, double const&) in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libincompressiblePostPr"
#4 main in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/liftDrag"
#5 __libc_start_main in "/lib/tls/i686/cmov/"
#6 Foam::regIOobject::readIfModified() in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/liftDrag"

Am i executing the liftDrag command correctly? Does it need other options?


msrinath80 June 1, 2008 23:38

Hi there, If you search the
Hi there,

If you search the forum, you'll find that most of us who are interested in dimensionless force coefficients have picked out the required code from the liftDrag utility (Thanks to Frank Bos) and modified the solver (such as icoFoam) to calculate them and print them directly to the log file. I suggest that you do the same. Instructions for modifying the solver are available in some of the forum threads. Check this[1] thread for an example of the same using the turbFoam solver.

Of course, if this isn't a high priority at this point, you could always wait for OpenFOAM 1.5, which I believe will calculate lift and drag coefficients natively.

Hope this helps :-)


srinath June 2, 2008 09:39

Hi Srinath Thanks for point
Hi Srinath

Thanks for pointing me to the link where you modified turbFoam, i will try to do the same with icoFoam.

karamiag June 3, 2008 11:32

I added the liftDrag utility t
I added the liftDrag utility to 1.4.1, here there is what I have done:
1- From nFOAM-1.4.1-dev/
I downloaded the directory
2- I copied it in
3- From nFOAM-1.4.1-dev/
I downloaded the directory
4- I copied it in
5- I went in
6- I executed
7-I went in
8- I executed
wclean && wmake

I did not use liftDrag in FoamX but it seem to work if I use the command line.

Hope this helps

nomad August 24, 2009 19:04

liftDrag OpenFOAM 1.6
Does anybody know the whereabouts of the liftDrag tool for OpenFoam v1.6?
Do I need to use the one from v1.2?

nomad August 24, 2009 23:36

The liftDrag utility from v1.2 doesn't work with v1.6. I'm referring to the wclean && wmake in Step 7 of the trivial compile.

paulo August 25, 2009 10:43


Originally Posted by nomad (Post 227347)
Does anybody know the whereabouts of the liftDrag tool for OpenFoam v1.6?
Do I need to use the one from v1.2?

No, you don't need.

It is implemented inside the code. Look at:

Best Regards,

Paulo Rocha

nomad August 25, 2009 13:39

Thanks Paulo.

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