Residual plot for OpenFOAMext problem.
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 
Quote:
plot "< cat log  grep 'Solving for U'  cut d' ' f9  tr d ','" title 'U' with lines :) 

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 
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. 
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. :) 
2 Attachment(s)
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 
Quote:

Quote:
Quote:

1 Attachment(s)
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 
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 ',' 
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 
Quote:

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 
Quote:

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 
Quote:

pyFoam error on OpenFOAM Extend
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 
Quote:

Quote:

All times are GMT 4. The time now is 04:59. 