Skip to content
Snippets Groups Projects
Commit dd60cfcd authored by Mark Olesen's avatar Mark Olesen
Browse files

FIX: provide restore0Dir function to fix issue #159

- makes it easier to ensure the correct behaviour, consistently
parent dd3fb622
Branches
Tags
No related merge requests found
Showing
with 80 additions and 62 deletions
......@@ -41,7 +41,7 @@ isTest()
getNumberOfProcessors()
{
if [ -f $1 ]
if [ -f "$1" ]
then
expandDictionary $1 | sed -ne 's/^numberOfSubdomains\s*\(.*\);/\1/p'
fi
......@@ -166,7 +166,7 @@ compileApplication()
cloneCase()
{
if [ -d $2 ]
if [ -d "$2" ]
then
echo "Case already cloned: remove case directory $2 to clone"
else
......@@ -175,9 +175,22 @@ cloneCase()
cpfiles="0 system constant"
for f in $cpfiles
do
cp -r $1/$f $2
\cp -r $1/$f $2
done
fi
}
# Overwrite 0/ with the contents of 0.org/ if it exists
restore0Dir()
{
echo "Restore 0/ from 0.org/"
if [ -d 0.org ]
then
\rm -rf 0
\cp -r 0.org 0 > /dev/null 2>&1
else
echo " Warning: no 0.org/ found"
fi
}
#------------------------------------------------------------------------------
......@@ -6,7 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication`
cp -r 0.org 0 > /dev/null 2>&1
restore0Dir
runApplication blockMesh
runApplication $application -withFunctionObjects -writePhi -writep
runApplication streamFunction
......
......@@ -6,7 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication`
cp -r 0.org 0 > /dev/null 2>&1
restore0Dir
runApplication blockMesh
runApplication $application -writePhi -writep
runApplication streamFunction
......
......@@ -5,8 +5,7 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
rm -rf 0
cp -r 0.org 0
restore0Dir
runApplication blockMesh
runApplication changeDictionary
runApplication topoSet
......
......@@ -6,12 +6,12 @@ cd ${0%/*} || exit 1
./Allrun.mesh
rm -rf 0 && cp -r 0.org 0
restore0Dir
runApplication decomposePar -force
runParallel potentialFoam -pName pPotential -initialiseUBCs
rm -f processor*/0/phi
\rm -f processor*/0/phi
runParallel XiDyMFoam
......@@ -4,8 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf 0
cp -r 0.org 0
\rm -rf 0
\cp -r 0.org 0
cleanCase
cleanSamples
......
......@@ -9,14 +9,12 @@ runApplication surfaceFeatureExtract
runApplication blockMesh
runApplication snappyHexMesh -overwrite
if [ -d 0 ] ; then
rm -rf 0
fi
\rm -rf 0
runApplication createBaffles -overwrite
runApplication mergeOrSplitBaffles -split -overwrite
cp -r 0.org 0
restore0Dir
runApplication $(getApplication)
......
......@@ -5,8 +5,8 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0
cp -r 0.org 0
\rm -rf 0
\cp -r 0.org 0
cleanSamples
#------------------------------------------------------------------------------
......@@ -7,7 +7,7 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication`
runApplication blockMesh
cp 0/T.org 0/T
\cp 0/T.org 0/T
runApplication setFields
runApplication $application
......
......@@ -7,7 +7,7 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication`
runApplication blockMesh
cp 0/T.org 0/T
\cp 0/T.org 0/T
runApplication setFields
runApplication $application
......
......@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
cp 0/T.org 0/T
\cp 0/T.org 0/T
#------------------------------------------------------------------------------
......@@ -6,7 +6,7 @@ application=`getApplication`
runApplication blockMesh
cp -r 0.org 0
restore0Dir
# Create 1D and 3D baffles
runApplication createBaffles -overwrite
......
......@@ -21,7 +21,6 @@ rm log.topoSet
runApplication topoSet -region cabin -dict system/topoSetDictRegister
# set the initial fields
rm -rf 0
cp -rf 0.org 0
restore0Dir
runApplication $(getApplication)
......@@ -17,5 +17,4 @@ runApplication subsetMesh c0 -patch walls -overwrite
runApplication splitMeshRegions -cellZones -overwrite
# set the initial fields
rm -rf 0
cp -rf 0.org 0
restore0Dir
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
......@@ -25,5 +24,4 @@ rm -rf constant/air/polyMesh/sets
paraFoam -touch -region porous
paraFoam -touch -region air
cp -rf 0.org 0
restore0Dir
......@@ -14,4 +14,4 @@ runApplication createBaffles -overwrite
# remove zero-sized patches
runApplication createPatch -overwrite
cp -rf 0.org 0
restore0Dir
......@@ -11,11 +11,8 @@ cp $FOAM_TUTORIALS/resources/geometry/propellerTip.obj.gz constant/triSurface/
# - meshing
runApplication blockMesh
runApplication surfaceFeatureExtract
runApplication snappyHexMesh -overwrite
runApplication renumberMesh -overwrite
# force removal of fields generated by snappy
......@@ -31,4 +28,4 @@ runApplication createPatch -overwrite
#runApplication moveDynamicMesh -checkAMI
# - set the initial fields
cp -rf 0.org 0
restore0Dir
......@@ -4,14 +4,19 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cd wingMotion_snappyHexMesh
cleanCase
(
cd wingMotion_snappyHexMesh || exit 1
cleanCase
)
cd ../wingMotion2D_simpleFoam
cleanCase
rm -rf 0
cd ../wingMotion2D_pimpleDyMFoam
cleanCase
rm -rf 0
(
cd wingMotion2D_simpleFoam || exit 1
cleanCase
rm -rf 0
)
(
cd wingMotion2D_pimpleDyMFoam || exit 1
cleanCase
rm -rf 0
)
......@@ -5,26 +5,36 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Make 3D mesh in slab of cells.
cd wingMotion_snappyHexMesh
runApplication blockMesh
runApplication snappyHexMesh -overwrite
(
cd wingMotion_snappyHexMesh || exit 1
runApplication blockMesh
runApplication snappyHexMesh -overwrite
)
# Make a 2D mesh by extruding a patch and solve to steady state.
cd ../wingMotion2D_simpleFoam
runApplication extrudeMesh
runApplication createPatch -overwrite
cp -r 0.org 0
runApplication simpleFoam
# Copy the mesh from the steady state case and map the results to a
# mesh motion case, then solve transient.
cd ../wingMotion2D_pimpleDyMFoam
cp -r ../wingMotion2D_simpleFoam/constant/polyMesh constant
cp -r 0.org 0
runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent
mv 0/pointDisplacement.unmapped 0/pointDisplacement
runApplication decomposePar
runParallel `getApplication`
runApplication reconstructPar
(
cd wingMotion2D_simpleFoam || exit 1
runApplication extrudeMesh
runApplication createPatch -overwrite
restore0Dir
runApplication simpleFoam
)
# Copy mesh from the steady state case, map the results to a mesh motion case,
# then solve transient.
(
cd wingMotion2D_pimpleDyMFoam || exit 1
\rm -rf constant/polyMesh
\cp -r ../wingMotion2D_simpleFoam/constant/polyMesh constant
restore0Dir
runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent
\mv 0/pointDisplacement.unmapped 0/pointDisplacement
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
)
#------------------------------------------------------------------------------
......@@ -11,7 +11,7 @@ runApplication blockMesh
# Create faceZones for baffles and fan
runApplication topoSet
cp -r 0.org 0
restore0Dir
# Create wall and cyclic baffles and the fields on them
runApplication createBaffles -overwrite
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment