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

How to plot drag and lift coeffs.

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By davibarreira

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 13, 2015, 13:51
Default How to plot drag and lift coeffs.
  #1
Senior Member
 
mohsen kh
Join Date: Jan 2013
Location: Iran
Posts: 125
Rep Power: 14
m5m5kh is on a distinguished road
Hi
I used icoFoam to simulate flow around a cylinder for Re=100. (U=1 D=1 rho=1 and nu=.01)
I add some lines to my control dict to calculate the drag and lift coeffs.
----------------------------------------------------------------------
functions
{
forces
{

type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;
patches
(
wall
);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1;
CofR ( 0 0 0 );
liftDir (0 1 0);
dragDir ( 1 0 0 );
pitchAxis ( 0 0 0 );
magUInf 1;
lRef 1;
Aref 1;
}
}
-----------------------------------------------------
finally I had a forceCoeffs.dat file in postProcessing folder.
My main question is how to plot cd and cl data (16000 data) to have something like the attached picture.
Attached Images
File Type: jpg Untitled.jpg (22.6 KB, 242 views)

Last edited by m5m5kh; September 13, 2015 at 13:54. Reason: picture
m5m5kh is offline   Reply With Quote

Old   September 29, 2015, 19:29
Default
  #2
Member
 
Davi Barreira
Join Date: Apr 2014
Location: Fortaleza
Posts: 76
Rep Power: 12
davibarreira is on a distinguished road
There is an OpenFOAM function which you can use called 'foamMonitor', you should try it out. I usually use it to check if the results are going the way I expect them to be. After that I use python to properly generate my graphs.
davibarreira is offline   Reply With Quote

Old   October 7, 2015, 13:25
Default
  #3
Member
 
Davi Barreira
Join Date: Apr 2014
Location: Fortaleza
Posts: 76
Rep Power: 12
davibarreira is on a distinguished road
I saw that you sent me a private message, but i will answer it here so other people can see it too.

So as you pointed out, you've got your forceCoeffs.dat
To use the foamMonitor, just go in the terminal and write:

Code:
foamMonitor ./postProcessing/0/forceCoeffs.dat
This code may vary depending on the location of your forceCoeffs file. One of the problems that you might have is that the y axis range might be to wide, so you cant see the results properly. For that, you might try:

Code:
foamMonitor -yrange [0:1.5] ./postProcessing/0/forceCoeffs.dat
Here you can find out more about foamMonitor:
https://github.com/OpenFOAM/OpenFOAM...ed0738f5b4a1c1
Mano2903, sourav90 and Guangyu like this.
davibarreira is offline   Reply With Quote

Old   February 17, 2022, 06:38
Default Facing error
  #4
New Member
 
Orissa
Join Date: Feb 2022
Posts: 15
Rep Power: 4
pratyush_6174 is on a distinguished road
while running the above code i am getting error.
pratyush_6174 is offline   Reply With Quote

Old   February 17, 2022, 08:33
Default
  #5
New Member
 
Federico Nahuel Ramírez
Join Date: Dec 2020
Location: Spain
Posts: 16
Rep Power: 5
fedenr is on a distinguished road
You may need to put the limits in quotation marks



Code:
foamMonitor -g -y "[0:1.5]" ./postProcessing/0/forceCoeffs.dat
fedenr is offline   Reply With Quote

Old   February 17, 2022, 08:44
Default
  #6
New Member
 
Orissa
Join Date: Feb 2022
Posts: 15
Rep Power: 4
pratyush_6174 is on a distinguished road
I am getting error while running the code in the control dict it is showing rho is not defined and many errors
pratyush_6174 is offline   Reply With Quote

Old   February 21, 2022, 03:21
Default
  #7
New Member
 
Federico Nahuel Ramírez
Join Date: Dec 2020
Location: Spain
Posts: 16
Rep Power: 5
fedenr is on a distinguished road
Could you post your controlDict and the error?
fedenr is offline   Reply With Quote

Old   February 24, 2022, 01:50
Default
  #8
New Member
 
Orissa
Join Date: Feb 2022
Posts: 15
Rep Power: 4
pratyush_6174 is on a distinguished road
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application icoFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1.0;

deltaT 0.01;

writeControl timeStep;

writeInterval 20;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;
functions
{
forces
{

type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;
patches
(
wall
);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1;
CofR ( 0 0 0 );
liftDir (0 1 0);
dragDir ( 1 0 0 );
pitchAxis ( 0 0 0 );
magUInf 1;
lRef 1;
Aref 1;
}
}

// ************************************************** *********************** //

Error:-
--> FOAM FATAL ERROR: (openfoam-2112)
Could not find rho:rho

From void Foam::functionObjects::forces::initialise()
in file forces/forces.C at line 229.

FOAM exiting
pratyush_6174 is offline   Reply With Quote

Old   February 24, 2022, 04:00
Default
  #9
New Member
 
Federico Nahuel Ramírez
Join Date: Dec 2020
Location: Spain
Posts: 16
Rep Power: 5
fedenr is on a distinguished road
I'm using version 2012 and not 2112, but i guess the configuration should be the same.


Instead of

Code:
rhoName           rhoInf;
You should have

Code:
rho          rhoInf;

That's why the error says


Code:
Could not find rho:rho
fedenr is offline   Reply With Quote

Old   March 28, 2022, 03:12
Default
  #10
Member
 
Join Date: Mar 2018
Posts: 33
Rep Power: 8
ghastbug is on a distinguished road
What gnuplot version do I need to install to use foamMonitor?
Btw, if gnuplot does not work for you for whetever reason, I have an octave code I made for plotting aero coefficients in openfoam. It is more complicated than using gnuplot though
ghastbug is offline   Reply With Quote

Old   April 25, 2022, 23:37
Default
  #11
New Member
 
Suraj Garad
Join Date: Feb 2018
Location: Kharagpur
Posts: 16
Rep Power: 8
surajk.garad101 is on a distinguished road
Hi,



I have tried both, but it didn't work for me. Also I have gone through all existing threads here. I am using openfoam 2112.
surajk.garad101 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
wrong SU2 calculation for lift and drag coefficient for NAC4421 mechy SU2 7 January 9, 2017 05:18
[OpenFOAM] Display lift and Drag in paraview SamerAli ParaView 1 May 16, 2013 12:51
How to plot Lift and Drag Coefficients using tecplot 360 RuiVO Tecplot 5 April 13, 2012 14:17
Lift and Drag Monitor Point Values Converging to Zero Josh CFX 24 May 9, 2011 10:38
Correct lift but wrong pressure drag - possible? zx Main CFD Forum 4 July 27, 2007 23:38


All times are GMT -4. The time now is 07:55.