mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
foamGraph.*: Simplified scripts
Added a 'deprecated' comment and recommendation to use 'foamLog'
This commit is contained in:
@ -26,7 +26,10 @@
|
|||||||
# foamGraphExecTime
|
# foamGraphExecTime
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
|
# Deprecated script extract the 'ExecutionTime' for each time-step from a
|
||||||
|
# log file for graphing.
|
||||||
#
|
#
|
||||||
|
# Superceded by the more general foamLog script.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
|
|
||||||
@ -36,30 +39,14 @@ if [ ! -f "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tmpTime=newTime$$.dat
|
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
|
cat $1 | \
|
||||||
|
grep "ExecutionTime = " | \
|
||||||
|
awk 'BEGIN { NENTRIES = 0 ; TPREV = 0.0 }{NENTRIES++; printf("%f %e\n", NENTRIES, $3 - TPREV); TPREV = $3}' - > $tmpTime
|
||||||
|
|
||||||
linesExec=$(cat $tmpTime | wc -l)
|
if [ "$(cat $tmpTime | wc -l)" -gt 1 ]; then
|
||||||
|
mv $tmpTime executionTime.dat
|
||||||
ngraphs=0
|
|
||||||
|
|
||||||
cat << EOF > executionTime.dat
|
|
||||||
Solver Performance
|
|
||||||
iterations
|
|
||||||
time/iteration
|
|
||||||
0 0
|
|
||||||
0 0
|
|
||||||
1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "$linesExec" -gt 1 ]; then
|
|
||||||
cat << EOF >> executionTime.dat
|
|
||||||
time
|
|
||||||
0
|
|
||||||
$linesExec
|
|
||||||
EOF
|
|
||||||
cat $tmpTime >> executionTime.dat
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm $tmpTime
|
rm -f $tmpTime
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -26,7 +26,10 @@
|
|||||||
# foamGraphResKE
|
# foamGraphResKE
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
|
# Deprecated script extract initial turbulence residuals for each time-step
|
||||||
|
# from a log file for graphing.
|
||||||
#
|
#
|
||||||
|
# Superceded by the more general foamLog script.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
|
|
||||||
@ -35,53 +38,27 @@ if [ ! -f "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmpK=newK$$.dat
|
scan()
|
||||||
cat $1 | grep "Solving for k" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%f %e\n", NENTRIES, $8)}' - > $tmpK
|
{
|
||||||
|
tmpFile=new$1$$.dat
|
||||||
|
cat $2 | \
|
||||||
|
grep "Solving for $1" | \
|
||||||
|
grep -v "solution singularity" | \
|
||||||
|
sed s/,//g | \
|
||||||
|
awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpFile
|
||||||
|
|
||||||
tmpEpsilon=newEpsilon$$.dat
|
if [ "$(cat $tmpFile | wc -l)" -gt 1 ]; then
|
||||||
cat $1 | grep "Solving for epsilon" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%f %e\n", NENTRIES, $8)}' - > $tmpEpsilon
|
echo >> residualKE.dat
|
||||||
|
cat $tmpFile >> residualKE.dat
|
||||||
|
fi
|
||||||
|
|
||||||
linesK=$(cat $tmpK | wc -l)
|
rm $tmpFile
|
||||||
linesEpsilon=$(cat $tmpEpsilon | wc -l)
|
}
|
||||||
|
|
||||||
ngraphs=0
|
rm -f residualKE.dat
|
||||||
|
scan "k" $1
|
||||||
if [ "$linesK" -gt 1 ]; then
|
scan "epsilon" $1
|
||||||
ngraphs=$(($ngraphs+1))
|
scan "omega" $1
|
||||||
fi
|
scan "nuTilda" $1
|
||||||
|
|
||||||
if [ "$linesEpsilon" -gt 1 ]; then
|
|
||||||
ngraphs=$(($ngraphs+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat << EOF > residualKE.dat
|
|
||||||
Solver Performance
|
|
||||||
number of iterations
|
|
||||||
residual
|
|
||||||
0 0
|
|
||||||
0 0
|
|
||||||
$ngraphs
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "$linesK" -gt 1 ]; then
|
|
||||||
cat << EOF >> residualKE.dat
|
|
||||||
k
|
|
||||||
0
|
|
||||||
$linesK
|
|
||||||
EOF
|
|
||||||
cat $tmpK >> residualKE.dat
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesEpsilon" -gt 1 ]; then
|
|
||||||
cat << EOF >> residualKE.dat
|
|
||||||
epsilon
|
|
||||||
0
|
|
||||||
$linesEpsilon
|
|
||||||
EOF
|
|
||||||
cat $tmpEpsilon >> residualKE.dat
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm $tmpK
|
|
||||||
rm $tmpEpsilon
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -26,7 +26,10 @@
|
|||||||
# foamGraphResUVWP
|
# foamGraphResUVWP
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
|
# Deprecated script extract initial velocity and pressure residuals for each
|
||||||
|
# time-step from a log file for graphing.
|
||||||
#
|
#
|
||||||
|
# Superceded by the more general foamLog script.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
|
|
||||||
@ -35,98 +38,27 @@ if [ ! -f "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmpU=newU$$.dat
|
scan()
|
||||||
cat $1 | grep "Solving for Ux" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpU
|
{
|
||||||
|
tmpFile=new$1$$.dat
|
||||||
|
cat $2 | \
|
||||||
|
grep "Solving for $1" | \
|
||||||
|
grep -v "solution singularity" | \
|
||||||
|
sed s/,//g | \
|
||||||
|
awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpFile
|
||||||
|
|
||||||
tmpV=newV$$.dat
|
if [ "$(cat $tmpFile | wc -l)" -gt 1 ]; then
|
||||||
cat $1 | grep "Solving for Uy" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpV
|
echo >> residualUVWP.dat
|
||||||
|
cat $tmpFile >> residualUVWP.dat
|
||||||
|
fi
|
||||||
|
|
||||||
tmpW=newW$$.dat
|
rm $tmpFile
|
||||||
cat $1 | grep "Solving for Uz" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpW
|
}
|
||||||
|
|
||||||
tmpP=newP$$.dat
|
rm -f residualUVWP.dat
|
||||||
cat $1 | grep "Solving for p" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpP
|
scan "Ux" $1
|
||||||
|
scan "Uy" $1
|
||||||
linesU=$(cat $tmpU | wc -l)
|
scan "Uz" $1
|
||||||
linesV=$(cat $tmpV | wc -l)
|
scan "p" $1
|
||||||
linesW=$(cat $tmpW | wc -l)
|
|
||||||
linesP=$(cat $tmpP | wc -l)
|
|
||||||
|
|
||||||
ngraphs=0
|
|
||||||
|
|
||||||
if [ "$linesU" -gt 1 ]; then
|
|
||||||
ngraphs=$(($ngraphs+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesV" -gt 1 ]; then
|
|
||||||
ngraphs=$(($ngraphs+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesW" -gt 1 ]; then
|
|
||||||
ngraphs=$(($ngraphs+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesP" -gt 1 ]; then
|
|
||||||
ngraphs=$(($ngraphs+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat << EOF > residualUVWP.dat
|
|
||||||
EOF
|
|
||||||
#Solver Performance
|
|
||||||
#number of iterations
|
|
||||||
#residual
|
|
||||||
#0 0
|
|
||||||
#0 0
|
|
||||||
#$ngraphs
|
|
||||||
#EOF
|
|
||||||
|
|
||||||
if [ "$linesU" -gt 1 ]; then
|
|
||||||
cat << EOF >> residualUVWP.dat
|
|
||||||
|
|
||||||
EOF
|
|
||||||
#U
|
|
||||||
#0
|
|
||||||
#$linesU
|
|
||||||
#EOF
|
|
||||||
cat $tmpU >> residualUVWP.dat
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesV" -gt 1 ]; then
|
|
||||||
cat << EOF >> residualUVWP.dat
|
|
||||||
|
|
||||||
EOF
|
|
||||||
#V
|
|
||||||
#0
|
|
||||||
#$linesV
|
|
||||||
#EOF
|
|
||||||
cat $tmpV >> residualUVWP.dat
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesW" -gt 1 ]; then
|
|
||||||
cat << EOF >> residualUVWP.dat
|
|
||||||
|
|
||||||
EOF
|
|
||||||
#W
|
|
||||||
#0
|
|
||||||
#$linesW
|
|
||||||
#EOF
|
|
||||||
cat $tmpW >> residualUVWP.dat
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$linesP" -gt 1 ]; then
|
|
||||||
cat << EOF >> residualUVWP.dat
|
|
||||||
|
|
||||||
EOF
|
|
||||||
#P
|
|
||||||
#0
|
|
||||||
#$linesP
|
|
||||||
#EOF
|
|
||||||
cat $tmpP >> residualUVWP.dat
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm $tmpU
|
|
||||||
rm $tmpV
|
|
||||||
rm $tmpW
|
|
||||||
rm $tmpP
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
14
bin/foamLog
14
bin/foamLog
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -26,10 +26,8 @@
|
|||||||
# foamLog
|
# foamLog
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# extracts info from log file
|
# Script extract data for each time-step from a log file for graphing.
|
||||||
#
|
#
|
||||||
# Bugs
|
|
||||||
# -solution singularity not handled
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
toolsDir=${0%/*}/tools
|
toolsDir=${0%/*}/tools
|
||||||
@ -106,7 +104,7 @@ usage
|
|||||||
timeName=Time
|
timeName=Time
|
||||||
unset listOpt quietOpt localDB
|
unset listOpt quietOpt localDB
|
||||||
|
|
||||||
# parse options
|
# Parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -139,17 +137,17 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# find the database file
|
# Find the database file
|
||||||
DBFILE=$Script.db
|
DBFILE=$Script.db
|
||||||
[ -f $DBFILE ] || DBFILE=`foamEtcFile $Script.db` || DBFILE=$toolsDir/$Script.db
|
[ -f $DBFILE ] || DBFILE=`foamEtcFile $Script.db` || DBFILE=$toolsDir/$Script.db
|
||||||
|
|
||||||
# need the database file
|
# Heed the database file
|
||||||
[ -f $DBFILE ] || {
|
[ -f $DBFILE ] || {
|
||||||
echo "$Script: Cannot read database $DBFILE"
|
echo "$Script: Cannot read database $DBFILE"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# single logFile
|
# Single logFile
|
||||||
if [ $# -eq 1 ]
|
if [ $# -eq 1 ]
|
||||||
then
|
then
|
||||||
LOG=$1
|
LOG=$1
|
||||||
|
|||||||
Reference in New Issue
Block a user