CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Implementation of the drag coefficient Formula (https://www.cfd-online.com/Forums/openfoam-post-processing/121168-implementation-drag-coefficient-formula.html)

Mirage12 July 23, 2013 06:00

Implementation of the drag coefficient Formula
 
Hello Foamers :)

I am trying to simulate a flow around a half-cylinder.In order to evaluate my result and i need calculate some coefficients non-dimensional numbers , like Nussel-number and the drag coefficient:

For the calculation of the drag coefficient of the geometry i should use this Formula :

https://rb-owa-portal.emea.bosch.com...8eT5B5WMwMl5LQ
with


https://rb-owa-portal.emea.bosch.com...SIug4AXS5V%2f2

I am using ParaView and Ensight as a Post-Processing Tool.

Can anybody explain to me, how and where should implement this Formula, in order to calculate the drag coefficient for every time step ?

Thx for the support :)

PS: I am using OpenFOAM 2.2.0

Mirage12 July 23, 2013 07:57

solved :)
 
So...:)

Just write this Code in your controlDict-File :)

Code:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load -> dylib on Mac and so on Linux
rhoInf 1.0; //Reference density for fluid - can be changed later ...
patches (fixedWalls); //Name of patche to integrate forces
CofR (0 0 0); //Origin for moment calculations
outputControl timeStep;
outputInterval 1;
}
forceCoeffs
{
// rhoInf - reference density
// CofR - Centre of rotation
// dragDir - Direction of drag coefficient
// liftDir - Direction of lift coefficient
// pitchAxis - Pitching moment axis
// magUinf - free stream velocity magnitude
// lRef - reference length
// Aref - reference area
type forceCoeffs;
functionObjectLibs ("libforces.so");
patches (fixedWalls);
rhoName rhoInf;
rhoInf 1000;
CofR (2 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1e-7;
lRef 0.06; // sphere diameter
Aref 0.0014137; //1/2 * projected area = pi*rē/2

        outputControl  timeStep;
        outputInterval  1;
}


);



The Folder postProcessing will be created, there you will find the values of Lift, Drag for every time step saved in the forceCoeffs.dat file :D

For more information :

http://www.cfd-online.com/Forums/ope...efficient.html
http://ww3.cad.de/foren/ubb/Forum527...000069-2.shtml

Mirage12 July 24, 2013 01:06

Hello :)


i did a little mistake :(

The simulation was running and the OpenFOAM calculated the drag , lift....and that is why i thought every is perfect ....

but

i did not calculate the forces properly :

Code:

--> FOAM Warning :
    From function void forces::read(const dictionary&)
    in file forces/forces.C at line 449
    Could not find U, p or rho in database.
    De-activating forces.

Do you know, how to fix this warning ??

Thx :)

Artur July 26, 2013 04:56

You didn't mention what solver you were using but I think the problem might be that you didn't specify the field names in your controlDict file. Here's how I do it with interFoam and pimpleDyMFoam and it works:

Code:

    forces
    {
        type        forces;
        functionObjectLibs ( "libforces.so" );
        outputControl timeStep;
        outputInterval 1;
        patches
        (
          "hull.*"
        );
        rhoName    rho;       
        pName      p;
        UName      U;
        log        true
        rhoInf      1;
        CofR        (-5.95 -0.518 -0.5705);
    }


Mirage12 August 5, 2013 01:11

thanks !!:)


All times are GMT -4. The time now is 05:26.