CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Drag and lift force using OpenFoam14

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 15, 2007, 10:54
Default Hello! I would kindly like
  #1
New Member
 
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17
hardy is on a distinguished road
Hello!

I would kindly like to ask if someone could describe to me what is the easiest way to write drag- and lift- force for each time step using turbFoam.

I have seen other threads on this subject with several references to the function dragCoefficient. Is this function accessible in OpenFoam 1.4 or is there some other way to do it??

Regards!
/H
hardy is offline   Reply With Quote

Old   August 15, 2007, 11:04
Default Hello Hardy, I am still at
  #2
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello Hardy,

I am still at work, but since you sound quite hurried.... question is, do you want to calculate the lift and drag during the simulation, or do you want to do it as a post-processing step once the simulation is done??

Anyway.... have a look at the folder:

"OpenFOAM/OpenFOAM-1.4/src/postProcessing/incompressible/liftDrag"

The code in there should give you more than a simple "Head-start" :-)!

Enjoy!

Philippose
philippose is offline   Reply With Quote

Old   August 16, 2007, 02:41
Default Hello again and thank you!
  #3
New Member
 
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17
hardy is on a distinguished road
Hello again and thank you!

Yes, I would like to calculate the forces during the simulation.

Hmmm, in my file structure there is no "postProcessing" folder within the "src" folder as you suggests. Is there something wrong with my system? Can´t find such folder anywhere else either.

/H
hardy is offline   Reply With Quote

Old   August 16, 2007, 03:35
Default Hardy, To install liftDrag
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
Hardy,

To install liftDrag tool in OpenFOAM 1.4, please follow instructions included here, those describe how to import liftDrag from version 1.2:
http://www.cfd-online.com/OpenFOAM_D...es/1/2299.html

Below address also includes updated (I guess) and tided up version of liftDrag tool:
http://www.cfd-online.com/OpenFOAM_D...es/1/1604.html

I also know there were some issues with that tool validity, but I'm not sure.

For more questions about liftDrag try to follow Search Utility on the left side and type 'liftDrag'.

Regards and good luck,
Krystian
paka is offline   Reply With Quote

Old   August 21, 2007, 06:24
Default Thank you once again! I hav
  #5
New Member
 
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17
hardy is on a distinguished road
Thank you once again!

I have now imported liftDrag from version 1.2 and it compiled well!

I have looked through the liftDrag code and all other threads about liftDrag but I am still confused about how to use it?

As being a beginner in OpenFOAM and C++ I wonder if someone could point out a way for me how to use liftDrag, or parts of it, in order to get drag data from each time step of my simulation.

Don´t hesitate to treat me as stupid if that would make thing easier.... :-)

/Hardy
hardy is offline   Reply With Quote

Old   August 22, 2007, 19:14
Default Hardy. Tell me which solver yo
  #6
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Hardy. Tell me which solver you are using and I will post the instructions.
msrinath80 is offline   Reply With Quote

Old   August 22, 2007, 19:15
Default oops, I already see you want t
  #7
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
oops, I already see you want to use turbFoam. I will post the instructions shortly.
msrinath80 is offline   Reply With Quote

Old   August 22, 2007, 19:57
Default Here you go. Place this file i
  #8
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Here you go. Place this file in ~/OpenFOAM/OpenFOAM-1.4/applications/solvers/incompressible
and run the following command:
tar -xzvf turbFoam_1.tar.gz

Next enter the newly created turbFoam_1 directory and execute the following commands:

wclean && wmake

That's all. Your modified turbFoam_1 solver which calculates Lift/Drag forces in every time-step is ready for use.

There is one catch however. The code assumes a reference area of unity and also a reference velocity of unity. I personally find it easier to set the reference velocity and reference area to unity so that I can later find the exact drag and lift coefficients depending on the case by multiplying/dividing by the appropriate numbers.

If you don't follow something, drop a message here and I will get back to you. Good Luck!

Attachments:
turbFoam_1.tar.gz
msrinath80 is offline   Reply With Quote

Old   August 23, 2007, 04:12
Default Thank you very much! turbFo
  #9
New Member
 
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17
hardy is on a distinguished road
Thank you very much!

turbFoam_1 is up and running! Now I just have to understand how it works so that I can make such modifications my self in the future :-)

/H
hardy is offline   Reply With Quote

Old   August 23, 2007, 13:21
Default Good to know that it compiled
  #10
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Good to know that it compiled without issues. The Drag/Lift computation was primarily done by Frank Bos. Search for his posts in this forum concerning Lift and Drag, you will find many useful threads.

PS: If you need to extract the Lift/Drag coefficients from the log file conveniently, using the foamLog command, you need to add the following 4 lines in your foamLog.db file (which is present in ~/OpenFOAM/OpenFOAM-1.4/bin)

#- Drag coefficient:
dragCoefficient/DragCoefficient = /DragCoefficient =

#- Pressure Drag coefficient:
pressureDragCoefficient/pressureDragCoefficient = /pressureDragCoefficient =

#- Viscous Drag coefficient:
viscDragCoefficient/viscDragCoefficient = /viscDragCoefficient =

#- Lift coefficient:
liftCoefficient/LiftCoefficient = /LiftCoefficient =
msrinath80 is offline   Reply With Quote

Old   April 3, 2008, 02:05
Default Hi all, I'm referring to Srina
  #11
New Member
 
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17
gemaforce is on a distinguished road
Hi all, I'm referring to Srinath's post earlier on.
-------------------------------------------------
Here you go. Place this file in ~/OpenFOAM/OpenFOAM-1.4/applications/solvers/incompressible
and run the following command:
tar -xzvf turbFoam_1.tar.gz

Next enter the newly created turbFoam_1 directory and execute the following commands:

wclean && wmake
------------------------------------------------

I've got a problem after this step. When I looked into FoamX again, I don't see a turbFoam_1 module. Or is it under turbFoam?

Thanks
Samuel
gemaforce is offline   Reply With Quote

Old   April 3, 2008, 12:34
Default turbFoam_1 is simply a version
  #12
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
turbFoam_1 is simply a version of turbFoam that also prints the dimensionless force coefficients in the log file for every time step (or iteration). As it is a customized version, I think that you will basically need to edit some FoamX cfg file(s) and copy the turbFoam section and create a new turbFoam_1 section. Having come this far, I would expect that folks would have weaned themselves off FoamX as it is merely a graphical frontend to editing the dictionary files ;)
msrinath80 is offline   Reply With Quote

Old   April 7, 2008, 21:24
Default Ok! I think I some sort know w
  #13
New Member
 
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17
gemaforce is on a distinguished road
Ok! I think I some sort know what you mean! I just have a query as I'm really new to FoamX and the whole thing about C++, how do I edit the FoamX cfg files so that the coefficients can appear in the log file? After wmake, I ran the program with turbFoam again and the log file does not print the force coefficients =(
gemaforce is offline   Reply With Quote

Old   April 8, 2008, 14:49
Default After wmake, I ran the program
  #14
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
After wmake, I ran the program with turbFoam again and the log file does not print the force coefficients =(

You need to run turbfoam_1 NOT turbfoam.
msrinath80 is offline   Reply With Quote

Old   April 8, 2008, 21:07
Default I'll go and try running turbFo
  #15
New Member
 
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17
gemaforce is on a distinguished road
I'll go and try running turbFoam_1 now and and see if it works this time! Thanks
gemaforce is offline   Reply With Quote

Old   April 11, 2008, 03:22
Default Hi Srinath! I tried it and
  #16
New Member
 
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17
gemaforce is on a distinguished road
Hi Srinath!

I tried it and it works nicely! There is just one last problem that cropped up. I would like to find out the momentCoefficient value, so I uncommented the Lref and momentCoefficient statements. However, when I tried to compile again, it returns an error message saying that momentCoefficient is not declared in the scope. I did remember seeing it as a scalar somewhere in your script, but I'm not sure why it still says it isn't declared.
gemaforce is offline   Reply With Quote

Old   April 11, 2008, 20:32
Default You need to add the relevant s
  #17
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
You need to add the relevant section for momentCoefficient in liftDrag.H. I'm pasting the code from OpenFOAM 1.2 (where I got the original liftDrag code). Including it in liftDrag.H should do the trick.

Foam::vector Foam::momentCoefficient
(
const volVectorField& U,
const volScalarField& p,
const dimensionedScalar& mu,
const word& patchName,
const vector& Uinf,
const scalar& Aref,
const scalar& Lref
)
{
if (mag(Uinf) < VSMALL)
{
FatalErrorIn
(
"vector momentCoefficient\n"
"(\n"
" const volVectorField& U,\n"
" const volScalarField& p,\n"
" const dimensionedScalar& mu,\n"
" const word& patchName,\n"
" const vector& Uinf,\n"
" const scalar& Aref,\n"
" const scalar& Lref\n"
")\n"
) << "Uinf is zero."
<< exit(FatalError);
}

const fvMesh& mesh = p.mesh();

label patchLabel = -1;

forAll (mesh.boundary(), patchi)
{
if (mesh.boundary()[patchi].name() == patchName)
{
patchLabel = patchi;
break;
}
}

vector pressureForceMoment;
vector viscousForceMoment;

if (patchLabel != -1)
{
pressureForceMoment = sum
(
mesh.Cf().boundaryField()[patchLabel]^
(p.boundaryField()[patchLabel]
*mesh.Sf().boundaryField()[patchLabel])
);

viscousForceMoment = sum
(
mesh.Cf().boundaryField()[patchLabel]^
(-mu.value()*U.boundaryField()[patchLabel].snGrad()
*mesh.magSf().boundaryField()[patchLabel])
);
}
else
{
pressureForceMoment = sum(vectorField(0));
viscousForceMoment = sum(vectorField(0));
}

scalar qRef = 0.5*magSqr(Uinf);
scalar Fref = qRef*Aref;
scalar Mref = Fref*Lref;

vector pressureCoeff = pressureForceMoment/Mref;
vector viscousCoeff = viscousForceMoment/Mref;

return (pressureCoeff + viscousCoeff);
}


// ************************************************** *********************** //


You may also want to add the following in the beginning:

vector momentCoefficient
(
const volVectorField& U,
const volScalarField& p,
const dimensionedScalar& mu,
const word& patchName,
const vector& Uinf,
const scalar& Aref
);

Please be aware that you need to test the moment results you obtain with a reference like I did for lift/drag. Frank has Momentcoefficient working as you can see here [1]. Please check with him if you have further problems :-)

[1] http://www.cfd-online.com/OpenFOAM_D...es/1/1807.html
msrinath80 is offline   Reply With Quote

Old   April 13, 2008, 20:44
Default Thank you so much Srinath! I w
  #18
New Member
 
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17
gemaforce is on a distinguished road
Thank you so much Srinath! I will put in this section and try running again!
gemaforce is offline   Reply With Quote

Old   June 19, 2008, 11:31
Default Hello I have some questions
  #19
Member
 
mohd mojab
Join Date: Mar 2009
Posts: 31
Rep Power: 17
mou_mi is on a distinguished road
Hello

I have some questions about adjusting computeForces.H file.

1) Who I can find Aref?
for example in this model,

is the Aref hatched area, and I need also to multiply to depth Aref = [(10*5)-(1*1)]* 2


2) How can I set Umax?

Thank you
mou
mou_mi is offline   Reply With Quote

Old   August 4, 2008, 02:50
Default Hi, all, Will this turbF
  #20
Member
 
Ivan Lau
Join Date: Mar 2009
Location: Hong Kong
Posts: 56
Rep Power: 17
ivanwhlau is on a distinguished road
Hi, all,
Will this turbFoam_1 work for version 1.5?
Thanks,
Ivan
ivanwhlau is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing lift fore/drag force in UDF changkiang FLUENT 6 May 11, 2015 15:00
how to set lift and drag coefficients in force mon alagesanj FLUENT 0 November 16, 2008 20:47
Drag & lift force Max CFX 1 September 4, 2008 11:41
finding drag and lift force Deloat CFX 3 February 27, 2008 16:53
Lift and Drag force Dmitriy CFX 4 September 18, 2005 01:00


All times are GMT -4. The time now is 21:16.