How to plot drag and lift coeffs.
1 Attachment(s)
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. |
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.
|
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 Code:
foamMonitor -yrange [0:1.5] ./postProcessing/0/forceCoeffs.dat https://github.com/OpenFOAM/OpenFOAM...ed0738f5b4a1c1 |
Facing error
while running the above code i am getting error.
|
You may need to put the limits in quotation marks
Code:
foamMonitor -g -y "[0:1.5]" ./postProcessing/0/forceCoeffs.dat |
I am getting error while running the code in the control dict it is showing rho is not defined and many errors
|
Could you post your controlDict and the error?
|
/*--------------------------------*- 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 |
I'm using version 2012 and not 2112, but i guess the configuration should be the same.
Instead of Code:
rhoName rhoInf; Code:
rho rhoInf; That's why the error says Code:
Could not find rho:rho |
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 |
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. |
All times are GMT -4. The time now is 09:28. |