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/)
-   -   Force function for laminar case with interDyMFoam (http://www.cfd-online.com/Forums/openfoam-solving/105946-force-function-laminar-case-interdymfoam.html)

Claudio August 13, 2012 17:43

Force function for laminar case with interDyMFoam
 
1 Attachment(s)
I tried to add the "force" function shown below to the sloshingTank2D case in the OpenFOAM tutorials.

Code:

    forces
    {
        type forces;
        functionObjectLibs ("libforces.so"); //Lib to load
        patches (walls); // change to your patch name
        rhoInf 998.2; //Reference density for fluid
        rhoName rho;
        pName p;
        UName U;
        CofR (0 0 0); //Origin for moment calculations
        outputControl  timeStep;
        outputInterval 1;
    }

But when I run it I get an error that says
Code:

[0] --> FOAM FATAL IO ERROR:
[0] keyword nu is undefined in dictionary "/users/ccairoli/OpenFOAM_Test/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/processor0/constant/transportProperties"
[0]
[0] file: /users/ccairoli/OpenFOAM_Test/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/processor0/constant/transportProperties from line 20 to line 32.
[0]
[0]    From function dictionary::lookupEntry(const word&, bool, bool) const
[0]    in file db/dictionary/dictionary.C at line 400.
[0]
FOAM parallel run exiting
[0]

If I comment the force function out it runs with no errors.

Am I using it the wrong function for a laminar case? I use the exact same function for a turbulent case and have no errors either.

Any help would be greatly appreciated.

Claudio

PS: I'm attaching the file if anybody would like to try to replicate the problem.

kmooney August 14, 2012 20:42

Hi Claudio,

The function is complaining because its looking for a viscosity entry in the constant/transportProperties dictionary but its not finding it. Unfortunately just adding this in will remove the error but give you the wrong results.

Because this is a multiphase simulation you have more than one viscosity to worry about and just handing some value will result in incorrect force calculations on the boundaries.

I'm not sure of the easiest way to do this correctly, but, you could add in your own post processor that loads up a viscosity field or the two viscosity values and the alpha field. You would then calculate the forces using this local viscosity value.

Claudio August 15, 2012 08:25

Thanks Kyle for your reply.

Why then does it work for a turbulent case (BTW, in the transportProperties file I have nu for both phases)?
Does it mean it gives the wrong results for the viscous forces in the turbulent case too?
Even if that is the case I would like to make it work because I am mostly interested in the pressure forces.

In my opinion is doing something different in the force calculation for a laminar case than for a turbulent case. I am not a C++ programmer (always done Fortran), so I am having a bit of a hard time following the logic in forces.C

Any help would be appreciated.

Cheers.

Sagun December 5, 2012 06:51

Hello Kyle and Claudio,

greetings from Germany. I'm getting the same error:

--> FOAM FATAL IO ERROR:
keyword nu is undefined in dictionary "/home/stripathi/OpenFOAM/stripathi-2.1.1/run/tutorials/multiphase/interDyMFoam/ras/floatingBox/constant/transportProperties"

file: /home/stripathi/OpenFOAM/stripathi-2.1.1/run/tutorials/multiphase/interDyMFoam/ras/floatingBox/constant/transportProperties from line 20 to line 32.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting


and I'm not even trying to calculate the force on the floating object! I'm attempting to simulate a simple rectangular object floating with 6 DoF in a 2-2 tank with laminar flow.

Could you possibly tell me what am I doing wrong? If necessary, I'll be happy to send you my entire case files.

Thanks,
Sagun


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