Skip to content
Permalink
Browse files

foamMonitor: Added -ascii and -size options

These options add the ability to show the plot in the terminal, and at
any size. This is intended to facilitate monitoring on remote machines
where launching an X11 application may not be convenient or possible.

Resolves feature request https://bugs.openfoam.org/view.php?id=3080
  • Loading branch information...
Will Bainbridge
Will Bainbridge committed Oct 2, 2018
1 parent 507b209 commit 80df54208fcc4b26af5ff136bbbca22d5d7e1d1c
Showing with 18 additions and 4 deletions.
  1. +18 −4 bin/foamMonitor
@@ -28,7 +28,7 @@
# Description
# Monitor data with Gnuplot from time-value(s) graphs written by OpenFOAM
# e.g. by functionObjects
# - requires gnuplot, gnuplot_x11
# - requires gnuplot
#
#------------------------------------------------------------------------------
usage() {
@@ -41,11 +41,13 @@ options:
-title | -t <title> set the graph title (default "Data Monitoring")
-logscale | -l plots data (y-axis) on log scale, e.g. for residuals
-refresh | -r <time> refreshes display every <time> sec (default 10s)
-yrange | -y <range> sets data (y-axis) <range>, format "[0:1]"
-yrange | -y <range> sets data (y-axis) range, format "[0:1]"
-size | -s <size> set the size of the output plot, format "640,480"
-ascii | -a show the graph by printing ascii in the terminal
Monitor data with Gnuplot from time-value(s) graphs written by OpenFOAM
e.g. by functionObjects
- requires gnuplot, gnuplot_x11
- requires gnuplot
Example:
foamMonitor -l postProcessing/residuals/0/residuals.dat
@@ -62,7 +64,7 @@ error() {

plotFileHeader() {
cat<<EOF
set term x11 1 font "helvetica,17" linewidth 1.5 persist noraise
set term $gpterminal $size
$logscale
$yrange
set title "$title"
@@ -91,6 +93,9 @@ refresh=10
logscale=""
yrange=""
title="Data Monitoring"
size=""
gpterminal='x11 1 font "helvetica,17" linewidth 1.5 persist noraise'

command -v gnuplot >/dev/null 2>&1 || error "Gnuplot not installed"

# parse options
@@ -124,6 +129,15 @@ do
yrange="set yrange $2"
shift 2
;;
-s | -size)
[ "$#" -ge 2 ] || error "'$1' option requires an argument"
size="size $2"
shift 2
;;
-a | -ascii)
gpterminal="dumb"
shift 1
;;
-*)
error "unknown option: '$*'"
;;

0 comments on commit 80df542

Please sign in to comment.
You can’t perform that action at this time.