
[Sponsors] 
May 8, 2013, 15:39 
Residual plot for OpenFOAMext problem.

#1 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 6 
Hello everyone,
I am using OpenFOAMext for the stressAnalysis problem. I have successfully used Residual script to plot gnuplot in OpenFOAM1.7.1. I have made changes in the Residual script based on OpenFAOMext log file but it is showing some error. Following is the log file in my case: Time: 1 Time 1, Corrector 0, Solving for U using DICPCG, residual = 1, relative residual = 59362.4 Time 1, Solving for U, Initial residual = 1, Final residual = 1, Relative residual = 59362.4, No outer iterations 1 ExecutionTime = 26.44 s ClockTime = 27 s ExecutionTime = 26.6 s Time: 2 Time 2, Corrector 0, Solving for U using DICPCG, residual = 1, relative residual = 1 Time 2, Solving for U, Initial residual = 1, Final residual = 1, Relative residual = 1, No outer iterations 1 ExecutionTime = 37.93 s ClockTime = 38 s ExecutionTime = 38.12 s Time: 3 Time 3, Corrector 0, Solving for U using DICPCG, residual = 0.305633, relative residual = 1 Time 3, Solving for U, Initial residual = 0.305633, Final residual = 0.305633, Relative residual = 1, No outer iterations 1 ExecutionTime = 54.7 s ClockTime = 55 s ExecutionTime = 54.9 s Time: 4 Time 4, Corrector 0, Solving for U using DICPCG, residual = 0.229696, relative residual = 1 Time 4, Solving for U, Initial residual = 0.229696, Final residual = 0.229696, Relative residual = 1, No outer iterations 1 ExecutionTime = 66.4 s ClockTime = 67 s ExecutionTime = 66.59 s Time: 5 Time 5, Corrector 0, Solving for U using DICPCG, residual = 0.155004, relative residual = 1 Time 5, Solving for U, Initial residual = 0.155004, Final residual = 0.155004, Relative residual = 1, No outer iterations 1 ExecutionTime = 83.12 s ClockTime = 83 s ExecutionTime = 83.3 s Time: 6 Time 6, Corrector 0, Solving for U using DICPCG, residual = 0.088822, relative residual = 1 Time 6, Solving for U, Initial residual = 0.088822, Final residual = 0.088822, Relative residual = 1, No outer iterations 1 ExecutionTime = 96.02 s ClockTime = 96 s ExecutionTime = 96.21 s Time: 7 Time 7, Corrector 0, Solving for U using DICPCG, residual = 0.0763407, relative residual = 1 Time 7, Solving for U, Initial residual = 0.0763407, Final residual = 0.0763407, Relative residual = 1, No outer iterations 1 ExecutionTime = 109.27 s ClockTime = 110 s ExecutionTime = 109.45 s Time: 8 Time 8, Corrector 0, Solving for U using DICPCG, residual = 0.0426613, relative residual = 1 Time 8, Solving for U, Initial residual = 0.0426613, Final residual = 0.0426613, Relative residual = 1, No outer iterations 1 ExecutionTime = 121.37 s ClockTime = 122 s ExecutionTime = 121.57 s The script I am using to plot gnuplot is: set terminal png set output "filename.png" set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Time' cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines pause 1 reread It is showing following error: cat log  grep 'Solving for U'  cut d' ' f9 ^ "Residuals", line 8: invalid command sangeeta@sangeetalaptop:~/Desktop/plateHole0.0001stress$ gnuplot Residuals cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'Ux' with lines" ^ "Residuals", line 8: invalid command sangeeta@sangeetalaptop:~/Desktop/plateHole0.0001stress$ gnuplot Residuals cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'Ux' with lines" ^ "Residuals", line 8: invalid command Am I using wrong script? Can anyone explain how I can change the script to plot residual gnuplot based on log file (which I have mentioned above)? Best regards, Sangeeta 

May 9, 2013, 04:47 

#2  
Senior Member
Tushar Chourushi
Join Date: Jul 2009
Location: IITIndore, India
Posts: 319
Blog Entries: 1
Rep Power: 10 
Quote:
plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines 

May 9, 2013, 14:53 

#4 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 6 
Hi Tushar,
Thank so much for the inputs. I have used "plot" as you suggested: set terminal png set output "filename.png" set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines pause 1 reread but still it is showing following error: plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines ^ "Residuals", line 8: Bad data on line 1 I did go through some posts for plotting gnuplot for residuals and I have tried to do this as mentioned in the posts but still it is showing some error. Do you have any idea way it is coming? Thanks, Sangeeta 

May 10, 2013, 01:48 

#5  
Senior Member
Tushar Chourushi
Join Date: Jul 2009
Location: IITIndore, India
Posts: 319
Blog Entries: 1
Rep Power: 10 
Quote:
Try these steps.. I always follow these for plotting residuals. Open the case folder in your console window (terminal). execute the $application (for eg. icoFoam or any $Foam which you are using) and simultaneously write a log file using the following command in the terminal: $application >log Then open gnuplot in the same console window, and execute the following command: set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines pause 1 reread I wish this will solve your problem. 

May 10, 2013, 02:02 

#6 
Senior Member
Tushar Chourushi
Join Date: Jul 2009
Location: IITIndore, India
Posts: 319
Blog Entries: 1
Rep Power: 10 
Try to edit your output log file like the following and then follow the procedure as mentioned in my earlier post....
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading transportProperties Reading field p Reading field U Reading/calculating face flux field phi Starting time loop Time: 1 Solving for U using DICPCG, Initial residual = 1, Final residual = 1, Relative residual = 59362.4, No outer iterations 1 ExecutionTime = 26.44 s ClockTime = 27 s ExecutionTime = 26.6 s Time: 2 Solving for U using DICPCG, Initial residual = 1, Final residual = 1, Relative residual = 1, No outer iterations 1 ExecutionTime = 37.93 s ClockTime = 38 s ExecutionTime = 38.12 s Time: 3 Solving for U using DICPCG, Initial residual = 0.305633, Final residual = 0.305633, Relative residual = 1, No outer iterations 1 ExecutionTime = 54.7 s ClockTime = 55 s ExecutionTime = 54.9 s Time: 4 Solving for U using DICPCG, Initial residual = 0.229696, Final residual = 0.229696, Relative residual = 1, No outer iterations 1 ExecutionTime = 66.4 s ClockTime = 67 s ExecutionTime = 66.59 s Time: 5 Solving for U using DICPCG, Initial residual = 0.155004, Final residual = 0.155004, Relative residual = 1, No outer iterations 1 ExecutionTime = 83.12 s ClockTime = 83 s ExecutionTime = 83.3 s Time: 6 Solving for U using DICPCG, Initial residual = 0.088822, Final residual = 0.088822, Relative residual = 1, No outer iterations 1 ExecutionTime = 96.02 s ClockTime = 96 s ExecutionTime = 96.21 s Time: 7 Solving for U using DICPCG, Initial residual = 0.0763407, Final residual = 0.0763407, Relative residual = 1, No outer iterations 1 ExecutionTime = 109.27 s ClockTime = 110 s ExecutionTime = 109.45 s Time: 8 Solving for U using DICPCG, Initial residual = 0.0426613, Final residual = 0.0426613, Relative residual = 1, No outer iterations 1 ExecutionTime = 121.37 s ClockTime = 122 s ExecutionTime = 121.57 s ######### I think that was the problem with your case, I hope now you are able to plot. 

May 10, 2013, 12:35 

#7 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 6 
Hi Tushar,
Thank you so much for the suggestions! I have edited some of the initial part of the log file and used the command you mentioned in gnuplot but it is still showing following error: Terminal type set to 'wxt' gnuplot> set logscale y gnuplot> set title "Residuals" gnuplot> set ylabel 'Residual' gnuplot> set xlabel 'Iteration' gnuplot> plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines ^ Bad data on line 1 gnuplot> pause 1 gnuplot> reread I do not know if something is wrong in logs file. I am also attaching the log and logs folders as attachment. Please let me know if something is wrong in these folders. Best regards, Sangeeta 

May 11, 2013, 02:00 

#8  
Senior Member
Tushar Chourushi
Join Date: Jul 2009
Location: IITIndore, India
Posts: 319
Blog Entries: 1
Rep Power: 10 
Quote:


May 11, 2013, 05:24 

#9  
Member
Daniel Pielmeier
Join Date: Apr 2012
Posts: 96
Rep Power: 6 
Quote:


May 11, 2013, 14:13 

#10 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 6 
Hi Tushar and Daniel,
Thank you for the reply. Tushar please find controlDict file as attachment. Daniel even after changing the script based on log file following error is comping: plot "< cat log  grep 'Solving for U using DICPCG'  cut d' ' f9  tr d ','" title 'U' with lines ^ "Residuals", line 8: Bad data on line 1 

May 11, 2013, 14:42 

#11  
Member
Daniel Pielmeier
Join Date: Apr 2012
Posts: 96
Rep Power: 6 
Quote:
Check the output of: Code:
cat log  grep 'Solving for U using DICPCG'  cut d' ' f9  tr d ',' Code:
cat log  grep 'Solving for U using DICPCG'  cut d' ' f12  tr d ',' Code:
cat log  grep 'Solving for U,'  cut d' ' f9  tr d ',' 

May 11, 2013, 21:37 

#12 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 6 
Hi Daniel,
Thank you so much for the suggestions. Now it plotting residuals. I appreciate your help! I also like to thank Tushar for his inputs. Best regards, Sangeeta 

May 30, 2013, 01:04 

#14 
New Member
Emad Tandis
Join Date: Sep 2010
Posts: 27
Rep Power: 7 
Hello everyone
for plotting residuals by gnuplot, I want to plot presiduals for a special row of psolver not every row. for example, in icoFoam, I want to plot initial residual for p for every time step not for evey pisoLoop. Best Regards 

May 30, 2013, 05:22 

#15 
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41 
That is what pyFoamPlotWatcher.py from the PyFoamutilities does out of the box (plot only the first residual of a timestep).
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

May 30, 2013, 16:57 

#16 
New Member
Emad Tandis
Join Date: Sep 2010
Posts: 27
Rep Power: 7 
Thanks
but can you tell me about use of this utility? for plotting residuals, I type " gnuplot plotInstruction" on terminal. that plotInstruction is a text file based on this forum. can I do this by writing new thing in this file? Best Regards Emad Tandis 

May 30, 2013, 19:48 

#17 
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41 
This utility analyzes the logfile and plots the residuals
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

July 1, 2014, 07:51 
pyFoam error on OpenFOAM Extend

#18  
Member
Jibran
Join Date: Oct 2012
Location: Swansea, UK
Posts: 34
Rep Power: 6 
Quote:
This thread is related to OpenFOAM Extend in particular and I was getting an error running pyFoamPlotWatcher.py on Extend. I guess I need to make changes to extract data from log file correctly. Can you please point me in the right direction? The error is here: Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" Thanks in advance! Jibran 

July 2, 2014, 18:29 

#19  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41 
Quote:
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

July 3, 2014, 06:59 

#20 
Member
Jibran
Join Date: Oct 2012
Location: Swansea, UK
Posts: 34
Rep Power: 6 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to write k and epsilon before the abnormal end  xiuying  OpenFOAM Running, Solving & CFD  8  August 27, 2013 15:33 
SLTS+rhoPisoFoam: what is rDeltaT???  nileshjrane  OpenFOAM Running, Solving & CFD  4  February 25, 2013 05:13 
High Courant Number @ icoFoam  Artex85  OpenFOAM Running, Solving & CFD  9  January 3, 2012 09:06 
Problems with simulating TurbFOAM  barath.ezhilan  OpenFOAM  13  July 16, 2009 05:55 
Negative value of k causing simulation to stop  velan  OpenFOAM Running, Solving & CFD  1  October 17, 2008 05:36 