CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Tutorial of how to plot residuals !

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree130Likes

Reply
 
LinkBack Thread Tools 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: 8
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: 322
Rep Power: 8
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: 322
Rep Power: 8
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: 7
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: 322
Rep Power: 8
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, 09:17
Default
  #26
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 277
Rep Power: 9
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 online now   Reply With Quote

Old   October 29, 2010, 21:14
Default
  #27
lth
Member
 
lth's Avatar
 
lth
Join Date: Mar 2009
Location: Madison, WI, USA
Posts: 31
Blog Entries: 32
Rep Power: 8
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: 7
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,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
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: 60
Rep Power: 8
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: 446
Rep Power: 11
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: 6
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, 71 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: 6
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: 446
Rep Power: 11
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, 07:22
Default
  #35
Senior Member
 
cfdonline2mohsen's Avatar
 
Mohsen KiaMansouri
Join Date: Jan 2010
Location: CFD Lab
Posts: 117
Rep Power: 7
cfdonline2mohsen is on a distinguished road
hi
thank you
cfdonline2mohsen is offline   Reply With Quote

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

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

Old   July 26, 2011, 11:04
Default
  #38
Senior Member
 
calim_cfd's Avatar
 
mauricio
Join Date: Jun 2011
Posts: 136
Rep Power: 8
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, 06:42
Default
  #39
suh
New Member
 
Suhas
Join Date: Jul 2011
Location: Pune
Posts: 20
Rep Power: 6
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: 7
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

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT: plot residuals for complete simulation?? Khan FLUENT 1 February 1, 2007 13:35
Convergence - scaled vs unscaled residuals HS FLUENT 1 November 7, 2005 06:45
fluent: residuals Madhukar Rapaka FLUENT 1 October 14, 2005 10:28
graph plot anindya Main CFD Forum 2 September 17, 2003 12:00
residuals Karl CFX 2 June 24, 2003 23:13


All times are GMT -4. The time now is 12:35.