CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Drag computation in 141 (https://www.cfd-online.com/Forums/openfoam-solving/58378-drag-computation-141-a.html)

aunola July 11, 2008 10:25

Hello, I just comleted inst
 
Hello,

I just comleted installation of 1.4.1, my first encounter with OpenFOAM. Playing with the tutorials I noticed that none of the solvers include force calculations. That being my primary interest I searched the forum for hints on what to do about that. There seems to be no shortage of threads concerning lift and drag, hopefully another one will be tolerated.

I found these nice threads:

http://www.cfd-online.com/OpenFOAM_D...es/1/5181.html
http://www.cfd-online.com/OpenFOAM_D...es/1/2299.html
http://www.cfd-online.com/OpenFOAM_D...es/1/1604.html

which deal with importing a lift/drag feature from version 1.2 into 1.3 as well as some bug fixes to the imported code.

The first problem I run into is with the porting instructions in the "2299" thread (post by pUI|). It tells me to grab a Gcc file from the version 1.2 distribution. Since I'm running on 32-bit machines I believe this file should be

OpenFOAM-1.2.linuxGcc4Opt.gtgz

rather than the one mentioned in the instructions. I cannot find this file anywhere. Not on OpenFOAM's download site, not via google. What then ?

My next problem is that the threads mentioned above mention a file called computeForces.H/.C. I suspect this is a file that lives in obscurity somewhere. I cannot find it in version 1.4.1 nor 1.2. Hints ?

Ideally, I would like a setup where I can just make calls from the various (single phase) solvers to a genereal functions that does the force calculations and dumps results to a file.

msrinath80 July 11, 2008 13:36

The first problem I run into i
 
The first problem I run into is with the porting instructions in the "2299" thread (post by pUI|). It tells me to grab a Gcc file from the version 1.2 distribution. Since I'm running on 32-bit machines I believe this file should be

OpenFOAM-1.2.linuxGcc4Opt.gtgz

I thought I did mention in the original post that those instructions were specific to AMD64. However, if it's just source files you need to extract, then I doubt it will matter which architecture tarball you take it from. In fact, now that I think about it that tarball is unnecessary. All it provides is a liftDrag binary which you will build anyway.



My next problem is that the threads mentioned above mention a file called computeForces.H/.C. I suspect this is a file that lives in obscurity somewhere. I cannot find it in version 1.4.1 nor 1.2. Hints ?

computeForces.H was a quickly-put-together source that was written by Frank Bos. It can be found in the turbFoam_1 tarball attached in this[1] post.



Ideally, I would like a setup where I can just make calls from the various (single phase) solvers to a genereal functions that does the force calculations and dumps results to a file.

turbFoam_1 does something very similar. If you follow the same procedure/setup as turbFoam_1 I'm sure you'll get lift and drag forces working. If you still face problems, let me know. I am willing to get you started by making all the modifications you need. Just let me know which solver you intend to use (e.g. icoFoam, turbFoam etc.)


References:

[1] http://www.cfd-online.com/OpenFOAM_D...es/1/5181.html


PS: Indeed, it is very refreshing to find someone who actually bothers to search the forum properly before posting a new thread :-)

podallaire July 11, 2008 15:14

Good afternoon, liftDrag ut
 
Good afternoon,

liftDrag utility and lib can be downloaded from the 1.4.1-dev version, take a look at :

http://openfoam-extend.svn.sourceforge.net/viewvc/openfoam-extend/trunk/Core/Ope nFOAM-1.4.1-dev/applications/utilities/postProcessing/wall/liftDrag/

http://openfoam-extend.svn.sourceforge.net/viewvc/openfoam-extend/trunk/Core/Ope nFOAM-1.4.1-dev/src/postProcessing/incompressible/

The forceAndTorque function can be called from the controlDict (thanks to Hrv and Patrick for helping me this week) and will dump the results in the run logfile. foamLog can be used to generate standard x-y files.


It compiles on 1.4.1 without any problem.

Hope this helps,

PO

aunola July 12, 2008 09:44

Thanks a lot to both of you. T
 
Thanks a lot to both of you. These answers are very helpful indeed.

I ran into a problem in step 7 of the migration of liftDrag to 1.4.1 in that the library libfoamUtil.so was missing. Several other users reported the same problem in the "2299"-thread. Fixed it by rebuilding the entire 1.2 from sources and copying the foamUtil directory to 1.4.1.

I now have turbFoam_1 running and it dumps Cd and Cl to the screen. I need to familiarize myself with OpenFOAM to figure out how to get it dumped into a file. Also I want to have drag calculations in some of the other solvers suitable for my needs (icoFoam, simpleFoam, rhoTurbFoam, coodles and oodles). Presumably I can figure that out by looking into turbFoam_1.

Again, thanks a lot guys. Hopefully, I can get more help here as I go along.

waynezw0618 August 17, 2008 00:23

Hi Pierre-Olivier how can i
 
Hi Pierre-Olivier
how can i called forceAndTorque function from the controlDict??can i give me a example?

thanks

yours wayne

podallaire September 2, 2008 16:18

Sorry for the late answer -> I
 
Sorry for the late answer -> I was on vacation

Here is what I have :

functions
(
forces
{
type turbulentForceAndTorque;
functionObjectLibs ("libincompressiblePostProcessing.so");
patches (Bridge); //Name of patche to integrate forces
origin (1 0 0); //Origin for moment calculations
}
);


Pierre-Olivier

waynezw0618 September 3, 2008 09:48

Hi thanks a lot ! i will tr
 
Hi

thanks a lot ! i will try it later.would you mind to tell you how to moniter the total pressure different between inlet and outle with moniter of torque during the iteration like moniter torque?

thanks

yours wayne

piradeepan September 5, 2008 09:53

hi I am try to install OF 1.
 
hi
I am try to install OF 1.4.1
Please let me know about the error

/bin/sh: flex++: command not found
mv: cannot stat `lex.yy.cc': No such file or directory
g++: Make/linuxGccDPOpt/readSTLASCII.C: No such file or directory
g++: no input files
make: *** [Make/linuxGccDPOpt/readSTLASCII.o] Error 1

msrinath80 September 5, 2008 14:13

You need to install flex++. Pl
 
You need to install flex++. Please use the search facility before posting any new questions. This problem has been discussed so many times in the past.

waynezw0618 September 24, 2008 05:36

Hi Pierre-Olivier i am sorr
 
Hi Pierre-Olivier

i am sorry for the cluster i use have something wrong this dats so i did not try.
i try it today and with the error that :
key word file is undefined

what is wrong with it ?
thanks

yours wayne

aunola September 28, 2008 09:40

What version of OF are you usi
 
What version of OF are you using? The library and keywords you use are unkown in 1.5.

In version 1-5 add the following to your controlDict to get forces

functions
(
forces
{
type forces;
functionObjectLibs("libforces.so");
patches (list of your wall patche id's);
rhoInf <rho_freestream>; - only for incompressible calcs.
CofR (x y z); - centre of rotation for moment calc.
}
);

Alternatively you may use the forceCoeffs function object which calculates Cd, Cl and Cm directly.

You may also want to read the thread:

http://www.cfd-online.com/OpenFOAM_D...es/1/8402.html

waynezw0618 October 4, 2008 10:23

Hi Martin and Pierre-Olivier
 
Hi Martin and Pierre-Olivier
I am using OF-1.4.1. and i have download both two application and complie correctly. my controlDict is as :
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application MRFsimpleFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 2000;

deltaT 1;

writeControl timeStep;

writeInterval 2000;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

graphFormat raw;

runTimeModifiable yes;

functions
(
forces
{
type turbulentForceAndTorque;
functionObjectLibs ("libincompressiblePostProcessing.so");
patches (BLADE); //Name of patche to integrate forces
origin (0 0 0); //Origin for moment calculations
}
);


// ************************************************** *********************** //
and error message as follow:


Starting time loop



--> FOAM FATAL IO ERROR : keyword file is undefined in dictionary "ASME//GS4SSTRC025Q/system/controlDict::functions"

file: ASME//GS4SSTRC025Q/system/controlDict::functions from line 63 to line 66.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 146.


would you mind tell me what`s wrong with it?

thanks

your wayne

podallaire October 4, 2008 10:37

Wayne, can you post your co
 
Wayne,

can you post your controlDict file here ? I believe a "(" or "{" is missing somewhere ...

Regards,

Pierre-Olivier

podallaire October 4, 2008 10:46

sorry, I did not see that in f
 
sorry, I did not see that in fact you already copied everything from your controlDict in your post ...

Are you sure that the libincompressiblePostProcessing can be inked ? You can try to copy it directly in $FOAM_LIBBIN.

As Martin said, it would be a good idea to try OF 1.5.x where the lift/drag/moment are availabe in the official distribution.

Regards,

PO

waynezw0618 October 4, 2008 12:49

Hi here is my controlDict.
 
Hi
here is my controlDict.
http://www.cfd-online.com/OpenFOAM_D...s/mime_txt.gif controlDict

and libincompressiblePostProcessing.so is in $FOAM_LIBBIN.

would you mind to help me to resolve the problem in OF-1.4.1

yours wayne

waynezw0618 October 4, 2008 13:47

by the way. i do not use 1.5
 
by the way.
i do not use 1.5 for the cluster in ourschool is installed Redhat AS4 .i have never suceed in installing 1.5 there.

thanks

yours wayne

waynezw0618 November 5, 2008 03:08

Hi Pierre-Olivier thanks fo
 
Hi Pierre-Olivier

thanks for your help. and the problem has been resolved.the keyword file must be added
functions
(
forces
{
type turbulentForceAndTorque;
functionObjectLibs ("libincompressiblePostProcessing.so");
patches (BLADE); //Name of patche to integrate forces
origin (0 0 0); //Origin for moment calculations
file ;//(i dont know what is the option) could you tell me more?
}
);

waynezw0618 November 5, 2008 10:27

Hi Pierre-Olivier : anyway,
 
Hi Pierre-Olivier :

anyway,according to your another topic(http://www.cfd-online.com/cgi-bin/Op...how.cgi?1/8402).you have a "force.dat" file ?dose this file generated when the option file is given? and how to give the file opition?

thanks

yours wayne?

podallaire November 5, 2008 11:34

Hi Wayne, I did not use the
 
Hi Wayne,

I did not use the "file" option in my controlDict, my functions section was like this :

functions
(
forces
{
type turbulentForceAndTorque;
functionObjectLibs ("libincompressiblePostProcessing.so");
patches (Bridge); //Name of patche to integrate forces
origin (1 0 0); //Origin for moment calculations
}
);

Force.dat is automatically generated when the function "forces" is added in the controlDict. Not sure what is wrong with your setup ?

Regarding Redhat AS4 and OF1-5, you might need to upgrage the gcc compiler to 4.x if you want to compile it

PO

waynezw0618 November 6, 2008 08:20

HI PO I am still using 1.4.1
 
HI PO
I am still using 1.4.1 on Redhat AS4 now. for i can`t install the 1.5 correctly on the school`s cluster.so i still use the liftdrag and forceandtorque tool of 1.4.1-dev.and i download if from link you give above.and make no modificaiton.also could build and compile correctly.

if i do not add keyword file in the controlDict
there will be error message :

<font color="ff0000">--> FOAM FATAL IO ERROR : keyword file is undefined in dictionary "ASME//GS4SSTRC025Q/system/controlDict::functions"

also i turn to the turbulentForceAndTorqueFunctionObject.C and find the constructors

red{
Foam::turbulentForceAndTorqueFunctionObject::
turbulentForceAndTorqueFunctionObject
(
const Time& t,
const dictionary& dict
)
:
functionObject(),
time_(t),
regionName_(polyMesh::defaultRegion),
patchNames_(dict.lookup("patches")),
origin_(dict.lookup("origin")),
of_(time_.path()/word(dict.lookup("file")))
</font>

and it need "file".

so i don`t know what is wrong with it?

thanks

yours wayne


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