CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Forces in V1.6 (http://www.cfd-online.com/Forums/openfoam/67984-forces-v1-6-a.html)

terrybarnaby September 2, 2009 12:35

Forces in V1.6
 
Hi, I have updated from 1.5 to 1.6 (GIT source). I have modified some of my cases control files to get OpenFOAM 1.6 to work but I am having problems with forces in simpleFoam.
I get the error message:
--> FOAM Warning :
From function void forces::read(const dictionary& dict)
in file forces/forces.C at line 277
Could not find U, p or rho in database.
De-activating forces.
--> FOAM Warning :
From function void forces::read(const dictionary& dict)
in file forces/forces.C at line 277
Could not find U, p or rho in database.
De-activating forces.
My controlDict force configuration is:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so");
outputControl outputTime;

// Patches to sample
patches (car_car);
// Name of fields
pName p;
Uname U;
// Dump to file
log true;
// Density
rhoInf 1.17;
// Centre of rotation
CofR (0 0 0);
}

forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
outputControl outputTime;

// Patches to sample
patches (car_car);
// Name of fields
pName p;
Uname U;
// Dump to file
log true;
// Density
rhoInf 1.17;
// Centre of rotation
CofR (0 0 0);

// Direction for lift
liftDir (0.0 1.0 0.0);
// Direction for drag
dragDir (1.0 0.0 0.0);

// Pitching axis
pitchAxis (0 0 0);

magUInf 13.0;

lRef 2.5;
Aref 0.296256;
}
);

Any one have any idea what is wrong ?

terrybarnaby September 2, 2009 13:33

Looking at the source code it looks like I need to add: "rhoName rhoInf;" to the "forces" and "forceCoeffs" entreis in controlDict or provide a "rho" initial conditions file in "0".
This appears to work ...

MadsR September 4, 2009 03:24

Nice find, it worked for me too.

/Mads

ronaldo September 19, 2009 06:26

could someone tell me the best way to simulate the Flow over a Cylinder?
Laminare, k-epsilon and k-omega!

openfoam_user October 14, 2009 10:09

Terry,

I am using MRFSimpleFoam - OpenFoam-1.6.x.

I get the following message error :

Starting time loop

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

My controlDict is :

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

How do I modify my controlDict file ?

Regards,

Stephane

terrybarnaby October 14, 2009 10:22

Hi,

You need to add:

rhoName rhoInf;
rhoInf 1.17;

instead of:

rhoName rho;
rhoInf 1.225; //Reference density for fluid

I think...

Cheers


Terry

terrybarnaby October 14, 2009 10:24

Obviously rhoInf should be set how you need it :)

openfoam_user October 14, 2009 10:39

Thanks Terry,

Now it works fine !

One more question.
And if I want to have the forces results like below (tail -f log) in the log file ?

Courant Number mean: 0.000625962 max: 0.0181186
DILUPBiCG: Solving for Ux, Initial residual = 8.58271e-05, Final residual = 5.68736e-12, No Iterations 1
DILUPBiCG: Solving for Uy, Initial residual = 0.000135717, Final residual = 1.58931e-11, No Iterations 1
DICPCG: Solving for p, Initial residual = 0.000308555, Final residual = 2.98446e-06, No Iterations 6
DICPCG: Solving for p, Initial residual = 5.6599e-06, Final residual = 9.87842e-07, No Iterations 193
DICPCG: Solving for p, Initial residual = 1.97131e-06, Final residual = 8.93472e-07, No Iterations 1
DICPCG: Solving for p, Initial residual = 9.0792e-07, Final residual = 9.0792e-07, No Iterations 0
time step continuity errors : sum local = 9.67148e-15, global = -1.15687e-16, cumulative = -1.07021e-10
DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0
DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0
DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0
DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0
time step continuity errors : sum local = 9.79972e-15, global = -1.14472e-16, cumulative = -1.07021e-10
ExecutionTime = 25809.3 s ClockTime = 77462 s
forces output:
forces(pressure, viscous)((3.36459 -0.00234243 9.49148e-20) (0.365777 -2.56403e-05 -1.76832e-22))
moment(pressure, viscous)((3.41853e-19 -8.54044e-18 -0.00215479) (-8.87561e-22 1.48373e-20
0.0157578))
forceCoeffs output:
Cd = 152.26
Cl = -0.0966561
Cm = -1.91544e-17
Time = 2.417



Stephane.

terrybarnaby October 14, 2009 10:44

Sorry, I am only a novice at this so I don't know how to do that.

You could try adding:
log true;

I'm not sure what that does ...

griztown November 3, 2009 17:24

Hi,

Is there not a website or tutorial anywhere that gives some instructions for using the forces function? Does it really take digging through the source code? Any links or tips would be much appreciated!

Thanks

AirS December 2, 2009 08:54

Hi all,

I want to investigate the forces acting on a cylinder so I use the entry "forces" in the controlDict,
It works well but in the file .dat I've got something like that:

forces(pressure, viscous)((3.36459 -0.00234243 9.49148e-20) (0.365777 -2.56403e-05 -1.76832e-22))
moment(pressure, viscous)((3.41853e-19 -8.54044e-18 -0.00215479) (-8.87561e-22 1.48373e-20))

What does (pressure, viscous) mean ? I want to compute all the forces that is to say Fx,Fy,Fz.
I can't see them anywhere in the data file...
Is there something I'm missing?
Thanks.


terrybarnaby December 2, 2009 09:01

As far as I know:
Pressure force is the force on the object due directly to pressure differences.
Viscous force is the force due to the "friction" of the fluid passing over the objects surface.

To get the total force acting on the object you need to add the pressure components to the viscous components.

g.redondo December 15, 2009 11:45

Multi-phase
 
Hi all,

I was trying to include the density in the forces.C file and I found that there are already some lines regarding to it. Therefore I wonder if multi-phase is already supported in OF1.6.

If so, how should the controlDict entry be. If it doesn't support it, how should it be included? The most important line would be the following. I think it should be:

vectorField vf = (Sfb[patchi] & devRhoReffb[patchi])*rho.boundaryField()[patchi];

and it is:

vectorField vf = Sfb[patchi] & devRhoReffb[patchi]

has anyone fixed this?

Gonzalo

jploz December 16, 2009 05:03

Hi Gonzalo,

no, the forces object supplied with OF 1.6 does not support multiphase flow. It uses the prescribed density "rhoInf" when calculating the viscous forces (as I already wrote here http://www.cfd-online.com/Forums/ope...ip-flow-2.html) which is obviously not correct in the case of compressible flow and flow involving more than a single incompressible phase. If you would use a constant density in such case your resulting viscous forces would differ a lot.

In order to fix this, you need to read the current density field and use that instead of the defined "rhoInf".

Good luck.
Jean-Peer

83_Ale_83 December 21, 2009 06:53

Quote:

Originally Posted by griztown (Post 235002)
Hi,

Is there not a website or tutorial anywhere that gives some instructions for using the forces function? Does it really take digging through the source code? Any links or tips would be much appreciated!

Thanks

Quote,
anyone can help me? I'am trying to calculate the drag and lift on a cylinder with simplefoam..any advise?

Thank you

santos December 21, 2009 07:55

Hi,

Put something like this in your system/controlDict, changing accordingly to your situation:

Code:

functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (sphere_region0); // change to your patch name
rhoName rhoInf;
rhoInf 1000; //Reference density for fluid
CofR (2 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 (sphere_region0);
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;
}

}

Regards,
Jose Santos

83_Ale_83 December 21, 2009 08:50

Impressive;)

I have put in my controlDict file this code:

Quote:

type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (cilindro); // change to your patch name
pName p;
Uname U;
rhoName rhoInf;
rhoInf 1.17;
CofR (0 0 0); //Origin for moment calculations
outputControl timeStep;
outputInterval 1;
"My" code calculates the forces, your code calculates the coefficient right?
With regards

santos December 21, 2009 11:04

"My" code calculates both the forces and their coefficients ;-)

83_Ale_83 December 21, 2009 11:27

Quote:

Originally Posted by santos (Post 240660)
"My" code calculates both the forces and their coefficients ;-)

Thank you, I tried and it works very well ;)

83_Ale_83 February 23, 2010 04:17

Hello to everybody,
I'm trying to remove the brackets and the header from forces.dat output file, any advise please?

Thank you in advance


All times are GMT -4. The time now is 12:21.