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

Plotting not working using gnuplot

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 15, 2013, 07:30
Default Plotting not working using gnuplot
  #1
Member
 
Join Date: Nov 2012
Posts: 62
Rep Power: 13
Naruto is on a distinguished road
Hello all,
I have recently upgraded to the newest version of OpenFOAM. I am using OpenFOAM for wind turbine simulation. In the previous versions results were saved in a file named forces.dat under the directory forces/0/forces.dat. I wrote a script file to post process the result in gnuplot. The forces.dat file used to contain
time step pressure force (x_val y_val z_val) viscous force (x_val, y_val, z_val) pressure momentum (x_val y_val z_val) viscous momentum (x_val y_val z_val)
My script for gnuplot is like this:
set title "Power Co-efficient"
set xlabel "Azimuthal Angle"
set ylabel "Power Co-efficient"
set xrange [0:*]
set xtic 60
set mxtic 6
set ytic 0.05
set yrange [0:0.7]
plot 'forces.dat' using ($1*3102)(($10+$13)*54.14)/83.0703125) w lines lt 3 lw 3 title "Power Co-efficient"

Here $10 and $13 represents the pressure momentum (z_val) and viscous momentum (z_val) respectively.

In the newer version of OpenFOAM they have also added a new feature named porous force and momentum. Now the current result section is lie that:
time step pressure force (x_val y_val z_val) viscous force (x_val, y_val, z_val) Porous force (val val val) pressure momentum (x_val y_val z_val) viscous momentum (x_val y_val z_val) porous momentum (val val val)
So I just changed the
plot 'forces.dat' using ($1*3102)(($10+$13)*54.14)/83.0703125) w lines lt 3 lw 3 title "Power Co-efficient" to the following line:
plot 'forces.dat' using ($1*3102)(($16+$19)*54.14)/83.0703125) w lines lt 3 lw 3 title "Power Co-efficient"
Logic says it should work. But it is not working. Instead it is showing a bizarre error like xrange is not valid. What does it mean?
I am copying a portion of the forces.dat file here:
# CofR : (0 0 0)
# Time forces(pressure,viscous,porous) moment(pressure,viscous,porous)
1.19904e-05 ((338.008 0.354984 -16300.4),(0.951959 -0.00138936 0.180745),(0 0 0)) ((-6.70899 126.019 63.7206),(0.0050454 0.357485 1.87497),(0 0 0))
2.63616e-05 ((-6.04664 35.7617 77.5156),(0.800409 0.00167469 0.10359),(0 0 0)) ((-12.7962 -2.38944 -0.0540749),(-0.00608388 0.299752 1.4314),(0 0 0))
4.35873e-05 ((0.226422 -8.14431 137.207),(0.610408 -0.00145384 0.0376114),(0 0 0)) ((3.26375 0.119641 0.787413),(-0.00221222 0.228798 1.09764),(0 0 0))
Any help will be appreciated.
Attached Images
File Type: jpg Capture.jpg (95.9 KB, 31 views)
__________________
Happy Foaming
Naruto is offline   Reply With Quote

Old   November 18, 2013, 15:27
Default gnuplot script not working after OF version change
  #2
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 15
Linse is on a distinguished road
Dear Naruto,

I can only guess, but:
Did the old output look the same in matters of formatting as well? I am particularly curious concerning the brackets and the commas...

Could you maybe add a short snippet of the former output as well? Then one could compare it for any further differences...

Regards,
Bernhard
Linse is offline   Reply With Quote

Old   November 19, 2013, 08:00
Default
  #3
Member
 
Join Date: Nov 2012
Posts: 62
Rep Power: 13
Naruto is on a distinguished road
Dear Linse,
Sorry for my late reply. I think I have solved the problem already. The behavior of gnuplot is kind of strange. It is not recognizing 0 as a value. So I have modified the last line like this:
plot 'forces.dat' using ($1*3102)(($11+$13)*54.14)/83.0703125) w lines lt 3 lw 3 title "Power Co-efficient"

Now it is working fine.
About my previous postprocessing:
The forces.dat file is like this:
# Time forces(pressure, viscous) moment(pressure, viscous)
1.19916e-05 (((4260.91 -0.166375 3.39634e-14) (0.182072 -0.00188388 -3.98097e-14)) ((0.00831877 213.045 3523.73) (9.41938e-05 0.00910361 3.56908)))
2.63682e-05 (((4.04834 -9.33206 1.79013e-16) (0.181656 -0.00469656 7.81041e-15)) ((0.466603 0.202417 0.958215) (0.000234828 0.00908278 3.53391)))
4.36042e-05 (((2.13951 -2.11679 2.16429e-17) (0.177937 -0.00526848 4.70594e-15)) ((0.105839 0.106976 2.28102) (0.000263424 0.00889687 3.49862)))
6.42692e-05 (((8.25938 -1.70984 1.97122e-17) (0.176112 -0.00566661 3.2367e-14)) ((0.0854922 0.412969 2.63943) (0.000283331 0.00880559 3.46185)))
8.90474e-05 (((12.7919 -1.44451 5.11419e-17) (0.175164 -0.00580794 3.90404e-15)) ((0.0722256 0.639593 3.0061) (0.000290397 0.00875821 3.42243)))
0.000118753 (((15.1393 -0.907841 8.83164e-17) (0.174672 -0.00568096 2.44926e-15)) ((0.0453921 0.756966 2.91402) (0.000284048 0.00873361 3.37947)))
0.000154399 (((16.7987 -0.345978 1.05696e-17) (0.174309 -0.00547897 2.51539e-15)) ((0.0172989 0.839936 2.72218) (0.000273948 0.00871544 3.3322)))
0.000197136 (((17.8817 0.24749 -1.23958e-17) (0.173768 -0.00532384 2.49786e-15)) ((-0.0123745 0.894083 2.43213) (0.000266192 0.00868839 3.28003)))

And the script file is given above.
Anyways, I have a question for you. Do you know how could I get a mean line using gnuplot. Thanks
__________________
Happy Foaming
Naruto is offline   Reply With Quote

Old   January 24, 2014, 05:59
Default
  #4
Member
 
Julian Langowski
Join Date: May 2011
Location: Bremen, Germany
Posts: 91
Rep Power: 14
Ruli is on a distinguished road
Quote:
Originally Posted by Naruto View Post
The behavior of gnuplot is kind of strange. It is not recognizing 0 as a value.
Dear Naruto,
I think I encountered the same problem. I don`t think Gnuplot does not NOT recognize 0 as a value, but it has problems identifying all columns. If I replace all "((" with "(( " and ",(" with ",( " (See the spaces!) plotting does work perfectly.
If you simply change column 10 to 11, I fear you might be plotting the wrong column.

Best regards
Julian
__________________
πάντα ῥεῖ - Heraclitus
Ruli is offline   Reply With Quote

Old   January 24, 2014, 07:37
Default
  #5
Member
 
Join Date: Nov 2012
Posts: 62
Rep Power: 13
Naruto is on a distinguished road
Thanks for your feedback. But I think my present script is working perfectly fine. I have tested the present script for very small time interval. It worked. I know it doesn't sound logical. But it is working.

I have one question for you. Do you know how to plot average value in gnuplot?

Thanks
__________________
Happy Foaming
Naruto 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
Is the subsetMotionSolver working in parallel? Arnoldinho OpenFOAM Running, Solving & CFD 7 April 27, 2016 04:38
OpenFoam 1.7.1 in Ubuntu 10.04 won't start working Leech OpenFOAM Installation 8 August 10, 2014 20:42
DPM parallel is not working but serial is working johnwinter FLUENT 1 March 27, 2012 02:01
viewing cfx post while working on cfx solver manager HMR CFX 5 March 9, 2011 22:33
Help required on working of Woven aero FLUENT 0 January 16, 2007 06:25


All times are GMT -4. The time now is 11:37.