CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

To Plot Residuals on the fly.

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 18, 2013, 08:02
Default To Plot Residuals on the fly.
  #1
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 2
neeraj is on a distinguished road
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
neeraj is offline   Reply With Quote

Old   January 18, 2013, 16:14
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,123
Rep Power: 30
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by neeraj View Post
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
It should. All these methods read the standard-output and extract the residuals from it. The format of the residuals has not changed for years (in pyFoam I havn't had to change the pattern since 1.5 I think and I regularly use it for plotting residuals from 1.6 to 2.1)

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
gschaider is offline   Reply With Quote

Old   January 21, 2013, 05:26
Default
  #3
New Member
 
Alexandr
Join Date: Jul 2012
Location: Odessa, Ukraine
Posts: 1
Rep Power: 0
chern is on a distinguished road
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 06:45.
chern is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial of how to plot residuals ! wolle1982 OpenFOAM Running, Solving & CFD 66 April 11, 2013 07:08
plot of residuals mahdiiowa OpenFOAM 5 December 7, 2012 09:05
plot residuals in multiregion solver val46 OpenFOAM 3 September 7, 2012 02:59
Residuals Plot kamalipour FLUENT 2 December 15, 2011 03:44
URGENT: plot residuals for complete simulation?? Khan FLUENT 1 February 1, 2007 12:35


All times are GMT -4. The time now is 23:54.