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 
Hi jferrari.
I think you should add pName p; UName U; rhoName rhoInf; log true; to your forces function. 
Thanks onyir, I'll try that when I get home this evening.

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

I have a followup 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 xdirection 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 xdirection (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. 
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. 
Thanks onyir for confirming that the coefficients that I calculated seem correct.
I tried redoing 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. 
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%. 
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 15:24. 