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/)
-   -   Forces in OF15 (https://www.cfd-online.com/Forums/openfoam-solving/57829-forces-of15.html)

mgz1985 August 8, 2008 07:01

thanks Ivan, I figured out
 
thanks Ivan,

I figured out the problem. there was a syntax error.

can u tell me how to plot the graphs from .dat

thanx again.

mgz1985 August 11, 2008 07:57

hi Ivan i am able to get t
 
hi Ivan

i am able to get the coefficients but they are very weird values

when I use Aref=1, I get Cd=7e-05 and Cl=1.38e-04

so i tried it by reducing Aref to 0.00001 (i know it is wrong) i get the order correct for Cd but Cl is still one order low.

can anyone tell me where could be the possible error?

thanx

mgz1985 August 25, 2008 01:41

hi srinath, sorry to be pos
 
hi srinath,

sorry to be posting my query here. I wanted to know if some-one has verified the liftDrag codes with the wind-tunnel datas for an airfoil. I have tried every thing I knew with OpenFOAM-1.5 forces function but I get wrong results for Cl although Cd is perfect. (icoFoam because it is incompressible flow)

the error is in reference length I guess because even if i change the reference length, it does not affect my results.

can u suggest me something new to try?

dnomdec September 2, 2008 16:05

Hi all, I am quite new to O
 
Hi all,

I am quite new to OpenFOAM. Trying to work on the source code for a little bit. Could someone help me by pointing me to the actual piece of code OpenFOAM uses to read in dictionaries? In particular, how does it get the variable "name_" in the forces class? I tried looking into various files, but quickly got buried by the typedefs, macro functions and so on...

Sorry for hijacking this thread...if people think it's irrelevant, i'll start a new thread.

Thx,
Ned

zhoubinwx October 23, 2008 13:34

Dear all, When I compile fo
 
Dear all,

When I compile forces directory in OF 1.5 using wmake, I get:
forces.Chttp://www.cfd-online.com/OpenFOAM_D...lipart/sad.gif.text._ZN4Foam14GeometricFieldINS_10SymmTensorIdEE NS_12fvPatchFieldENS_7volMeshE EC1ERKNS_4wordERKS5_[Foam::GeometricField<foam::symmtensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::word const&, Foam::GeometricField<foam::symmtensor<double>, Foam::fvPatchField, Foam::volMesh> const&)]+0x7d): undefined reference to `Foam::GeometricField<foam::symmtensor<double>, Foam::fvPatchField, Foam::volMesh>::debug'
collect2: ld returned 1 exit status
make: *** [OpenFOAM.out] Error 1

I am trying to calculate the drag coefficient around one classic cylinder.

Just for your information.

Bin

cwang5 October 24, 2008 05:07

Hi Bin, I don't think you'l
 
Hi Bin,

I don't think you'll need to compile the forces directory, it should be already be compiled when you installed OpenFOAM-1.5

What you need to do is the following:

1. Make sure that the whole cylinder wall is a single patch, from what I know, the forces function only works on one surface.

2. Copy the following lines to the end of your controlDict file

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (fixedWall); // change to your patch name
rhoInf 1.225; //Reference density for fluid
CofR (0.15 0 0); //Origin for moment calculations
}
forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
patches (fiexdWall); //change to your patch name
rhoInf 1.225;
CofR (0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 0);
magUInf 55.5;
lRef 0.6;
Aref 1;
}
);

3. Check to make sure that the patch name for "patches (****)" matches with the name for your cylinder surface. Check the magUInf, lRef, Aref, etc to match your case.

4. Run the application normally. Two new folders will appear in your case directory, one for forces and one for the coefficients. You should be able to find the drag coefficient from there.

Hope this helps,

John

zhoubinwx October 24, 2008 08:41

Hi John, I am so glad to he
 
Hi John,

I am so glad to hear from you, actually I have successfully implemented it this morning. Thank you anyway.

Now I have the "forces" and "forceCoeffs" directories.

I have tried to plot them, but failed, here if you do not mind, would you please tell me a way to plot them using gnuplot?

Really appreciate your help.

Bin

zhoubinwx October 24, 2008 10:04

Hi John, By the way, I am u
 
Hi John,

By the way, I am using the typical "Flow around a cylinder" case in ProgrammersGuide.pdf, chaper 3.1. Would you please let me know how to define these parameters.

I find when I use icoFoam, the courant number goes up to maximum, so I try simpleFoam, but with turbulence closed. only laminar.

According to me, I know that:

The drag and lift coefficients are:

Cd=Fd/(rho*U*U/2*Ad); Cl=Fl/(rho*U*U/2*Al);

Fd and Fl are calculated by integrating the pressure and shear force over the cylinder surface. I do not know how OpenFOAM 1.5 calculates them, especially the forces. It uses Richardson extrapolation? Second order?

Then with this question, I go to
~/OpenFOAM/zhou-1.5/zhou/IsolatedFiberCharacteristic0_04_simpleFoam/forceCoeffs/

We could see that:
forcesMoments fm = forces::calcForcesMoment();
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;

vector totForce = fm.first().first() + fm.first().second();
vector totMoment = fm.second().first() + fm.second().second();

scalar liftForce = totForce & liftDir_;
scalar dragForce = totForce & dragDir_;
scalar pitchMoment = totMoment & pitchAxis_;

scalar Cl = liftForce/(Aref_*pDyn);
//Aref: wettedArea
scalar Cd = dragForce/(Aref_*pDyn);
scalar Cm = pitchMoment/(Aref_*lRef_*pDyn);
--------------------
Here calcForcesMoment() Calculates the forces and moments by integrating the pressure and skin-friction forces over a given list of patches. However I do not ubderstand "first", "second" very well? Even though I opened the file "objectRegistryTemplates.C"

I could not fully understand CofR, liftDir,dragDir ,pitchAxis, magUInf,lRef,Aref in this cylinder case?

Definition of terms:
rhoInf - reference density ---it is ok

The following I do not know how I specify:

CofR - Centre of rotation/ Origin for moment calculations, is it means the center of the cylinder? here (0 0 0)? If we have many cylinders, we use their center respectively?
dragDir - Direction of drag coefficient
liftDir - Direction of lift coefficient
pitchAxis - Pitching moment axis
magUinf - free stream velocity magnitude, if we have many cylinders, we use the same value: the most upstream uniform velocity?
lRef - reference length
Aref - reference area

Thank you for your attention.

Best regards,

Bin

cwang5 October 24, 2008 14:50

Hi Bin, The "forces" functi
 
Hi Bin,

The "forces" function calculated the pressure and viscous forces acting on the defined patch, and the "forceCoeff" is calculated from that. In the "forceCoeffs" function, the CofR is defined at (0 0 0) since I was not interested in finding out the moment around the body, but if you are you should define the center of rotation about the axis of interest, which I do not know for your case, but it should be the origin for a cylinder (I do not have the programming guide.pdf). The liftDir and dragDir define the vector that point in the direction of the lift and drag, which, for most cases, are (1 0 0) and (0 1 0) respectively, but it is completely up to how you setup your case. The pitchAxis is the axis for calculating pitching moment (I believe this thread was merged with an earlier one on the same topic, and there was an explanation for all the entries) if you are not interested in the value, just leave it as (0 0 0). Now, for magUinf, you should just use the upstream uniform velocity, since that should be the same as U_infinity, which is the freestream undisturbed velocity. "lower case L"Ref is the reference length, which is the chord length for an airfoil and the diameter for a cylinder, and Aref is the chord*span for an airfoil, and diameter*length for your cylinder I think.Hope that helps.

John

erik023 October 25, 2008 14:32

Hi, great to read your inputs
 
Hi,
great to read your inputs. I would like to use the forces in interdymfoam to get my boat i'm working on to move. i find that i have to def. a reference value for rho, does this mean that it does not work for the interdym/interfoam solvers?

thank you
erik

erik023 October 25, 2008 15:17

again, using my brain a bit mo
 
again, using my brain a bit more. came to think if i would incorporate the forces already in the solver maybe it would not be terrible hard to first find out if the part of the patch is in water of air (possible?) and then set the gamma for this? then i could use the very nice forces based mesh-moving that i found here: http://www.cfd-online.com/cgi-bin/Op...how.cgi?1/3814

any suggestions?

erik

cwang5 October 25, 2008 16:06

Hey Eric, I have zero exper
 
Hey Eric,

I have zero experience with two-phase simulations, but you might find some useful information by looking in the programmer's guide and see how the rhoRef value is used in the calculation. I do have some input for your choice of solver, though. From what I can tell, the link you have for rigid body motion can only run on OF-1.4.1 dev version, while the forces function was not implemented until OF-1.5
. I think in OF-1.4.1 there's an utility called liftDrag. Again, I have only started using OF this August, and only have limited experience with OF-1.5.

By the way, how do you specify if a boundary (like a wall) is free moving?

John

erik023 October 25, 2008 18:01

Hi John, I'm digging in to
 
Hi John,

I'm digging in to it and hope to get out a bit wiser, will get back as soon as i find something! I started using openFOAM for the first time now in September, have no experience of the older versions but there seem to be some major differences. Most of them brilliant, like snappyhexmesh!

i'm using the patch movingWallVelocity, should work if i understand it right.

thank you for your comments!

Erik

cwang5 October 27, 2008 06:28

Hey Eric, I was going thr
 
Hey Eric,

I was going through the tutorials and came across the 2D slushing tank in interDyMFoam, I saw a "wall pressure" function in there and thought it might be useful for you. Hope it helps.

John

zhoubinwx October 28, 2008 08:58

Hi Wang, I am glad to get y
 
Hi Wang,

I am glad to get your comment, I saw this post today, thank you very much.

Let me post any progress when I have for this cylinder ourflow.

Best regards,

Bin

lin November 1, 2008 14:37

Hi,thanks for the discussion.
 
Hi,thanks for the discussion.

Now I have one question about the drag and dragcoefficient.

As there is only one U reference could be defined for calculating the drag coefficient. I think that ,if I have a 3 D flow structures,when the velocity has a vertical structure,then this drag coefficient calculation is not correct,because the reference velocity at different layers is different.But the force should be right,then I could later use the force to calculate the drag coefficient, is it right?

erik023 November 3, 2008 08:03

good day all, i have been try
 
good day all,
i have been trying to combine some pieces of code in order to get my ship to heave and pitch given a flow. John Wang pointed to some interesting things and i have put something together, mainly from parts of the /postprocessing/forces and forceCoeffs and the turboForceFoam given here:
http://www.cfd-online.com/cgi-bin/Op...cus/discus.cgi

i could send the files to anyone who would like to have a look at them. it is not beautiful and i'm not even sure how well it is working, but my boat is moving so something is happening. i would be glad to get some help here!

also. for now there is only heaving, i would like to figure out some pithing as well. would i need the quaterion for that?!

thanks
Erik

erik dot ekedahl at gmail dot com

wolle1982 November 19, 2008 06:25

Hallo everyone, one questio
 
Hallo everyone,

one question to the forces calculation:

Can it be performed as a real "post"processing action?

Means, I want to calculate my stuff and afterwards want to get to forces (lift and drag) of a certain patch.
When I type in "forces" or "forceCoeffs" then the "command is unknown". Do I have to compile somehow? I "Allwmake" the forces folder but no executable files were created. Can someone explain?

Thx

dmoroian November 19, 2008 07:44

Hello Wolfgang, Try to read t
 
Hello Wolfgang,
Try to read this thread a bit more thoroughly, one example is: force object

I hope this is helpful,
Dragos

wolle1982 November 21, 2008 10:53

??? Hallo Dragos, no it did
 
??? Hallo Dragos,

no it did not. I have a simulation calculated finish. without the forces function being in the controldict in the first place i cannot get the forces afterwards right??

what an unlike postprocessing too is this!


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