|
[Sponsors] |
January 18, 2013, 09:02 |
To Plot Residuals on the fly.
|
#1 |
New Member
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 14 |
Can anyone explain how to plot real time residuals in openfoam 2.1.1. I have seen tutorials for older versions but its not working in 2.1.1
|
|
January 18, 2013, 17:14 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
But maybe if you refer to the method you're using (link on this forum) and the solver you're using someone can enlighten you
__________________
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 |
||
January 21, 2013, 06:26 |
|
#3 |
New Member
Alexandr
Join Date: Jul 2012
Location: Odessa, Ukraine
Posts: 2
Rep Power: 0 |
Needed: Linux, OpenFoam, gnuplot, X (X.org).
1) Run in first terminal shell solver like icoFoam as: $ icoFoam > log.icoFoam 2) Run in second terminal shell gnuplot as: $ gnuplot Courant repeat this step for other plot in third terminal etc. 3) Make additional file for plot graph on runtime OpenFoam. - If you don't need logscale: comment line "set logscale y" with # in first position as "#set logscale y" or delete line. - For plotting any other fields in log file you must editing argument grep command ex. "grep 'Courant Number'" count words in grep string number of field: "Courant Number mean: 0.000417096 max: 0.124527" 1-"Courant" 2-"Number" 3-"mean:" 5-"max:" filds No 4 and 6 is mean and max Courant number. Its using in args of cut command: "cut -d' ' -f4" - If you need draw only one graph: use command plot like: "plot "< cat log.icoFoam | grep 'Courant Number' | cut -d' ' -f4 | tr -d ','" title 'Courant Number mean' with lines" - Edit time in seconds in gnuplot command "pause 10" for redraw plot. - Other commands are trivial File: log.icoFoam (part of file for example) ------------------------------------ Time = 0.1 Courant Number mean: 0.000417096 max: 0.124527 DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 3.59578e-17, No Iterations 1 DICPCG: Solving for p, Initial residual = 1, Final residual = 9.72814e-07, No Iterations 756 time step continuity errors : sum local = 2.66067e-09, global = 5.15345e-14, cumulative = 5.15345e-14 DICPCG: Solving for p, Initial residual = 1.07532e-06, Final residual = 4.96329e-07, No Iterations 1 time step continuity errors : sum local = 1.23062e-09, global = 5.01838e-13, cumulative = 5.53373e-13 ExecutionTime = 4.9 s ClockTime = 5 s ------------------------------------ File: Courant ------------------------------------ set logscale y set title "Courant" set ylabel 'Courant' set xlabel 'Iteration' plot "< cat log.icoFoam | grep 'Courant Number' | cut -d' ' -f4 | tr -d ','" title 'Courant Number mean' with lines,\ "< cat log.icoFoam | grep 'Courant Number' | cut -d' ' -f6 | tr -d ','" title 'Courant Number max' with lines pause 10 reread ------------------------------------ File: Residuals ------------------------------------ set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Iteration' plot "< cat log.icoFoam | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with points pause 10 reread ------------------------------------ Last edited by chern; January 21, 2013 at 07:45. |
|
October 1, 2013, 15:46 |
|
#4 |
Senior Member
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 13 |
hi,
but if i want the iteration at the same time to be plotted so that i can monitor the residuals... what command should i use? Can you please kindly tell me? Kind regards Izna |
|
October 2, 2013, 07:07 |
|
#5 |
Member
Logan Page
Join Date: Sep 2010
Posts: 38
Rep Power: 16 |
If you want the residuals to be piped to the terminal as well as the log file, while the simulation is running, you can use:
icoFoam 2>&1 | tee log.icoFoam Then you can use gnuplot (as chern suggested above) or pyFoam to plot the residuals from the log file. |
|
October 2, 2013, 07:23 |
|
#6 |
New Member
Filip Gjetvaj
Join Date: Mar 2013
Location: Montpellier, FR
Posts: 17
Rep Power: 13 |
Hi Izna
I think this is what you're looking for http://www.cfd-online.com/Forums/ope...residuals.html Regards Filip |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Tutorials] Tutorial of how to plot residuals ! | wolle1982 | OpenFOAM Community Contributions | 171 | February 20, 2024 03:55 |
plot residuals in multiregion solver | val46 | OpenFOAM | 4 | December 12, 2016 07:06 |
plot of residuals | hawkeye321 | OpenFOAM | 5 | December 7, 2012 10:05 |
Residuals Plot | kamalipour | FLUENT | 2 | December 15, 2011 04:44 |
URGENT: plot residuals for complete simulation?? | Khan | FLUENT | 1 | February 1, 2007 13:35 |