Commit 91c2d774 authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

tutorial scripts

parent adcce409
......@@ -141,6 +141,11 @@ public:
return hitPoint_;
}
Point& rawPoint()
{
return hitPoint_;
}
void setHit()
{
hit_ = true;
......
......@@ -43,23 +43,10 @@ echo ""
for application in *
do
if [ -d "$application" ]
if [ -d $application ]
then
cd $application
if [ -f "Allclean" ]
then
./Allclean
else
for case in *
do
if [ -d "$case" ]
then
cleanCase $case
fi
done
fi
cd ..
fi
(cd $application && ../cleanAll)
fi
done
#------------------------------------------------------------------------------
......@@ -32,94 +32,64 @@
. RunFunctions
applications=\
" \
icoFoam \
turbFoam \
simpleFoam \
icoDyMFoam \
nonNewtonianIcoFoam \
boundaryFoam \
interFoam \
lesInterFoam \
rasInterFoam \
multiphaseInterFoam \
buoyantSimpleFoam \
buoyantFoam \
potentialFoam \
laplacianFoam \
scalarTransportFoam \
oodles \
coodles \
channelOodles \
dnsFoam \
mhdFoam \
electrostaticFoam \
financialFoam \
sonicFoam \
rhoSonicFoam \
rhopSonicFoam \
sonicLiquidFoam \
sonicTurbFoam \
solidDisplacementFoam \
solidEquilibriumDisplacementFoam \
XiFoam \
Xoodles \
dieselFoam \
engineFoam \
bubbleFoam \
twoPhaseEulerFoam \
settlingFoam \
rhoExplicitPorousSimpleFoam \
rhoImplicitPorousSimpleFoam \
rhoTurbFoam \
cavitatingFoam \
MRFSimpleFoam \
interDyMFoam \
"
# logReport <logfile>
# Extracts useful info from log file.
logReport () {
case=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
app=`echo $1 | sed s/"\(.*\)\."/""/g`
appAndCase="Application $app - case $case"
case=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
app=`echo $1 | sed s/"\(.*\)\."/""/g`
appAndCase="Application $app - case $case"
fatalError=`grep "FOAM FATAL" $1`
UxSS=`grep -E "Ux[:| ]*solution singularity" $1`
UySS=`grep -E "Uy[:| ]*solution singularity" $1`
UzSS=`grep -E "Uz[:| ]*solution singularity" $1`
completed=`grep -E "^[\t ]*[eE]nd" $1`
fatalError=`grep "FOAM FATAL" $1`
UxSS=`grep -E "Ux[:| ]*solution singularity" $1`
UySS=`grep -E "Uy[:| ]*solution singularity" $1`
UzSS=`grep -E "Uz[:| ]*solution singularity" $1`
completed=`grep -E "^[\t ]*[eE]nd" $1`
if [ "$fatalError" ] ; then
echo "$appAndCase: ** FOAM FATAL ERROR **"
return
elif [ "$UxSS" -a "$UySS" -a "$UzSS" ] ; then
echo "$appAndCase: ** Solution singularity **"
return
elif [ "$completed" ] ; then
completionTime=`tail -10 $log | grep Execution | cut -d= -f2 | sed 's/^[ \t]*//'`
if [ "$completionTime" ] ; then
completionTime="in $completionTime"
if [ "$fatalError" ] ; then
echo "$appAndCase: ** FOAM FATAL ERROR **"
return
elif [ "$UxSS" -a "$UySS" -a "$UzSS" ] ; then
echo "$appAndCase: ** Solution singularity **"
return
elif [ "$completed" ] ; then
completionTime=`tail -10 $log | grep Execution | cut -d= -f2 | sed 's/^[ \t]*//'`
if [ "$completionTime" ] ; then
completionTime="in $completionTime"
fi
echo "$appAndCase: completed $completionTime"
return
else
echo "$appAndCase: unconfirmed completion"
fi
echo "$appAndCase: completed $completionTime"
return
else
echo "$appAndCase: unconfirmed completion"
fi
}
# Recursively run all tutorials
for application in *
do
if [ -d $application ]
then
#(cd $application && ../runAll)
$WM_SCHEDULER "cd $PWD/$application && ../runAll"
fi
done
# Analyse all log files
rm testLoopReport > /dev/null 2>&1 &
touch testLoopReport
for application in $applications
for application in *
do
cd $application
./Allrun
# echo "$application application completed" >> ../testLoopReport
for log in `find . -name "log.*" | xargs ls -rt`
do
logReport $log >> ../testLoopReport
done
echo "" >> ../testLoopReport
cd ..
if [ -d $application ]
then
cd $application
for log in `find . -name "log.*" | xargs ls -rt`
do
logReport $log >> ../testLoopReport
done
echo "" >> ../testLoopReport
cd ..
fi
done
find . -name "log.*" -exec cat {} \; >> logs
......
......@@ -65,7 +65,22 @@ EOF
#
# VARIABLE
#
MAIN_CONTROL_DICT=${WM_PROJECT_DIR}/${FOAM_DOT_DIR}/controlDict
MAIN_CONTROL_DICT=
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
;
do
if [ -f "$i/controlDict" ]; then
MAIN_CONTROL_DICT="$i/controlDict"
break
fi
done
TUTORIALS_DIR=.
TEST_RUN_DIR=../tutorialsTest
FV_SCHEMES=\
......
......@@ -38,33 +38,33 @@
# do
# if [ $T != "0" ] ; then
# echo "Deleting directory $T"
# rm -rf $1/${T} > /dev/null 2>&1
# rm -rf ${T} > /dev/null 2>&1
# fi
# done
# rm -rf $1/{log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1
# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1
#}
cleanTimeDirectories ()
{
echo "Cleaning $case case of $application application"
echo "Cleaning $PWD case"
nZeros=0
zeros=""
while [ $nZeros -lt 8 ] ; do
timeDir="0.${zeros}[1-9]*"
rm -rf $1/${timeDir} > /dev/null 2>&1
rm -rf $1/-${timeDir} > /dev/null 2>&1
rm -rf ${timeDir} > /dev/null 2>&1
rm -rf ./-${timeDir} > /dev/null 2>&1
zeros=`printf %0${nZeros}d 0`
nZeros=$(($nZeros + 1))
done
rm -rf $1/{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1
rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1
}
cleanCase ()
{
cleanTimeDirectories $1
cleanTimeDirectories
rm -rf $1/constant/polyMesh/{allOwner*,cell*,face*,meshModifiers*} \
$1/constant/polyMesh/{owner*,neighbour*,point*,edge*} \
rm -rf constant/polyMesh/{allOwner*,cell*,face*,meshModifiers*} \
constant/polyMesh/{owner*,neighbour*,point*,edge*} \
> /dev/null 2>&1
for f in `find . -name "*Dict"`
......@@ -76,25 +76,25 @@ cleanCase ()
cleanParallelCase ()
{
cleanCase $1
cleanCase
rm -rf $1/processor* > /dev/null 2>&1
rm -rf processor* > /dev/null 2>&1
}
removeCase ()
{
echo "Removing $case case of $application application"
echo "Removing $case case"
rm -rf $1
}
cleanSamples ()
{
rm -rf $1/{samples,sampleSurfaces} > /dev/null 2>&1
rm -rf {samples,sampleSurfaces} > /dev/null 2>&1
}
cleanUcomponents ()
{
rm -rf $1/0/{Ux,Uy,Uz} > /dev/null 2>&1
rm -rf 0/{Ux,Uy,Uz} > /dev/null 2>&1
}
#------------------------------------------------------------------------------
#!/bin/sh
# Get application name from directory
parentDir=`dirname $PWD`
application=`basename $parentDir`
# Find and source additional functions
tutorialPath=$PWD
while [ ! -f $tutorialPath/CleanFunctions ]
do
tutorialPath="$tutorialPath/.."
done
. $tutorialPath/CleanFunctions
cleanCase
wclean ../MRFSimpleFoam
#!/bin/sh
# Get application name from directory
parentDir=`dirname $PWD`
application=`basename $parentDir`
# Find and source additional functions
tutorialPath=$PWD
while [ ! -f $tutorialPath/RunFunctions ]
do
tutorialPath="$tutorialPath/.."
done
. $tutorialPath/RunFunctions
compileApplication ../MRFSimpleFoam
runApplication makeMesh
runApplication $application
To run all : Allrun
To run all one iteration : Alltest
To clean all : Allclean
The structure now is that a case that only requires blockMesh
and application does not need an Allrun or Allclean script.
Only if running is special it requires an Allrun. Similarly
if cleaning is non-standard.
run clean
boundaryFoam
boundaryLaunderSharma ok
boundaryWallFunctions ok
bubbleFoam
bubbleColumn ok
buoyantFoam
hotRoom ok
buoyantSimpleFoam
hotRoom ok
buoyantSimpleRadiationFoam
hotRadiationRoom ok
cavitatingFoam
nozzle2D No cavitatingFoam solver.
channelOodles
channel395 ok
coodles
pitzDaily ok
dieselFoam
aachenBomb
dnsFoam
boxTurb16
electrostaticFoam
chargedWire ok
engineFoam
kivaTest
financialFoam
europeanCall ok
icoDyMFoam
movingCone ok ok
icoFoam
cavity ok ok
cavityFine ok ok
cavityGrade ok ok
cavityHighRe ok ok
cavityClipped ok ok
elbow ok ok
interDyMFoam
damBreakWithObstacle ok ok
interFoam
damBreak ok ok
damBreakFine ok ok
laplacianFoam
flange ok ok
lesInterFoam
nozzleFlow2D
mdEquilibrationFoam
periodicCube
mhdFoam ok
hartmann
MRFSimpleFoam
mixerVessel2D
multiphaseInterFoam
damBreak4phase
damBreak4phaseFine
nonNewtonianIcoFoam
offsetCylinder
oodles
pitzDaily
pitzDailyDirectMapped
potentialFoam
cylinder
pitzDaily
rasInterFoam
damBreak
damBreakFine
rhoPimpleFoam
angledDuct
rhoPorousSimpleFoam
angledDuctExplicit
angledDuctImplicit
rhopSonicFoam
shockTube
wedge15Ma5
rhoSonicFoam
forwardStep
shockTube No setShock application
rhoTurbFoam
cavity
rhoTurbTwinParcelFoam
simplifiedSiwek
scalarTransportFoam
pitzDaily
settlingFoam
dahl
tank3D
simpleFoam
pitzDaily
pitzDaily3Blocks
pitzDailyExptInlet
simpleSRFFoam
mixer
simpleSRFFoam
solidDisplacementFoam
plateHole
solidEquilibriumDisplacementFoam
beamEndLoad
sonicFoam
forwardStep
shockTube
sonicLiquidFoam
decompressionTank
decompressionTankFine
sonicTurbFoam
nacaAirfoil
prism
turbFoam
cavity
twoPhaseEulerFoam
bed
bed2
bubbleColumn
XiFoam
moriyoshiHomogeneous
moriyoshiHomogeneousPart2
Xoodles
pitzDaily
pitzDaily3D
......@@ -33,31 +33,29 @@
runApplication ()
{
APP_RUN=$1; shift
dir=$1; shift
if [ -f $dir/log.$APP_RUN ] ; then
echo "$APP_RUN already run on $dir: remove log file to run"
if [ -f log.$APP_RUN ] ; then
echo "$APP_RUN already run on $PWD: remove log file to run"
else
echo "Running $APP_RUN on $dir"
( cd $dir && $APP_RUN $* > log.$APP_RUN 2>&1 )
echo "Running $APP_RUN on $PWD"
$APP_RUN $* > log.$APP_RUN 2>&1
fi
}
runParallel ()
{
APP_RUN=$1; shift
dir=$2; shift
if [ -f $dir/log.$APP_RUN ] ; then
echo "$APP_RUN already run on $dir: remove log file to run"
if [ -f $log.$APP_RUN ] ; then
echo "$APP_RUN already run on $PWD: remove log file to run"
else
if [ "$WM_MPLIB" = LAM ]
then
echo "Starting LAM using $2 machines file"
lamboot -v $2
fi
echo "Running $APP_RUN in parallel on $dir using $1 processes"
( cd $dir && mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 )
echo "Running $APP_RUN in parallel on $PWD using $1 processes"
( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 )
if [ "$WM_MPLIB" = LAM ]
then
echo "Stopping LAM"
......@@ -68,8 +66,8 @@ runParallel ()
compileApplication ()
{
echo "Compiling $1/$2 application"
wmake $1/$2
echo "Compiling $1 application"
wmake $1
}
cloneCase ()
......
#!/bin/sh
currDir=`pwd`
application=`basename $currDir`
# Get application name from directory
application=`basename $PWD`
# Find and source additional functions
tutorialPath=$PWD
while [ ! -f $tutorialPath/CleanFunctions ]
do
tutorialPath="$tutorialPath/.."
done
. $tutorialPath/CleanFunctions
keepCases="moriyoshiHomogeneous"
loseCases="moriyoshiHomogeneousPart2"
tutorialPath=`dirname $0`/..
. $tutorialPath/CleanFunctions
for case in $keepCases
do
cleanCase $case
(cd $case && $tutorialsDir/cleanAll)
done
for case in $loseCases
......
#!/bin/sh
currDir=`pwd`
application=`basename $currDir`
cases="moriyoshiHomogeneous moriyoshiHomogeneousPart2"
# Get application name from directory
application=`basename $PWD`
tutorialPath=`dirname $0`/..
# Find and source additional functions
tutorialPath=$PWD
while [ ! -f $tutorialPath/RunFunctions ]
do
tutorialPath="$tutorialPath/.."
done
. $tutorialPath/RunFunctions
setControlDict () {
controlDict="$case/system/controlDict"
controlDict="system/controlDict"
sed \
-e s/"\(deltaT[ \t]*\) 5e-06;"/"\1 1e-05;"/g \
-e s/"\(endTime[ \t]*\) 0.005;"/"\1 0.015;"/g \
......@@ -17,14 +23,17 @@ setControlDict () {
mv temp.$$ $controlDict
}
for case in $cases
do
if [ "$case" = "moriyoshiHomogeneousPart2" ] ; then
cloneCase moriyoshiHomogeneous $case
cp -r moriyoshiHomogeneous/0.005 $case
setControlDict
else
runApplication blockMesh $case
fi
runApplication $application $case
done
# Do moriyoshiHomogeneous
(cd moriyoshiHomogeneous && $tutorialPath/runAll)
# Clone case
cloneCase moriyoshiHomogeneous moriyoshiHomogeneousPart2
# Modify and execute
cd moriyoshiHomogeneousPart2
cp -r ../moriyoshiHomogeneous/0.005 .
setControlDict
runApplication $application
cd ..
#!/bin/sh
# Get application name from directory
parentDir=`dirname $PWD`
application=`basename $parentDir`
# Find and source additional functions
tutorialPath=$PWD
while [ ! -f $tutorialPath/CleanFunctions ]
do
tutorialPath="$tutorialPath/.."
done
. $tutorialPath/CleanFunctions
cleanCase
cp 0/T.org 0/T
wclean setHotRoom
#!/bin/sh
# Get application name from directory
parentDir=`dirname $PWD`
application=`basename $parentDir`
# Find and source additional functions
tutorialPath=$PWD
while [ ! -f $tutorialPath/RunFunctions ]
do
tutorialPath="$tutorialPath/.."
done
. $tutorialPath/RunFunctions
compileApplication setHotRoom
runApplication blockMesh
runApplication setHotRoom
runApplication $application
......@@ -24,7 +24,7 @@ FoamFile
application buoyantFoam;