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

Force and Force Coefficient

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By jakaranda
  • 1 Post By gfoam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 17, 2009, 02:59
Default Force and Force Coefficient
  #1
ata
Senior Member
 
ata's Avatar
 
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18
ata is on a distinguished road
Hi Foamers
I have a problem with force and force coefficient plotting.
I add this to end of cavity tutorial controlDict file
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (fixedWalls); // change to your patch name
rhoInf 1.225; //Reference density for fluid
CofR (0.25 0 0); //Origin for moment calculations
}
forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
patches (fixedWalls); //change to your patch name
rhoInf 1.225;
CofR (0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0.25 0 0);
magUInf 10.0;
lRef 1;
Aref 1;
}
and I solved it by icoFoam > log
and then when I type " gnuplot forceCoeffs -" I got this message
"forceCoeffs", line 10: warning: Skipping unreadable file "./forceCoeffs/0.0005/forceCoeffs.dat"
"forceCoeffs", line 10: warning: Skipping unreadable file "./forceCoeffs/0.0005/forceCoeffs.dat"
"forceCoeffs", line 10: No data in plot"
I think that I did not calculate force and force coefficient correctly.Can any one help me?
Thanks

Ata
ata is offline   Reply With Quote

Old   March 22, 2010, 13:02
Default
  #2
New Member
 
Join Date: Mar 2009
Posts: 14
Rep Power: 17
jakaranda is on a distinguished road
Hello Ata,

the force.dat file is not in the right format for Gnuplot.

forces.dat has ( and ) which gnuplot can not deal with. you need to remove those.
jakaranda is offline   Reply With Quote

Old   March 23, 2010, 04:18
Default
  #3
ata
Senior Member
 
ata's Avatar
 
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18
ata is on a distinguished road
Hi jakaranda
Thank you very much for your reply. Can you explain more for me.
I do not understand what I must to do?
Best regards
ata is offline   Reply With Quote

Old   March 24, 2010, 13:59
Default
  #4
New Member
 
Join Date: Mar 2009
Posts: 14
Rep Power: 17
jakaranda is on a distinguished road
HEllo ata,

in order to hanve Gnuplot work you must remove all the parentheses.

Ru nthe following script

cat forces.dat | tr -d "("")" > forcesClean.dat

and that will create a forcesClean.dat file wihtout any parentheses which Gnuplot will read.

then wihtin gnuplot use plot "forcesClean.dat" using 1:2 to plot the numbers in the first 2 columns.

for Gnuplot info look at the following websites
http://www.duke.edu/~hpgavin/gnuplot.html
http://t16web.lanl.gov/Kawano/gnuplot/index-e.html

hope this helps

J
mo_na likes this.
jakaranda is offline   Reply With Quote

Old   March 16, 2011, 12:08
Default
  #5
jms
Member
 
José
Join Date: Jan 2011
Posts: 73
Rep Power: 15
jms is on a distinguished road
Dear all,

I am using this function that it is needed in controlDict in orer to get the lift, drag and moment coefficients for a computation of the flow around an airfoil. The results I get for the lift and drag coefficients are very good compared to the reference I am using for both lift and drag coefficients but they are very bad for the moment coefficients. I use CofR=0.25*chord.
Any idea why I am getting this bad results?

Thanks,

José
jms is offline   Reply With Quote

Old   March 22, 2011, 06:45
Default
  #6
Member
 
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 16
fisch is on a distinguished road
Hello,

i have two questions about the probes utility.

1. Is the return value of the probe just the cell midpoint value at the cell where the given probe point lies inside or is it interpolated?

2. What about movingMeshes? Are the probes fixed in space or are they moving with the grid? Do i have to make something on the probes relative/absolute like for velocities in the solver?

Thanks,
rupert
fisch is offline   Reply With Quote

Old   February 5, 2012, 13:35
Default
  #7
Senior Member
 
Gonzalo
Join Date: Mar 2011
Location: Argentina
Posts: 122
Rep Power: 16
gfoam is on a distinguished road
Quote:
Originally Posted by jms View Post
Dear all,

I am using this function that it is needed in controlDict in orer to get the lift, drag and moment coefficients for a computation of the flow around an airfoil. The results I get for the lift and drag coefficients are very good compared to the reference I am using for both lift and drag coefficients but they are very bad for the moment coefficients. I use CofR=0.25*chord.
Any idea why I am getting this bad results?

Thanks,

José
The moment coefficient in libforces.so, is possitive under the rule of the right hand, while in aeronautics, the pitching moment is possitive nose up. I think this may the cause of your differences.
Gonzalo
Tjcross31 likes this.
gfoam is offline   Reply With Quote

Old   April 8, 2012, 07:54
Default
  #8
New Member
 
wangwei
Join Date: Apr 2012
Posts: 9
Rep Power: 14
buaawangwei is on a distinguished road
Hi jakaranda,
now I use the function of "force",This is my function as follows:
forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;

patches
(
MAIN
//FLAP
//SLATUP
//SLATDOWN
//SLATWEI
);

pName p;
UName U;
rhoName rho;
log true;
rhoInf 1;
CofR ( 0 0 0 );
liftDir ( -0.104528463 0.994521895 0 );
dragDir ( 0.994521895 0.104528463 0 );
pitchAxis ( 0 0 1 );
magUInf 68;
lRef 0.457;
Aref 1.2933;
}
I have a question at "Aref"and "rhoRef".because now I compute an airfoil,so "lref" is the chord length,but I don't know how to compute the "ARef".And this a "compressible"case,so I also don't know how to define the "rhoInf".Thank you
buaawangwei is offline   Reply With Quote

Old   April 10, 2012, 21:41
Default
  #9
Senior Member
 
Gonzalo
Join Date: Mar 2011
Location: Argentina
Posts: 122
Rep Power: 16
gfoam is on a distinguished road
Aref is the chord of the airfoil by the lenght in the "z" direction of your problem. If your mesh is a 2D one then Aref=chord*1. The density is computed using the ideal gas law, with the pressure and temperature at freestream conditions.
gfoam is offline   Reply With Quote

Old   August 18, 2021, 14:44
Default
  #10
Member
 
Gabriel Felix
Join Date: May 2021
Location: Brazil
Posts: 35
Rep Power: 6
gabrielfelix is on a distinguished road
I wrote a code for plotting residuals, forces or both

You just gotta execute them at terminal:
Code:
./plotResiduals
./plotForces
./plotRF
plotResiduals:
Code:
#!/bin/bash

# Code for plotting residuals

foamLog log.simpleFoam >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
set logscale y
set title "Residual vs. Iteration"
set xlabel "Iteration"
set ylabel "Residual"
plot "logs/Ux_0" with lines,\
"logs/Uy_0" with lines,\
"logs/Uz_0" with lines,\
"logs/p_0" with lines

EOF
plotForces:
Code:
#!/bin/bash

foamLog log.simpleFoam >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
set logscale x
set title "Forces vs. Iteration"
set xlabel "Iteration"
set ylabel "Forces"
plot '<sed -e "s/[(,)]//g" ./postProcessing/forces/0/force_0.dat' using 1:2 with lines title 'Fx [N]',\
'<sed -e "s/[(,)]//g" ./postProcessing/forces/0/force_0.dat' using 1:3 with lines title 'Fy [N]',\
'<sed -e "s/[(,)]//g" ./postProcessing/forces/0/force_0.dat' using 1:4 with lines title 'Fz [N]'

EOF
plotRF:
Code:
#!/bin/bash

# Code for plotting residuals and forces

foamLog log.simpleFoam >/dev/null

cat ./postProcessing/forces/0/force_0.dat | tr -d "("")" > ./forceClean.dat

gnuplot -persist > /dev/null 2>&1 << EOF

set terminal wxt size 500,600

set multiplot
set size 1,0.5
set origin 0.0,0.5; 
set logscale y
set logscale x
set title "Residual vs. Iteration"
set xlabel "Iteration"
set ylabel "Residual";
plot "logs/Ux_0" with lines,\
"logs/Uy_0" with lines,\
"logs/Uz_0" with lines,\
"logs/p_0" with lines; 


set origin 0.0,0.0; 
unset logscale y
set title "Forces vs. Iteration"
set xlabel "Iteration"
set ylabel "Forces";
plot '<sed -e "s/[(,)]//g" ./postProcessing/forces/0/force_0.dat' using 1:2 with lines title 'Fx [N]',\
'<sed -e "s/[(,)]//g" ./postProcessing/forces/0/force_0.dat' using 1:3 with lines title 'Fy [N]',\
'<sed -e "s/[(,)]//g" ./postProcessing/forces/0/force_0.dat' using 1:4 with lines title 'Fz [N]'
unset multiplot

EOF
gabrielfelix is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What force vector in monitoring Lift Coefficient? pkoon FLUENT 3 November 6, 2008 01:40
The lift force coefficient in bubbly flow Kai Yan Main CFD Forum 1 November 4, 2008 14:54
Problem with lift force coefficient summer FLUENT 0 May 7, 2008 11:35
Lift force coefficient for 2-phase flow Summer FLUENT 0 April 29, 2008 18:58
Lift force or coefficient of lift Rola FLUENT 1 November 12, 2006 14:29


All times are GMT -4. The time now is 22:09.