|
[Sponsors] |
June 9, 2016, 10:41 |
plot residuals
|
#1 |
Senior Member
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10 |
hello foamers,
I need to plot residuals with gnuplot in openFoam, I followed all instructions in this link http://www.cfd-online.com/Forums/ope...residuals.html but it doesn't work I attached two files log and Residuals!! Can someone please plot it for me and then explain how did he do it? |
|
June 9, 2016, 11:13 |
|
#2 |
Member
Pedro
Join Date: Nov 2014
Posts: 50
Rep Power: 12 |
Hi.
Are you running on windows or in Linux? If you are using Linux, please remove the .txt extensions and run "gnuplot Residuals". It works, the problem is you are capturing all the pressure sub iterations, that's why you see way more pressure curves than velocity curves. In your case you 6 GAMG solver iterations per iteration, therefore, the "p" line should only present every 6th point. Code:
set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' 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 p' | cut -d' ' -f9 | tr -d ','" every 6 title 'p' with lines pause 1 reread If you are using windows ( which i suspect you are because of the .txt) gnupot is not installed by default. how are you trying to run? cheers Last edited by pupo; June 9, 2016 at 20:34. |
|
June 9, 2016, 11:20 |
|
#3 |
Senior Member
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10 |
I am using windows , i have installed gnuplot and i try to load "residuals" file and plot it and I get this error message "Bad data on line 1"
And for the extension .txt I just add it to load files here in this forum otherwise it can't be loaded |
|
June 9, 2016, 11:24 |
|
#4 |
Member
Pedro
Join Date: Nov 2014
Posts: 50
Rep Power: 12 |
the problem is, this file mostly uses linux functions to parse the file.
every line of the log is read by a combo of Code:
< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ',' The only solution is for you to program your own parsing file using python, mathlab or something like that. And if you are doing that, you might just as well cut gnuplot completely and use either of those tools to plot the graphs. I know there is a python residual script somewhere on the internet, but i've not been able to find it yet. Good luck |
|
June 9, 2016, 11:28 |
|
#5 |
Senior Member
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10 |
In fact i have a partition of linux in my computer.. I try with it to plot residuals but It doesn't respond .. I update gnuplot and I follow all the instructions but it react as if I don't give any command..
|
|
June 9, 2016, 11:32 |
|
#6 |
Member
Pedro
Join Date: Nov 2014
Posts: 50
Rep Power: 12 |
are you sure you have navigated to the folder where you have both the residuals and log files?
once there run "gnuplot Residuals" and the plot should pop. In case you missed it, for the graph to look good for your particular case, Residuals should look like this: Code:
set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' 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 p' | cut -d' ' -f9 | tr -d ','" every 6 title 'p' with lines pause 1 reread |
|
June 9, 2016, 11:47 |
|
#7 |
Senior Member
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10 |
As you see I tried both of commands and I don't get anything
|
|
June 9, 2016, 11:55 |
|
#8 |
Member
Pedro
Join Date: Nov 2014
Posts: 50
Rep Power: 12 |
This is really weird. The command is running, you should see a gnuplot window popping up.
For example, have me running "gnuplot Residuals" in a folder "CFDProblem" containing only the 2 folders you have attached. I'm sorry, i can't help any further |
|
June 9, 2016, 11:57 |
|
#9 |
Senior Member
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10 |
Ok thank you
|
|
September 13, 2016, 07:12 |
|
#10 |
Member
carno
Join Date: Mar 2009
Posts: 70
Rep Power: 17 |
I have similar problem.
when I give command Code:
gnuplot Residuals Code:
$ gnuplot Residuals - plot "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines,"< cat log | grep 'Solving f or 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,"< c at log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,"< cat log | grep 'time step continui ty errors' | cut -d' ' -f9 | tr -d ','" title 'continuity error' with lines,"< cat log | grep 'Solving for omega' | c ut -d' ' -f9 | tr -d ','" title 'omega' with lines ^ "Residuals", line 11: Bad data on line 208 of file < cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ',' My Residual file is, Code:
set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' plot "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines,\ "< 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 k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\ "< cat log | grep 'time step continuity errors' | cut -d' ' -f9 | tr -d ','" title 'continuity error' with lines,\ "< cat log | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines pause 1 reread |
|
April 17, 2018, 01:05 |
openFoam : RESIDUAL PLOT IN WINDOWS
|
#11 |
New Member
ManishR
Join Date: Apr 2013
Posts: 2
Rep Power: 0 |
go to required directory
Depending on solver type following command to generate "log" folder simpleFoam > log & type following command to generate individual residual files like Ux_0,p_0 etc. foamLog log >/dev/null Now, Open gnuplot console and follow this set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' now for plotting Ux residues type following command plot "logs/Ux_0" with lines, Hope this helps Now I am looking for "continuous residual plots as run goes on" in windows ( as we see it in any commercial tool) |
|
June 13, 2018, 09:49 |
|
#12 |
New Member
Luigi Fumagalli
Join Date: Oct 2014
Posts: 1
Rep Power: 0 |
Hello everyone!
Has anyone found a way to plot the residuals on windows? Thanks |
|
July 1, 2018, 06:08 |
|
#13 |
Member
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8 |
||
November 29, 2020, 21:59 |
|
#14 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Look here:
Plot the residuals using pyFoamPlotWatcher |
|
January 14, 2022, 16:48 |
I cannot plot residuals in OpenFOAM for Windows 10
|
#15 |
New Member
Christian
Join Date: Jun 2020
Posts: 1
Rep Power: 0 |
Hello Community, I have problems with the residuals. I have the residuals and the log file, but when I put the command gnuplot residuals I have the following announcement:
Traceback (most recent call last): File "/usr/lib/command-not-found", line 28, in <module> from CommandNotFound import CommandNotFound File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module> from CommandNotFound.db.db import SqliteDatabase File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module> import apt_pkg ImportError: /opt/OpenFOAM/OpenFOAM-v2012/ThirdParty/platforms/linux64/gcc-6.3.0/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /lib/x86_64-linux-gnu/libapt-pkg.so.6.0) Thanks in advance. Christian |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Tutorials] Tutorial of how to plot residuals ! | wolle1982 | OpenFOAM Community Contributions | 172 | December 6, 2024 07:20 |
[swak4Foam] Foam warnings - related to swak4Foam | Salam-H | OpenFOAM Community Contributions | 20 | August 2, 2015 16:40 |
plot residuals | pigna | OpenFOAM Running, Solving & CFD | 2 | December 19, 2014 03:32 |
How to plot residuals of all iterations in Fluent | FJSJ | FLUENT | 4 | September 20, 2013 10:47 |
Residuals Plot | kamalipour | FLUENT | 2 | December 15, 2011 04:44 |