CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Obtaining Forces and Force Coefficients (https://www.cfd-online.com/Forums/openfoam/105139-obtaining-forces-force-coefficients.html)

ShuToshio July 23, 2012 23:08

Obtaining Forces and Force Coefficients
 
Hi,

I have been trying to run icoFoam for a bluff body flow, and I have just included the forces and forceCoeffs functions, but I wasn't able to get any results when I ran icoFoam. There were no new directories created.

I read in some previous threads that it worked in OF 1.5 or 1.6. I am using 2.1.x, has there been any changes? My controlDict functions goes like this

functions{
forces{

type forces;
functionObjectLibs ("libforces.so");
patches (
carfront
);
rhoInf 1.204;
CofR (0 0 0);
}

forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
patches (
carfront
);
rhoInf 1.204;
CofR (0 0 0);
liftDir (0 0 1);
dragDir (1 0 0);
pitchAxis (0 0 0);
magUInf 1.0;
lRef 5;
Aref 6;
}
};

Also, is it true that I can only include one patch?

niaz July 24, 2012 04:20

I think you should add something like this to your function lines
outputControl timeStep;
outputInterval 10;

ShuToshio July 24, 2012 21:35

I tried, doesnt work :(

niaz July 25, 2012 00:05

I used it for my project in OF2.1.1. it works, try it.

libs
(
"libOpenFOAM.so"
"libforces.so"
);

functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so");
outputControl timeStep;
outputInterval 10;
patches (wall);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1;
CofR (5 6 0.5);
}

forces1
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 10;
patches
(
wall
);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1;
CofR ( 5 6 0.5 );
liftDir ( 0 1 0 );
dragDir ( 1 0 0 );
pitchAxis ( 0 0 1 );
magUInf 1;
lRef 1;
Aref 1;
}

}


All times are GMT -4. The time now is 23:20.