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/)
-   -   Wall forces in interFoam (http://www.cfd-online.com/Forums/openfoam-solving/86702-wall-forces-interfoam.html)

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:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so"); //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:

--> FOAM FATAL IO ERROR:
keyword nu is undefined in dictionary ".../OpenFOAM/USRNAME-1.7.0/tutorials/multiphase/interFoam/laminar/damBreak/cons
tant/transportProperties"

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

Hi,

Yes, it works in multiphase. Try with:

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

functions
{ // note that i'm using { instead (
forces
{
type forces;
functionObjectLibs ("libforces.so"); //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!

Bye!

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

hi,

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!

Jordi

Terp April 13, 2011 14:38

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

Thanks!

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?

Regards

andrea

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

Regards

Andrea_85 May 15, 2012 07:47

Hi,
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:

http://www.cfd-online.com/Forums/ope...mulations.html

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.


best

andrea

jordi.muela May 15, 2012 07:59

Hi,

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:

Code:

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

and rho() is:

Code:

00122 Foam::tmp<Foam::volScalarField> Foam::forces::rho() const
00123 {
00124    if (rhoName_ == "rhoInf")
00125    {
00126        const fvMesh& mesh = refCast<const fvMesh>(obr_);
00127
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"?

Regards

Andrea_85 May 15, 2012 08:13

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

andrea

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.


regards,
liping


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