CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

Forces in V1.6

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   September 2, 2009, 11:35
Default Forces in V1.6
  #1
Member
 
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 8
terrybarnaby is on a distinguished road
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 is offline   Reply With Quote

Old   September 2, 2009, 12:33
Default
  #2
Member
 
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 8
terrybarnaby is on a distinguished road
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 ...
terrybarnaby is offline   Reply With Quote

Old   September 4, 2009, 02:24
Default
  #3
Senior Member
 
MadsR's Avatar
 
Mads Reck
Join Date: Aug 2009
Location: Copenhagen, Denmark
Posts: 175
Rep Power: 8
MadsR is on a distinguished road
Nice find, it worked for me too.

/Mads
__________________
Online free airfoil-mesher for OpenFOAM here
MadsR is offline   Reply With Quote

Old   September 19, 2009, 05:26
Default
  #4
Member
 
toto
Join Date: Jun 2009
Posts: 71
Rep Power: 8
ronaldo is on a distinguished road
could someone tell me the best way to simulate the Flow over a Cylinder?
Laminare, k-epsilon and k-omega!
ronaldo is offline   Reply With Quote

Old   October 14, 2009, 09:09
Default
  #5
Senior Member
 
stephane sanchi
Join Date: Mar 2009
Posts: 300
Rep Power: 9
openfoam_user is on a distinguished road
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
openfoam_user is offline   Reply With Quote

Old   October 14, 2009, 09:22
Default
  #6
Member
 
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 8
terrybarnaby is on a distinguished road
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 is offline   Reply With Quote

Old   October 14, 2009, 09:24
Default
  #7
Member
 
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 8
terrybarnaby is on a distinguished road
Obviously rhoInf should be set how you need it
terrybarnaby is offline   Reply With Quote

Old   October 14, 2009, 09:39
Default
  #8
Senior Member
 
stephane sanchi
Join Date: Mar 2009
Posts: 300
Rep Power: 9
openfoam_user is on a distinguished road
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.
openfoam_user is offline   Reply With Quote

Old   October 14, 2009, 09:44
Default
  #9
Member
 
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 8
terrybarnaby is on a distinguished road
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 ...
terrybarnaby is offline   Reply With Quote

Old   November 3, 2009, 17:24
Default
  #10
New Member
 
Ted Brenner
Join Date: Oct 2009
Location: Oregon, WI
Posts: 12
Rep Power: 7
griztown is on a distinguished road
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
griztown is offline   Reply With Quote

Old   December 2, 2009, 08:54
Default
  #11
Member
 
Join Date: Sep 2009
Posts: 45
Rep Power: 7
AirS is on a distinguished road
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.

AirS is offline   Reply With Quote

Old   December 2, 2009, 09:01
Default
  #12
Member
 
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 8
terrybarnaby is on a distinguished road
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.
terrybarnaby is offline   Reply With Quote

Old   December 15, 2009, 11:45
Default Multi-phase
  #13
New Member
 
GRD
Join Date: Jun 2009
Posts: 28
Rep Power: 8
g.redondo is on a distinguished road
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
g.redondo is offline   Reply With Quote

Old   December 16, 2009, 05:03
Default
  #14
Member
 
Jean-Peer Lorenz
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 33
Rep Power: 8
jploz is on a distinguished road
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 Free Surface Ship Flow) 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
jploz is offline   Reply With Quote

Old   December 21, 2009, 06:53
Default
  #15
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 7
83_Ale_83 is on a distinguished road
Quote:
Originally Posted by griztown View Post
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
__________________

83_Ale_83 is offline   Reply With Quote

Old   December 21, 2009, 07:55
Default
  #16
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
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
santos is offline   Reply With Quote

Old   December 21, 2009, 08:50
Default
  #17
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 7
83_Ale_83 is on a distinguished road
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
__________________

83_Ale_83 is offline   Reply With Quote

Old   December 21, 2009, 11:04
Default
  #18
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
"My" code calculates both the forces and their coefficients ;-)
santos is offline   Reply With Quote

Old   December 21, 2009, 11:27
Default
  #19
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 7
83_Ale_83 is on a distinguished road
Quote:
Originally Posted by santos View Post
"My" code calculates both the forces and their coefficients ;-)
Thank you, I tried and it works very well
__________________

83_Ale_83 is offline   Reply With Quote

Old   February 23, 2010, 04:17
Default
  #20
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 7
83_Ale_83 is on a distinguished road
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
__________________

83_Ale_83 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
changes to forces in 1.6 linnemann OpenFOAM Running, Solving & CFD 0 July 30, 2009 08:49
Strange results from interFoam solution converges but sum of all forces not equal to zero nicasch OpenFOAM Running, Solving & CFD 0 April 15, 2008 02:01
2d foil pressure forces problem mayor FLUENT 4 December 1, 2003 04:57
viscous-pressure forces nico FLUENT 0 June 9, 2003 14:41
Valve Forces in CFdesign Mike Clapp Main CFD Forum 3 March 8, 2001 15:09


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