openfoam/bin/foamGraphExecTime
2017-01-26 20:18:50 +00:00

53 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# foamGraphExecTime
#
# Description
# Deprecated script extract the 'ExecutionTime' for each time-step from a
# log file for graphing.
#
# Superseded by the more general foamLog script.
#------------------------------------------------------------------------------
Script=${0##*/}
if [ ! -f "$1" ]; then
echo "$Script: $1 is not a valid filename"
exit 1
fi
tmpTime=newTime$$.dat
cat $1 | \
grep "ExecutionTime = " | \
awk 'BEGIN { NENTRIES = 0 ; TPREV = 0.0 }{NENTRIES++; printf("%f %e\n", NENTRIES, $3 - TPREV); TPREV = $3}' - > $tmpTime
if [ "$(cat $tmpTime | wc -l)" -gt 1 ]; then
mv $tmpTime executionTime.dat
fi
rm -f $tmpTime
#------------------------------------------------------------------------------