
[Sponsors] 
[stressAnalysis] Residual plot for OpenFOAMext problem. 

LinkBack  Thread Tools  Search this Thread  Display Modes 
May 8, 2013, 16:39 
Residual plot for OpenFOAMext problem.

#1 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 12 
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, 05:47 

#2  
Senior Member

Quote:
plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines 

May 9, 2013, 05:55 

#3 
Senior Member


May 9, 2013, 15:53 

#4 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 12 
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, 02:48 

#5  
Senior Member

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, 03:02 

#6 
Senior Member

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, 13:35 

#7 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 12 
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, 03:00 

#8  
Senior Member

Quote:


May 11, 2013, 06:24 

#9  
Member
Daniel Pielmeier
Join Date: Apr 2012
Posts: 99
Rep Power: 12 
Quote:


May 11, 2013, 15:13 

#10 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 12 
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, 15:42 

#11  
Member
Daniel Pielmeier
Join Date: Apr 2012
Posts: 99
Rep Power: 12 
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, 22:37 

#12 
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 12 
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 13, 2013, 07:50 

#13 
Senior Member


May 30, 2013, 02:04 

#14 
Member
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 14 
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, 06:22 

#15 
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,224
Rep Power: 49 
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, 17:57 

#16 
Member
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 14 
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, 20:48 

#17 
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,224
Rep Power: 49 
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, 08:51 
pyFoam error on OpenFOAM Extend

#18  
Member

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: http://www.cfdonline.com/Forums/ope...tml#post498826 Thanks in advance! Jibran 

July 2, 2014, 19:29 

#19  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,224
Rep Power: 49 
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, 07:59 

#20 
Member


Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Foam::error::printStack after large bounding epsilon events  StoneCFD727  OpenFOAM Running, Solving & CFD  1  January 1, 2018 18:04 
pressure in incompressible solvers e.g. simpleFoam  chrizzl  OpenFOAM Running, Solving & CFD  13  March 28, 2017 06:49 
settlingFoam unstable?  bendel_boy  OpenFOAM Running, Solving & CFD  38  July 8, 2016 06:07 
Orifice Plate with a fully developed flow  Problems with convergence  jonmec  OpenFOAM Running, Solving & CFD  3  July 28, 2011 06:24 
Error while running rhoPisoFoam..  nileshjrane  OpenFOAM Running, Solving & CFD  8  August 26, 2010 13:50 