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