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

[Tutorials] Tutorial of how to plot residuals !

Register Blogs Community New Posts Updated Threads Search

Like Tree346Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2009, 09:19
Default
  #21
Member
 
Bernard Esterhuyse
Join Date: Mar 2009
Location: Pretoria, South Africa
Posts: 50
Rep Power: 17
bernarde is on a distinguished road
Hi

Thanks for this excellent script.

Is it possible to zoom into a section of the residual plot?
bernarde is offline   Reply With Quote

Old   November 29, 2009, 03:27
Default Tutorial of how to plot residuals
  #22
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 every one
When I try to plot residuals with gnuplot I got this error:
plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
^
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
^
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
^
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
Can any body help me?
Regards

Ata
ata is offline   Reply With Quote

Old   November 29, 2009, 03:27
Default Tutorial of how to plot residuals
  #23
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 every one
When I try to plot residuals with gnuplot I got this error:
plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
^
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
^
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
^
"Residuals", line 10: warning: Skipping data file with no valid points

plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,"< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,"< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,"< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines,"< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
Can any body help me?
Regards

Ata
ata is offline   Reply With Quote

Old   January 14, 2010, 10:18
Default
  #24
RBJ
New Member
 
Robin Koldeweij
Join Date: Nov 2009
Posts: 19
Rep Power: 17
RBJ is on a distinguished road
It just means you are trying to extract fields from the 'log' file, which don't exist. May be you don't have a turbulence model and try to extract k and eps in example. Change your residual.txt file accordingly.
sina_mech likes this.
RBJ is offline   Reply With Quote

Old   January 15, 2010, 02:16
Default
  #25
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
Hello RBj
Thanks. It seems so.
Best Regards

Ata
ata is offline   Reply With Quote

Old   April 1, 2010, 10:17
Default
  #26
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
Dear Openfoamers,

Wolfgang tool is very useful.
However, I have a question. I usually start my computation with 3 nonOrthogonalCorector loops and then decreased to 0.
if I use the script of wolfgang with the following line:
"< cat log | grep 'Solving for p' | cut -d' ' -f9 | sed -n 'p;N;N' | tr -d ','" title 'p' with lines

the line of p residual just stop on the graph when I decrease the number of p loops.
how would it be possible to handle that?

regards,

Vincent
vinz is offline   Reply With Quote

Old   October 29, 2010, 22:14
Default
  #27
lth
Member
 
lth's Avatar
 
lth
Join Date: Mar 2009
Location: Madison, WI, USA
Posts: 37
Blog Entries: 45
Rep Power: 17
lth is on a distinguished road
Dear Wolfgang,

want to add to the list, thank you for this script!
lth is offline   Reply With Quote

Old   November 13, 2010, 07:35
Default
  #28
New Member
 
Sarah Köhler
Join Date: Jun 2010
Location: Leoben
Posts: 11
Rep Power: 16
sarahk is on a distinguished road
Thanks for the code, its great ...

can i use it as well to plot the time step continuity errors?
tried to exchange it, but i always get an error ...

thanks in advance ...
sarahk is offline   Reply With Quote

Old   November 14, 2010, 03:10
Default
  #29
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
You might want to take a look at:

http://openfoamwiki.net/index.php/Contrib_PyFoam
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   November 15, 2010, 16:11
Default listing please
  #30
Member
 
Thomas Wolfanger
Join Date: Mar 2009
Location: South West Germany
Posts: 62
Rep Power: 17
anger is on a distinguished road
Quote:
Originally Posted by sarahk View Post
Thanks for the code, its great ...

can i use it as well to plot the time step continuity errors?
tried to exchange it, but i always get an error ...

thanks in advance ...
sarahk,

What's your script and what error do you get?

Regards,
-Thomas
anger is offline   Reply With Quote

Old   November 29, 2010, 12:31
Question
  #31
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi,

i´m using the gnuplot approach quite a while and it is really helpful.

But how about this: i want to know where the residuals are high and not convergent and want to look at the residual-fields (u,v,w, final p e.g.) in paraview.
Basically it´s easy, just create field for each residualvalue and store them BUT i do not know how to manage smth. like residuals (u,v,w,p).write.


Any ideas?

neewbie
mvoss is offline   Reply With Quote

Old   December 2, 2010, 15:02
Default
  #32
New Member
 
Join Date: Oct 2010
Posts: 23
Rep Power: 16
afo3 is on a distinguished road
hello,
I've followed thew instruction of the tutorial to plot the forces.dat file with the forces of my simulation, generated by simpleFoam.

here is my problem: gnuplot, only plots some of the columns, for example 1:3 (time versus Fy) but not 1:2 (time versus Fx) it gives me the following:

Warning : skipping data file with no valid points

attached there's the file.


any ideas??

thanks!

Michele

ps thanks to Wolfgang for the thread!
Attached Files
File Type: txt forces.txt (79.1 KB, 102 views)
afo3 is offline   Reply With Quote

Old   December 2, 2010, 15:26
Default
  #33
New Member
 
Join Date: Oct 2010
Posts: 23
Rep Power: 16
afo3 is on a distinguished road
I think the problem is due to the parentesis in my file..there's a way to convert the .dat file in order to be read properly by gnuplot?

EDIT:

solved here:

http://www.cfd-online.com/Forums/ope...-brackets.html
afo3 is offline   Reply With Quote

Old   December 3, 2010, 04:16
Default
  #34
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
hi,

good to know about the previous post. I solved it with
plot "..." using ... '%lf ( %lf %lf %lf) ( %lf %lf %lf)' but this only works up to 10 x %lf ...so max. 3 Vectors + first row.

neewbie
mvoss is offline   Reply With Quote

Old   June 8, 2011, 08:22
Default
  #35
Senior Member
 
cfdonline2mohsen's Avatar
 
Mohsen KiaMansouri
Join Date: Jan 2010
Location: CFD Lab
Posts: 118
Rep Power: 16
cfdonline2mohsen is on a distinguished road
hi
thank you
cfdonline2mohsen is offline   Reply With Quote

Old   June 27, 2011, 09:44
Default
  #36
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Hi guys,
thank you Wolfgang !
Amir is offline   Reply With Quote

Old   July 7, 2011, 08:46
Default
  #37
Member
 
Tibo
Join Date: Jun 2011
Posts: 68
Rep Power: 15
megacrout is on a distinguished road
Awesome.
Thx Wolfgang.
Tibo
megacrout is offline   Reply With Quote

Old   July 26, 2011, 12:04
Default
  #38
Senior Member
 
calim_cfd's Avatar
 
mauricio
Join Date: Jun 2011
Posts: 172
Rep Power: 18
calim_cfd is on a distinguished road
it's an old topic but still i feel like i need to thank, it surely speeds things up
calim_cfd is offline   Reply With Quote

Old   August 16, 2011, 07:42
Default
  #39
suh
New Member
 
Suhas
Join Date: Jul 2011
Location: Pune
Posts: 21
Rep Power: 15
suh is on a distinguished road
Thanks for the script,

One additional information is, the sequence of residuals reading in command line for gnuplot also to be same as solved by that particular solver. Hope it helps someone.

ThankYou.
Regards
Suhas
suh is offline   Reply With Quote

Old   November 17, 2011, 20:10
Default
  #40
Member
 
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 16
robingilbert is on a distinguished road
Hi everyone,

I tried this:

Code:
set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | sed -n 'Ux;N' | tr -d ','" title 'Ux' with lines,\
     "< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | sed -n 'Uy;N' | tr -d ','" title 'Uy' with lines,\
     "< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | sed -n 'Uz;N' | tr -d ','" title 'Uz' with lines,\
     "< cat log | grep 'Solving for k' | cut -d' ' -f9 | sed -n 'k;N'| tr -d ','" title 'k' with lines,\
     "< cat log | grep 'Solving for p' | cut -d' ' -f9 | sed -n 'p;N;N;N' | tr -d ','" title 'p' with lines 
pause 1
reread
But this plots only p but gives errors for U and k. Can anybody help me?

Last edited by robingilbert; November 17, 2011 at 21:13.
robingilbert 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
plot residuals in multiregion solver val46 OpenFOAM 4 December 12, 2016 07:06
To Plot Residuals on the fly. neeraj OpenFOAM Running, Solving & CFD 5 October 2, 2013 07:23
[PyFoam] why pyFoamPlotRunner doesn't plot continuity residuals? immortality OpenFOAM Community Contributions 10 May 5, 2013 07:13
plot of residuals hawkeye321 OpenFOAM 5 December 7, 2012 10:05
[Virtualization] OpenFOAM oriented tutorial on using VMware Player - support thread wyldckat OpenFOAM Installation 2 July 11, 2012 17:01


All times are GMT -4. The time now is 08:51.