|
[Sponsors] |
[Tutorials] Tutorial of how to plot residuals ! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 19, 2020, 00:38 |
|
#161 |
New Member
Join Date: Aug 2020
Posts: 7
Rep Power: 6 |
Hi Peter,
Thanks a lot for the suggestion. I changed the script as u said My Script: ---------------------------------------------------------------------------------------------------------------------------- set xrange [1:*] 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 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 pause 1 reread ------------------------------------------------------------------------------------------------------------------------ But, still I am getting error message... --------------------------------------------------------------------------------------------------------------------------------------------------------------- gnuplot> load "Residuals" "Residuals" line 11: warning: Skipping data file with no valid points "Residuals" line 11: warning: Skipping data file with no valid points "Residuals" line 11: warning: Skipping data file with no valid points "Residuals" line 11: warning: Skipping data file with no valid points "Residuals" line 11: warning: Skipping data file with no valid points "Residuals" line 11: warning: Skipping data file with no valid points gnuplot> 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 11: x range is invalid -------------------------------------------------------------------------------------------------------------------------------------------------------------- Plese help me out... |
|
August 19, 2020, 22:59 |
|
#162 |
Senior Member
Peter Hess
Join Date: Apr 2011
Location: Austria
Posts: 250
Rep Power: 17 |
I executed your skript on a case of mine.
It works actualy... I dont see a problem with it. Regards Peter Last edited by peterhess; August 20, 2020 at 06:47. |
|
December 2, 2020, 13:21 |
|
#163 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
For those of you who are stuck with plotting residuals from the Windows Subsystem for Linux (bash under windows), please see the following link for some possible solutions:
Plot the residuals using pyFoamPlotWatcher |
|
January 21, 2021, 16:47 |
gnuplot not plotting residuals
|
#164 |
New Member
Join Date: Dec 2020
Posts: 26
Rep Power: 5 |
Hello,
I have followed your steps but I don't succeed to plot any residuals at all. Here the error I get: [ gnuplot> load 'residuals.gnu' "residuals.gnu" line 10: warning: Skipping data file with no valid points "residuals.gnu" line 10: warning: Skipping data file with no valid points "residuals.gnu" line 10: warning: Skipping data file with no valid points "residuals.gnu" line 10: warning: Skipping data file with no valid points "residuals.gnu" line 10: warning: Skipping data file with no valid points "residuals.gnu" line 10: warning: Skipping data file with no valid points gnuplot> plot "< cat logS | grep 'Solving for Ux' | cut -d' ' -f4 | tr -d ','" title 'Ux' with lines, "< cat logS | grep 'Solving for Uy' | cut -d' ' -f5 | tr -d ','" title 'Uy' with lines, "< cat logS | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines, "< cat logS | grep 'Solving for omega' | cut -d' ' -f9 | tr -d ','" title 'omega' with lines, "< cat logS | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines, "< cat logS | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines ^ "residuals.gnu" line 10: x range is invalid ] Here is an extract of the 'logS' file: [ Time = 601 smoothSolver: Solving for Ux, Initial residual = 0.00152791, Final residual = 1.34114e-06, No Iterations 10 smoothSolver: Solving for Uy, Initial residual = 0.00188445, Final residual = 1.40107e-06, No Iterations 11 smoothSolver: Solving for Uz, Initial residual = 0.000782393, Final residual = 6.19569e-07, No Iterations 10 GAMG: Solving for p, Initial residual = 0.0083305, Final residual = 3.68604e-05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.000366117, Final residual = 2.0491e-06, No Iterations 4 time step continuity errors : sum local = 1.35357e-05, global = -1.07648e-06, cumulative = 1.73712 smoothSolver: Solving for omega, Initial residual = 2.75059e-06, Final residual = 7.9774e-09, No Iterations 9 smoothSolver: Solving for k, Initial residual = 0.00298973, Final residual = 2.85537e-06, No Iterations 11 ExecutionTime = 14.02 s ClockTime = 14 s ] Is there anyone who can help me understanding this problem ? Gnuplot is v5.4 installed on W10 OF is v2012 installed on Ubuntu 20.04 WSL2 |
|
July 22, 2022, 09:08 |
mix/max(T)
|
#165 |
New Member
Join Date: May 2022
Posts: 6
Rep Power: 4 |
how can i plot the value of max temperature in my domain?
|
|
September 29, 2022, 11:54 |
|
#166 |
New Member
Seyfi Girgin
Join Date: Aug 2015
Posts: 12
Rep Power: 11 |
Hi all
In my cases i have the following data GMRES iteration:0 Residual: value 1 value 2 value 3 GMRES iteration:1 Residual: value 4 value 5 value 6 How can i select the value 2? Regards |
|
September 29, 2022, 13:02 |
|
#167 |
Member
Flavio Galeazzo
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 34
Rep Power: 18 |
You can try this:
plot "< cat log | grep 'GMRES iteration:0' | cut -d' ' -f7 | tr -d ','" title 'Value 2' with lines |
|
September 29, 2022, 13:26 |
|
#168 | |
New Member
Seyfi Girgin
Join Date: Aug 2015
Posts: 12
Rep Power: 11 |
Quote:
What if they are in the form of GMRES iteration:0 Residual: (value 1 value 2 value 3) GMRES iteration:1 Residual: (value 4 value 5 value 6) and i want to pick up value 1, in that case -f6 or whatever -f number does not work because of the parenthesis i guess. I received "invalid x range" error. What could be done for this case? |
||
September 29, 2022, 13:36 |
|
#169 |
Member
Flavio Galeazzo
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 34
Rep Power: 18 |
Ok, try this instead
plot "< cat log | grep 'GMRES iteration:0' | cut -d' ' -f4 | tr -d '('" title 'Value 1' with lines |
|
October 5, 2022, 16:01 |
|
#170 |
New Member
Tunc
Join Date: Nov 2021
Posts: 9
Rep Power: 5 |
||
January 14, 2024, 18:01 |
This thread is long, let's make it longer!
|
#171 | |
New Member
Diego
Join Date: Dec 2019
Location: Cardiff
Posts: 9
Rep Power: 6 |
Quote:
An example of the script running: Code:
loading log.buoyantSimpleFoam... Residuals 1e0 +--------------------------------------------------------------------------------------+ |+ + + + + + +| |+ k *******+| |#### p #######+| | ## ### eps $$$$$$$ | 1e-1 |-+ ## ###### #### +-| |+ ## ## #### ## ##### +| |+ ## ## ## ### ## ## ##### ### +| |+ ### ## #### #### ## ### ## ##### +| 1e-2 |-+ # ## ## # ##### ##### ## ###### +-| |+ # # ## ## ## ## ## # ## +| |+ ### #### +| |+ ## +| |+ +| 1e-3 |*+ +-| |* +| |$** +| |$ ** +| |$ ** | 1e-4 |$$ **** ****** +-| |+$$ ***** *** ** *** +| |+ $ **** ** *** *** ***** +| |+ $$ $$$ *** ***** ** ****** *** +| | $$$$$$$ $$$$ $$ ** **** ** **** *** ***** | 1e-5 |-+ $$$$$$$$ $$ $$$$$ $$$ *** ***** ** **** +-| |+ $$ $$ $$ $$$ $$ $$$ * **** +| |+ $$$ $$$$ $$ $$$$ $$ $$$$$ +| |+ $ $$ $$$ $$ $$$ $$ $$$$$$$ +| 1e-6 |-+ $$$ $$$ $$ $$$$$$ +-| |+ $$$ +| |+ +| |+ +| |+ + + + + + +| 1e-7 +--------------------------------------------------------------------------------------+ 0 5000 10000 15000 20000 25000 30000 Iteration Code:
# run this with the name of the log file, i.e. # - ofresiduals log ofresiduals() { gnuplot -e "filename='$1'" ~/.of.residuals.gp } Diego Last edited by Hip2BL7; January 14, 2024 at 18:31. Reason: doesn't work with watch! will have to edit... |
||
February 20, 2024, 03:55 |
How to plot residuals in OpenFOAM-v2312 ?
|
#172 |
New Member
Mustafa
Join Date: Sep 2020
Posts: 3
Rep Power: 6 |
To visualize residuals on a logarithmic scale in OpenFOAM version 2312 (OF-v2312), it is necessary to have a solverInfo file defined in the system.
You can refer to example files located at 'etc/caseDicts/postProcessing/numerical' for guidance on setting up the solverInfo file. This file plays a crucial role in enabling the plotting of residuals with logarithmic scaling for a more insightful analysis. The following bash script can be used to plot the residuals: Code:
#!/bin/bash # path path="postProcessing/solverInfo/0/solverInfo.dat" result="Residuals.png" # Extract the data in the relevant columns awk '{print $1, $4, $9, $14, $19}' $path > extracted_data.txt # Log Scale Plot gnuplot <<- GNU set terminal png size 1200,600 font "Times New Roman, 16" set output "$result" set xlabel "Time" set ylabel "Residual" set logscale y set format y "10^{%T}" set key font "Times New Roman, 16" set label font "Times New Roman, 16" set xlabel font "Times New Roman, 16" set ylabel font "Times New Roman, 16" set xtics font "Times New Roman, 16" set ytics font "Times New Roman, 16" plot "extracted_data.txt" using 1:2 with lines lw 1 title "alpha.water", \ "extracted_data.txt" using 1:3 with lines lw 1 title "epsilon", \ "extracted_data.txt" using 1:4 with lines lw 1 title "k", \ "extracted_data.txt" using 1:5 with lines lw 1 title "p_{rgh}" GNU |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
plot residuals in multiregion solver | val46 | OpenFOAM | 4 | December 12, 2016 07:06 |
To Plot Residuals on the fly. | neeraj | OpenFOAM Running, Solving & CFD | 5 | October 2, 2013 07:23 |
[PyFoam] why pyFoamPlotRunner doesn't plot continuity residuals? | immortality | OpenFOAM Community Contributions | 10 | May 5, 2013 07:13 |
plot of residuals | hawkeye321 | OpenFOAM | 5 | December 7, 2012 10:05 |
[Virtualization] OpenFOAM oriented tutorial on using VMware Player - support thread | wyldckat | OpenFOAM Installation | 2 | July 11, 2012 17:01 |