Skip to content

Commit

Permalink
foamMonitor: Added -ascii and -size options
Browse files Browse the repository at this point in the history
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 committed Oct 2, 2018
1 parent 507b209 commit 80df542
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions bin/foamMonitor
Expand Up @@ -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() {
Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: '$*'"
;;
Expand Down

0 comments on commit 80df542

Please sign in to comment.