CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Running, Solving & CFD


Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By norman1981

LinkBack Thread Tools Display Modes
Old   June 30, 2011, 12:58
Default forceCoeffs.C
New Member
Join Date: Apr 2011
Location: Magdeburg, Germany
Posts: 23
Rep Power: 8
Nico A. is on a distinguished road
Hello everyone,

I computed the flow around a sphere and also calculated the lift and drag forces/ coefficients. At present I got to high values for Cd (0.61) at Re = 1*10⁴, due to the k-epsilon turbulence model I guess.
But anyway I checked the code for the calculation in the 'forceCoeffs.C' file. Most of it is clear to me, but I did not underśtand a few lines:
void Foam::forceCoeffs::write()
00110 {
00111     if (active_)
00112     {
00113         // Create the forces file if not already created
00114         makeFile();
00116         forcesMoments fm = forces::calcForcesMoment();
00118         scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
00120         vector totForce = fm.first().first() + fm.first().second();
00121         vector totMoment = fm.second().first() + fm.second().second();
00123         scalar liftForce = totForce & liftDir_;
00124         scalar dragForce = totForce & dragDir_;
00125         scalar pitchMoment = totMoment & pitchAxis_;
00127         scalar Cl = liftForce/(Aref_*pDyn);
00128         scalar Cd = dragForce/(Aref_*pDyn);
00129         scalar Cm = pitchMoment/(Aref_*lRef_*pDyn);
I am not used to the C-language that much, but I want to know what is mathematically done in the red marked lines. Thanks for your advices!

Best regards Nico
Nico A. is offline   Reply With Quote

Old   July 1, 2011, 02:44
norman1981's Avatar
Norman Del Puppo
Join Date: Mar 2009
Location: Hinwil, CH
Posts: 57
Rep Power: 10
norman1981 is on a distinguished road
Hi Nico,

fm contains the computed forces and moments data (see forces.C). fm.first() contains forces data, fm.second() contains moments data. Forces and moments are stored in pressure and viscous contributions, so that:
fm.first().first() --> normal force
fm.first().second() --> tangential force
fm.second().first() --> moment due to the normal force
fm.second().second() --> moment due to the tangential force

The scope of the two lines you reported is to sum these contributions in order to get the total force and total moment.


bhushanvelis likes this.
norman1981 is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

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