CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Wall forces in interFoam (

Terp March 30, 2011 17:34

Wall forces in interFoam
Hey all.
I'm a newcomer to openFoam, and trying to get a handle on VOF. I have been modifying the damBreak tutorial in version 1.7.0 and I would like to output the force on an obstacle. In my controlDict, I added:

type forces;
functionObjectLibs (""); //Lib to load
patches (block); // change to your patch name
rhoName rhoInf;
rhoInf 1000; //Reference density for fluid
CofR (0 0 0);
outputControl outputTime;
//outputInterval 1;

Running proceeds until it tries to calculate the forces, then it errors out telling me:

keyword nu is undefined in dictionary ".../OpenFOAM/USRNAME-1.7.0/tutorials/multiphase/interFoam/laminar/damBreak/cons

But in the transportProperties file, nu is defined for both phase 1 and phase 2.

Does the "force" function not work in multiphase? If not, is there an easy way to integrate the pressure over a patch? Seems it would have to be p, not p_rgh.

A search showed that someone else had the same error, but they never mentioned if they got it working. Any help is greatly appreciated!

jordi.muela March 31, 2011 01:58


Yes, it works in multiphase. Try with:

libs (""); //if you don't have this line yet, you should add in controldict

{ // note that i'm using { instead (
type forces;
functionObjectLibs (""); //Lib to load
patches (block); // change to your patch name
rhoName rhoInf;
rhoInf 1000; //Reference density for fluid
CofR (0 0 0);
outputControl outputTime;
outputInterval 1;
} //same here

hope it works for you!


Terp March 31, 2011 10:58

Thanks for the reply. I tried changing the ( to { , but it still crashes with the same error. And nu is definitely defined for both phases in the transportproperties file, dispite what the error is telling me. Any other ideas?

jordi.muela April 13, 2011 07:24


if i'm not wrong, you're running your case in laminar, ¿that's true? Previously, i've worked with RAS turbulent model, but today i ran a model in laminar and obtained the same message error that you.
I made some test and i found that if you write a nu definition out of the phases definition, it works.
Now the trouble is know how it affects to the simulation. My simulation is running now, so when it finish maybe i could obtain some results and extract some conclusion.

i hope that can be helpful to you!


Terp April 13, 2011 14:38

Interesting. I'll try it with turbulence and see if the error goes away.


Andrea_85 February 29, 2012 09:57

Hi all,
What does it mean rhoInf for multiphase cases? rho is not constant in space (and also the viscosity).
Are you sure it works for multiphase simulations?



Teemo May 15, 2012 07:37

Hi all,

Have you solved this problem? I got the same question as yours but I still have no idea about how to deal with it


Andrea_85 May 15, 2012 07:47

the force calculation tool is not designed for multiphase. If you want to have it for multiphase calculation you have to change a bit how the transport properties are read or how the forces are calculated, depending on what you want. Here there's an interesting thread about that:

For my application i made my own library that calculates the forces in both phases separately. But if you are interested only in the forces for one phase it should be easier.



jordi.muela May 15, 2012 07:59


if you are interested in laminar cases, as Andrea says, you should modify the source files related to force calculation.

But if you work with turbulent cases, simply set rhoName to rho, this should work.

Example for incompressible RAS model:


00057    else if (obr_.foundObject<incompressible::RASModel>("RASProperties"))
00058    {
00059        const incompressible::RASModel& ras
00060            = obr_.lookupObject<incompressible::RASModel>("RASProperties");
00062        return rho()*ras.devReff();
00063    }

and rho() is:


00122 Foam::tmp<Foam::volScalarField> Foam::forces::rho() const
00123 {
00124    if (rhoName_ == "rhoInf")
00125    {
00126        const fvMesh& mesh = refCast<const fvMesh>(obr_);
00128        return tmp<volScalarField>
00129        (
00130            new volScalarField
00131            (
00132                IOobject
00133                (
00134                    "rho",
00135                    mesh.time().timeName(),
00136                    mesh
00137                ),
00138                mesh,
00139                dimensionedScalar("rho", dimDensity, rhoRef_)
00140            )
00141        );
00142    }
00143    else
00144    {
00145        return(obr_.lookupObject<volScalarField>(rhoName_));
00146    }
00147 }

So, if rhoName is different to rhoInf, the function looks for the scalar field with the name that you set, in this case, "rho".

Teemo May 15, 2012 08:10

Hi andrea,

Could you teach me how did you do that "calculates the forces in both phases separately"?


Andrea_85 May 15, 2012 08:13

if you write me your e-mail i can send you the files.


liping_he May 31, 2012 03:40

1 Attachment(s)
Hi Andrea,

I created a case by combining the interDyMFoam (tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle) and pimpleDyMFoam (tutorials/incompressible/pimpleDyMFoam/propeller) to achieve the simulation of impulse turbine (multiphases flow and AMI). The screenshot of velocity field is shown in attachment containing three nozzles and a runner.
And now, I want to calculate the efficiency. A great issue comes out HOW can i obtain the torque (pressure and viscocity torque ) of runner. I have no idea about this issue. Any advice will be appreciated.


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