CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Calculating Drag (https://www.cfd-online.com/Forums/openfoam/86835-calculating-drag.html)

digitalcubano April 4, 2011 00:00

Calculating Drag
 
Hi Foamers,

First, I am brand new to OpenFoam. In fact, its been many years since I've dipped my toes in the CFD waters (right now I feel like I'm drowning!). So, I apologize for my inevitable noobness. For reference, I'm running openFoam v1.7.1.

Second, as indicated by the thread title, I'm interested in using openFoam to estimate the drag on an arbitrary body. To that end, I decided to edit the controlDict file in the cavity example by adding the following chunk of code:

functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
outputControl timeStep;
outputInterval 1;
patches (fixedWalls); // change to your patch name
rhoInf 1.225; //Reference density for fluid
CofR (0.25 0 0); //Origin for moment calculations
}
forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
patches (fixedWalls); //change to your patch name
outputControl timeStep;
outputInterval 1;
rhoInf 1.225;
CofR (0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0.25 0 0);
magUInf 10.0;
lRef 1;
Aref 1;
}
}

However, when I run icoFoam, I don't get any force outputs anywhere. What am I doing wrong?

grjmell April 4, 2011 05:02

Try this:

Code:

    forces
    {
        type        forceCoeffs;
        functionObjectLibs ( "libforces.so" );
        outputControl timeStep;
        outputInterval 10;
        patches
        (
            cylinder
        );
        pName      p;
        UName      U;
        rhoName            rhoInf;
        rhoInf      1000;                //freestream rho
        log        true;
        CofR        ( 0 0 0 );
        liftDir    ( 0 0 1 );
        dragDir    ( 1 0 0 );
        pitchAxis  ( 0 0 0 );
        magUInf    0.441;                //freestream velocity
        lRef        0.1;
        Aref        0.035;
    }

This works.

digitalcubano April 4, 2011 13:01

Yes it does! Thanks for the quick reply. It seems that the culprit was that I was missing the rhoName rhoInf field.

I understand that rhoInf is the free stream density, but what does the rhoName rhoInf field do?

Thanks again.


All times are GMT -4. The time now is 06:01.