CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Forces and Coefficients (http://www.cfd-online.com/Forums/openfoam-solving/96509-forces-coefficients.html)

jferrari January 24, 2012 19:45

Forces and Coefficients
 
I have appended the following code to my controlDict file:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so");
patches (cylinder);
rhoInf 1.0;
CofR (0 0 0);
outputControl timeStep;
outputInterval 1;
}
);

The rest of my controlDict file is untouched from the first tutorial case - I am using a different geometry and mesh (flow over a cylinder), but am still using the icoFoam solver.

I've seen other posts on this and tried to emulate what appears to be other user's success, but I'm still falling short. I'm not getting any errors but the force files are just not being created, so I'm stumped by this. Can anyone help me out? Thanks.

I'm using v2.0.1

onyir January 25, 2012 04:28

Hi jferrari.
I think you should add

pName p;
UName U;
rhoName rhoInf;
log true;

to your forces function.

jferrari January 25, 2012 11:52

Thanks onyir, I'll try that when I get home this evening.

jferrari January 25, 2012 20:06

Thanks again onyir, it worked. I now have a forces.dat file with a lot of data output to it.

jferrari January 27, 2012 09:43

I have a follow-up question, just to verify that I'm interpreting the forces file correctly.

This is now what I have in my controlDict file:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so");
patches (cylinder);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1.0;
CofR (0 0 0);
outputControl timeStep;
outputInterval 1;
}
);

The sum of the pressure and viscous forces in the x-direction is 0.08193. I'm assuming this is expressed in Newtons - is this correct?

I'm modeling a cylinder in crossflow with a diameter of 1 m, a freestream velocity of 1 m/s and a kinematic viscosity of 1 m^2/s. The thickness of the domain is 0.01 m. To get a force coefficient in the x-direction (I know there is a forceCoeffs function, but at this point I'm just looking to prove my understanding) I am taking the force (0.08193 N) by ((1/2)*(1 kg/m^3)*(1 m/s)^2*(0.01 m)*(1 m)). This results in a force coefficient on 16.386. This doesn't match with the literature to which I am comparing (for creeping flow, White's Viscous Fluid Flow predicts a force coefficient of 11), but I'll face that after knowing that I fully understand the OpenFOAM results - I just want to systematically troubleshoot.

Sorry for the long post, my concise questions are:
1) Does the forces function output in Newtons?
2) Is the fluid density used to calculate the force what I specify in the forces function,? Or is it somehow derived from the kinematic viscosity I specify in the transportProperties file? If it is, how?
3) Does the forces coefficient that I am calculating make sense from the information that I have provided?

Thank you in advance.

onyir January 27, 2012 12:38

Hi, I'll try to answer your questions:
1) 2) Yes, the forces are in Newtons. For a incompresible case, pressure is really pressure/density. So the forces library multiplies by the density you provide.
3) The forces coefficient that you are calculating seems right, so you will have to redo your simulations, maybe improving your mesh.

I hope this helps.

jferrari January 30, 2012 19:20

Thanks onyir for confirming that the coefficients that I calculated seem correct.

I tried re-doing my mesh, then doubled the number of cells to compare results. The results between the two meshes agree, they are within 0.01% of one another, but both are now double what I am expecting to see. I have heard of other CFD codes eliminating the 1/2 from the dynamic pressure, does OpenFOAM do this? Is there any other reason my results are (almost exactly) double what I am expecting to see?

Thanks again.

jferrari February 3, 2012 11:12

Following up.

I made a silly error - my mesh has a cylinder with a diameter of 2 m, not 1 m as I intended. All is well.

Comparing to a Reynolds number of 1 I was still getting larger values than what White predicts in Viscous Fluid Flow - but what I was actually comparing to was his curve fits. My results were in much closer agreement at Reynolds numbers of 10 and 100 - within 1%.

malhar June 13, 2012 06:23

hello every1,
i am also new to openfoam. i have done similar sim ulation for flow acrodss a cylinder. i get drag n lift forces correctly, i.e accor ding to vortex shedding i am getting variation in lift forces. but the coeff of drag n lift Cd n Cl, i am getting them constant throughout. i am unable ti digest this contrasting behavour.
please guide me thr this.

thanks n regards malhar.


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