Sprucing up the tutorials folder and adding -dict to "collapseEdges"

Patch provided by Bruno Santos
Resolves patch application request http://www.openfoam.org/mantisbt/view.php?id=2015
This commit is contained in:
Henry Weller
2016-03-06 19:06:44 +00:00
parent 7fc1915e1d
commit 4bc77e6aff
34 changed files with 233 additions and 295 deletions

View File

@ -2,7 +2,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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,6 +80,7 @@ int main(int argc, char *argv[])
"Collapse faces that are in the supplied face set" "Collapse faces that are in the supplied face set"
); );
#include "addDictOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -91,6 +92,13 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const word dictName("collapseDict");
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading " << dictName << nl << endl;
IOdictionary collapseDict(dictIO);
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
const bool collapseFaces = args.optionFound("collapseFaces"); const bool collapseFaces = args.optionFound("collapseFaces");
@ -155,7 +163,10 @@ int main(int argc, char *argv[])
{ {
meshFilterPtr.set(new polyMeshFilter(mesh, pointPriority)); meshFilterPtr.set
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);
polyMeshFilter& meshFilter = meshFilterPtr(); polyMeshFilter& meshFilter = meshFilterPtr();
// newMesh will be empty until it is filtered // newMesh will be empty until it is filtered
@ -177,7 +188,10 @@ int main(int argc, char *argv[])
if (collapseFaceSet) if (collapseFaceSet)
{ {
meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority)); meshFilterPtr.reset
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);
polyMeshFilter& meshFilter = meshFilterPtr(); polyMeshFilter& meshFilter = meshFilterPtr();
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh(); const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
@ -198,7 +212,10 @@ int main(int argc, char *argv[])
if (collapseFaces) if (collapseFaces)
{ {
meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority)); meshFilterPtr.reset
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);
polyMeshFilter& meshFilter = meshFilterPtr(); polyMeshFilter& meshFilter = meshFilterPtr();
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh(); const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();

View File

@ -55,35 +55,43 @@ runApplication()
APP_RUN= APP_RUN=
LOG_IGNORE=false LOG_IGNORE=false
LOG_APPEND=false LOG_APPEND=false
LOG_SUFFIX=
# Parse options and executable # Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
key="$1" key="$1"
case "$key" in case "$key" in
-append) -append|-a)
LOG_IGNORE=true LOG_IGNORE=true
LOG_APPEND=true LOG_APPEND=true
;; ;;
-overwrite) -overwrite|-o)
LOG_IGNORE=true LOG_IGNORE=true
;; ;;
-suffix|-s)
LOG_SUFFIX=".$2"
shift
;;
*) *)
APP_RUN="$key" APP_RUN="$key"
APP_NAME="${key##*/}" APP_NAME="${key##*/}"
LOG_SUFFIX="${APP_NAME}${LOG_SUFFIX}"
;; ;;
esac esac
shift shift
done done
if [ -f log.$APP_NAME ] && [ "$LOG_IGNORE" = "false" ] if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
then then
echo "$APP_NAME already run on $PWD: remove log file to re-run" echo "$APP_NAME already run on $PWD:" \
"remove log file 'log.$LOG_SUFFIX' to re-run"
else else
echo "Running $APP_RUN on $PWD" echo "Running $APP_RUN on $PWD"
if [ "$LOG_APPEND" = "true" ]; then if [ "$LOG_APPEND" = "true" ]; then
$APP_RUN "$@" >> log.$APP_NAME 2>&1 $APP_RUN "$@" >> log.$LOG_SUFFIX 2>&1
else else
$APP_RUN "$@" > log.$APP_NAME 2>&1 $APP_RUN "$@" > log.$LOG_SUFFIX 2>&1
fi fi
fi fi
} }
@ -93,40 +101,48 @@ runParallel()
APP_RUN= APP_RUN=
LOG_IGNORE=false LOG_IGNORE=false
LOG_APPEND=false LOG_APPEND=false
LOG_SUFFIX=
nProcs=$(getNumberOfProcessors) nProcs=$(getNumberOfProcessors)
# Parse options and executable # Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
key="$1" key="$1"
case "$key" in case "$key" in
-append) -append|-a)
LOG_IGNORE=true LOG_IGNORE=true
LOG_APPEND=true LOG_APPEND=true
;; ;;
-overwrite) -overwrite|-o)
LOG_IGNORE=true LOG_IGNORE=true
;; ;;
-np) -suffix|-s)
LOG_SUFFIX=".$2"
shift
;;
-np|-n)
nProcs="$2" nProcs="$2"
shift shift
;; ;;
*) *)
APP_RUN="$key" APP_RUN="$key"
APP_NAME="${key##*/}" APP_NAME="${key##*/}"
LOG_SUFFIX="${APP_NAME}${LOG_SUFFIX}"
;; ;;
esac esac
shift shift
done done
if [ -f log.$APP_NAME ] && [ "$LOG_IGNORE" = "false" ] if [ -f log.$SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
then then
echo "$APP_NAME already run on $PWD: remove log file to re-run" echo "$APP_NAME already run on $PWD:" \
"remove log file 'log.$LOG_SUFFIX' to re-run"
else else
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes" echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
if [ "$LOG_APPEND" = "true" ]; then if [ "$LOG_APPEND" = "true" ]; then
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null >> log.$APP_NAME 2>&1 ) ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null >> log.$LOG_SUFFIX 2>&1 )
else else
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$APP_NAME 2>&1 ) ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$LOG_SUFFIX 2>&1 )
fi fi
fi fi
} }

View File

@ -2,7 +2,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) 2012-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -946,6 +946,24 @@ Foam::polyMeshFilter::polyMeshFilter
writeSettings(Info); writeSettings(Info);
} }
Foam::polyMeshFilter::polyMeshFilter
(
const fvMesh& mesh,
const labelList& pointPriority,
const dictionary& dict
)
:
polyMeshFilterSettings(dict),
mesh_(mesh),
newMeshPtr_(),
originalPointPriority_(pointPriority),
pointPriority_(),
minEdgeLen_(),
faceFilterFactor_()
{
writeSettings(Info);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -207,6 +207,14 @@ public:
//- Construct from fvMesh and a label list of point priorities //- Construct from fvMesh and a label list of point priorities
polyMeshFilter(const fvMesh& mesh, const labelList& pointPriority); polyMeshFilter(const fvMesh& mesh, const labelList& pointPriority);
//- Construct from fvMesh and a label list of point priorities
polyMeshFilter
(
const fvMesh& mesh,
const labelList& pointPriority,
const dictionary& dict
);
//- Destructor //- Destructor
~polyMeshFilter(); ~polyMeshFilter();
@ -257,7 +265,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "polyMeshFilterTemplates.C" # include "polyMeshFilterTemplates.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,7 +38,7 @@ cd ${0%/*} || exit 1 # Run from this directory
logReport() logReport()
{ {
caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g` caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
app=`echo $1 | sed s/"\(.*\)\."/""/g` app=`echo $1 | sed s/"\(.*\)log\."/""/g`
appAndCase="Application $app - case $caseName" appAndCase="Application $app - case $caseName"
fatalError=`grep "FOAM FATAL" $1` fatalError=`grep "FOAM FATAL" $1`

View File

@ -9,26 +9,31 @@ application=`getApplication`
runApplication blockMesh runApplication blockMesh
runApplication topoSet -dict system/cRefine.topoSetDict runApplication -s cRefine \
topoSet -dict system/cRefine.topoSetDict
runApplication refineMesh -overwrite -dict system/refineMeshDict runApplication refineMesh -overwrite -dict system/refineMeshDict
rm log.topoSet runApplication -s f \
runApplication topoSet -dict system/f.topoSetDict topoSet -dict system/f.topoSetDict
# create the pyrolysis region. # create the pyrolysis region.
runApplication extrudeToRegionMesh -overwrite runApplication extrudeToRegionMesh -overwrite
rm log.topoSet runApplication -s fBurner \
runApplication topoSet -dict system/fBurner.topoSetDict topoSet -dict system/fBurner.topoSetDict
runApplication createPatch -overwrite runApplication createPatch -overwrite
decomposePar -force > log.decomposePar 2>&1 runApplication -s master \
decomposePar -force
decomposePar -region panelRegion > log.decomposeParPanelRegion 2>&1 runApplication -s panelRegion \
decomposePar -region panelRegion
decomposePar -fields > log.decomposePar 2>&1 runApplication -s fields \
decomposePar -fields
runParallel `getApplication` runParallel `getApplication`

View File

@ -18,7 +18,7 @@ done
for i in bottomWater topAir heater leftSolid rightSolid for i in bottomWater topAir heater leftSolid rightSolid
do do
changeDictionary -region $i > log.changeDictionary.$i 2>&1 runApplication -s $i changeDictionary -region $i
done done

View File

@ -22,7 +22,7 @@ done
for i in bottomAir topAir heater leftSolid rightSolid for i in bottomAir topAir heater leftSolid rightSolid
do do
changeDictionary -region $i > log.changeDictionary.$i 2>&1 runApplication -s $i changeDictionary -region $i
done done

View File

@ -7,16 +7,10 @@ cd ${0%/*} || exit 1 # Run from this directory
./Allrun.pre ./Allrun.pre
runApplication decomposePar -region air runApplication -s air decomposePar -region air
mv log.decomposePar log.decomposePar.air runApplication -s porous decomposePar -region porous
runApplication decomposePar -region porous
mv log.decomposePar log.decomposePar.porous
runParallel $(getApplication) runParallel $(getApplication)
runApplication reconstructPar -latestTime -region air runApplication -s air reconstructPar -latestTime -region air
mv log.reconstructPar log.reconstructPar.air runApplication -s porous reconstructPar -latestTime -region porous
runApplication reconstructPar -latestTime -region porous
mv log.reconstructPar log.reconstructPar.porous

View File

@ -6,20 +6,18 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $WM_PROJECT_DIR/bin/tools/RunFunctions
#create meshes #create meshes
runApplication blockMesh -region air runApplication -s air blockMesh -region air
mv log.blockMesh log.blockMesh.air runApplication -s porous blockMesh -region porous
runApplication blockMesh -region porous
mv log.blockMesh log.blockMesh.porous
# create rotor blades in air region # create rotor blades in air region
runApplication topoSet -region air -dict system/topoSetDict.1 runApplication -s air.1 \
mv log.topoSet log.topoSet.air.1 topoSet -region air -dict system/topoSetDict.1
runApplication createBaffles -region air -overwrite runApplication createBaffles -region air -overwrite
# create rotor zone in air region for MRF # create rotor zone in air region for MRF
runApplication topoSet -region air -dict system/topoSetDict.2 runApplication -s air.2 \
mv log.topoSet log.topoSet.air.2 topoSet -region air -dict system/topoSetDict.2
rm -rf constant/air/polyMesh/sets rm -rf constant/air/polyMesh/sets

View File

@ -15,13 +15,15 @@ cd ${0%/*} || exit 1 # Run from this directory
# Agglomerate patch faces # Agglomerate patch faces
for i in bottomAir topAir for i in bottomAir topAir
do do
faceAgglomerate -region $i -dict constant/viewFactorsDict > log.faceAgglomerate.$i 2>&1 runApplication -s $i \
faceAgglomerate -region $i -dict constant/viewFactorsDict
done done
# Generate view factors # Generate view factors
for i in bottomAir topAir for i in bottomAir topAir
do do
viewFactorsGen -region $i > log.viewFactorsGen.$i 2>&1 runApplication -s $i \
viewFactorsGen -region $i
done done
runApplication `getApplication` runApplication `getApplication`

View File

@ -18,13 +18,15 @@ runApplication decomposePar -allRegions
# Agglomerate patch faces # Agglomerate patch faces
for i in bottomAir topAir for i in bottomAir topAir
do do
mpirun -np 4 faceAgglomerate -region $i -dict constant/viewFactorsDict -parallel> log.faceAgglomerate.$i 2>&1 runParallel -s $i -np 4 \
faceAgglomerate -region $i -dict constant/viewFactorsDict
done done
# Generate view factors # Generate view factors
for i in bottomAir topAir for i in bottomAir topAir
do do
mpirun -np 4 viewFactorsGen -region $i -parallel > log.viewFactorsGen.$i 2>&1 runParallel -s $i -np 4 \
viewFactorsGen -region $i
done done
# Run # Run

View File

@ -17,7 +17,7 @@ done
for i in bottomAir topAir heater leftSolid rightSolid for i in bottomAir topAir heater leftSolid rightSolid
do do
changeDictionary -region $i > log.changeDictionary.$i 2>&1 runApplication -s $i changeDictionary -region $i
done done

View File

@ -17,15 +17,11 @@ do
sed "s/XXX/$e/g" constant/transportProperties.template \ sed "s/XXX/$e/g" constant/transportProperties.template \
> constant/transportProperties > constant/transportProperties
runApplication `getApplication` runApplication -s $e `getApplication`
mv log.boundaryFoam log.boundaryFoam_$e
# extract y+, U+ # extract y+, U+
# note: both must be added to foamLog.db # note: both must be added to foamLog.db
runApplication foamLog log.boundaryFoam_$e runApplication -s $e foamLog log.boundaryFoam.$e
mv log.foamLog log.foamLog_$e
if [ -e logs/yPlus_0 ] if [ -e logs/yPlus_0 ]
then then

View File

@ -9,13 +9,14 @@ runApplication surfaceFeatureExtract
runApplication foamyHexMesh runApplication foamyHexMesh
# Collapse only patch faces from incomplete conformation # Collapse only patch faces from incomplete conformation
cp system/collapseDict.indirectPatchFaces system/collapseDict runApplication -s indirectPatchFaces \
runApplication collapseEdges -collapseFaceSet indirectPatchFaces -latestTime -overwrite collapseEdges -collapseFaceSet indirectPatchFaces -latestTime -overwrite \
mv log.collapseEdges log.collapseEdges-indirectPatchFaces -dict system/collapseDict.indirectPatchFaces
# Collapse small edges and sliver faces # Collapse small edges and sliver faces
cp system/collapseDict.collapseFaces system/collapseDict runApplication -s collapseFaces \
runApplication collapseEdges -collapseFaces -latestTime -overwrite collapseEdges -collapseFaces -latestTime -overwrite \
-dict system/collapseDict.collapseFaces
runApplication checkMesh -allTopology -allGeometry -latestTime runApplication checkMesh -allTopology -allGeometry -latestTime

View File

@ -5,7 +5,6 @@ cp -rf 0.org 0
runApplication blockMesh runApplication blockMesh
#runApplication setSet -batch wallFilmRegion.setSet #runApplication setSet -batch wallFilmRegion.setSet
#mv log.setSet log.wallFilmRegion.setSet
runApplication topoSet runApplication topoSet
runApplication extrudeToRegionMesh -overwrite runApplication extrudeToRegionMesh -overwrite

View File

@ -8,15 +8,11 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication` application=`getApplication`
runApplication decomposePar -region wallFilmRegion runApplication -s wallFilmRegion decomposePar -region wallFilmRegion
mv log.decomposePar log.decomposePar.wallFilmRegion runApplication -s primaryRegion decomposePar
runApplication decomposePar
mv log.decomposePar log.decomposePar.primaryRegion
runParallel $application runParallel $application
runApplication reconstructPar -region wallFilmRegion runApplication -s wallFilmRegion reconstructPar -region wallFilmRegion
mv log.reconstructPar log.reconstructPar.wallFilmRegion runApplication -s primaryRegion reconstructPar
runApplication reconstructPar
mv log.reconstructPar log.reconstructPar.primaryRegion

View File

@ -16,8 +16,7 @@ runApplication topoSet
runApplication subsetMesh c0 -patch wallFilm -overwrite runApplication subsetMesh c0 -patch wallFilm -overwrite
# split the obstacle patches into cube[1-6]_patch[1-6] # split the obstacle patches into cube[1-6]_patch[1-6]
echo "running patchifyObstacles" runApplication ./patchifyObstacles
./patchifyObstacles > log.patchifyObstacles 2>&1
# Create the wall film region via extrusion # Create the wall film region via extrusion
runApplication extrudeToRegionMesh -overwrite runApplication extrudeToRegionMesh -overwrite

View File

@ -6,7 +6,6 @@ cp -rf 0.org 0
runApplication blockMesh runApplication blockMesh
#runApplication setSet -batch wallFilmRegion.setSet #runApplication setSet -batch wallFilmRegion.setSet
#mv log.setSet log.wallFilmRegion.setSet
runApplication topoSet -dict system/wallFilmRegion.topoSet runApplication topoSet -dict system/wallFilmRegion.topoSet
runApplication extrudeToRegionMesh -overwrite runApplication extrudeToRegionMesh -overwrite

View File

@ -5,17 +5,25 @@ cp -rf 0.org 0
runApplication blockMesh runApplication blockMesh
#runApplication setSet -batch wallFilmRegion.setSet #If using batch mode
#mv log.setSet log.wallFilmRegion.setSet #runApplication -s wallFilmRegion \
runApplication topoSet -dict system/wallFilmRegion.topoSet # setSet -batch wallFilmRegion.setSet
mv log.topoSet log.wallFilmRegion.topoSet
#If using dictionary mode
runApplication -s wallFilmRegion \
topoSet -dict system/wallFilmRegion.topoSet
runApplication extrudeToRegionMesh -overwrite runApplication extrudeToRegionMesh -overwrite
#runApplication setSet -region wallFilmRegion -batch createWallFilmRegionPatches.setSet #If using batch mode
#mv log.setSet log.createWallFilmRegionPatches.setSet #runApplication -s createWallFilmRegionPatches \
runApplication topoSet -region wallFilmRegion -dict system/createWallFilmRegionPatches.topoSet # setSet -region wallFilmRegion \
mv log.topoSet log.createWallFilmRegionPatches.topoSet # -batch createWallFilmRegionPatches.setSet
#If using dictionary mode
runApplication -s createWallFilmRegionPatches \
topoSet -region wallFilmRegion \
-dict system/createWallFilmRegionPatches.topoSet
runApplication createPatch -region wallFilmRegion -overwrite runApplication createPatch -region wallFilmRegion -overwrite

View File

@ -9,11 +9,11 @@ cp $FOAM_TUTORIALS/resources/geometry/blob.stl.gz constant/triSurface/
runApplication foamyHexMesh runApplication foamyHexMesh
runApplication collapseEdges -latestTime -collapseFaces runApplication -s collapseFaces \
mv log.collapseEdges log.collapseFaces collapseEdges -latestTime -collapseFaces
runApplication collapseEdges -latestTime -collapseFaceSet indirectPatchFaces runApplication -s collapseFaceSet \
mv log.collapseEdges log.collapseFaceSet collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
runApplication checkMesh -latestTime -allGeometry -allTopology runApplication checkMesh -latestTime -allGeometry -allTopology

View File

@ -12,11 +12,11 @@ runApplication decomposePar -region backgroundMeshDecomposition
runParallel foamyHexMesh runParallel foamyHexMesh
runParallel collapseEdges -latestTime -collapseFaces runParallel -s collapseFaces \
mv log.collapseEdges log.collapseFaces collapseEdges -latestTime -collapseFaces
runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces runParallel -s collapseFaceSet \
mv log.collapseEdges log.collapseFaceSet collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
runParallel checkMesh -latestTime -allTopology -allGeometry runParallel checkMesh -latestTime -allTopology -allGeometry

View File

@ -9,11 +9,11 @@ cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/
runApplication foamyHexMesh runApplication foamyHexMesh
runApplication collapseEdges -latestTime -collapseFaces runApplication -s collapseFaces \
mv log.collapseEdges log.collapseFaces collapseEdges -latestTime -collapseFaces
runApplication collapseEdges -latestTime -collapseFaceSet indirectPatchFaces runApplication -s collapseFaceSet \
mv log.collapseEdges log.collapseFaceSet collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
runApplication checkMesh -latestTime -allGeometry -allTopology runApplication checkMesh -latestTime -allGeometry -allTopology

View File

@ -13,11 +13,11 @@ runApplication decomposePar -region backgroundMeshDecomposition
runParallel foamyHexMesh runParallel foamyHexMesh
runParallel collapseEdges -latestTime -collapseFaces runParallel -s collapseFaces \
mv log.collapseEdges log.collapseFaces collapseEdges -latestTime -collapseFaces
runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces runParallel -s collapseFaceSet \
mv log.collapseEdges log.collapseFaceSet collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
runParallel checkMesh -latestTime -allTopology -allGeometry runParallel checkMesh -latestTime -allTopology -allGeometry

View File

@ -6,19 +6,14 @@ cd ${0%/*} || exit 1 # Run from this directory
intersectSurfaces() intersectSurfaces()
{ {
runApplication \
surfaceBooleanFeatures \
intersection \
"$@"
outputName1=$(basename $1) outputName1=$(basename $1)
outputName1=${outputName1%.*} outputName1=${outputName1%.*}
outputName2=$(basename $2) outputName2=$(basename $2)
outputName2=${outputName2%.*} outputName2=${outputName2%.*}
mv log.surfaceBooleanFeatures \ runApplication -s $outputName1:$outputName2 \
log.surfaceBooleanFeatures.$outputName1:$outputName2 surfaceBooleanFeatures intersection "$@"
} }
# Set application name # Set application name
@ -77,30 +72,33 @@ done
# Meshing # Meshing
\cp system/controlDict.mesh system/controlDict \cp system/controlDict.mesh system/controlDict
\cp system/collapseDict.collapseFaces system/collapseDict
runApplication blockMesh -region backgroundMeshDecomposition runApplication blockMesh -region backgroundMeshDecomposition
runApplication decomposePar -region backgroundMeshDecomposition runApplication -s backgroundMeshDecomposition \
decomposePar -region backgroundMeshDecomposition
runApplication surfaceFeatureExtract runApplication surfaceFeatureExtract
runParallel foamyHexMesh runParallel foamyHexMesh
runParallel collapseEdges -collapseFaces -latestTime runParallel -s faces \
mv log.collapseEdges log.collapseFaces collapseEdges -collapseFaces -latestTime \
-dict system/collapseDict.collapseFaces
#\cp system/collapseDict.indirectPatchFaces system/collapseDict #runParallel -s faceSet \
#runParallel collapseEdges -collapseFaceSet indirectPatchFaces -latestTime # collapseEdges -collapseFaceSet indirectPatchFaces -latestTime \
#mv log.collapseEdges log.collapseFaceSet # -dict system/collapseDict.indirectPatchFaces
runParallel checkMesh -allTopology -allGeometry -latestTime runParallel checkMesh -allTopology -allGeometry -latestTime
runApplication reconstructParMesh -latestTime runApplication reconstructParMesh -latestTime
# Copy the mesh into polyMesh and delete the 102 directory # Copy the mesh from the latest time folder into polyMesh and delete that
\cp -r 101/polyMesh constant # latest time folder
\rm -rf 101 latestTime=$(foamListTimes -latestTime)
\cp -r $latestTime/polyMesh constant
\rm -rf $latestTime
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -24,8 +24,8 @@ runApplication createPatch -overwrite
runApplication setFields runApplication setFields
# Decompose # Decompose
\rm log.decomposePar runApplication -s main \
runApplication decomposePar -force decomposePar -force
# Run # Run
runParallel $application runParallel $application

View File

@ -1,85 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object collapseDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// If on, after collapsing check the quality of the mesh. If bad faces are
// generated then redo the collapsing with stricter filtering.
controlMeshQuality on;
collapseEdgesCoeffs
{
// Edges shorter than this absolute value will be merged
minimumEdgeLength 1e-6;
// The maximum angle between two edges that share a point attached to
// no other edges
maximumMergeAngle 180;
}
collapseFacesCoeffs
{
// The initial face length factor
initialFaceLengthFactor 1;
// If the face can't be collapsed to an edge, and it has a span less than
// the target face length multiplied by this coefficient, collapse it
// to a point.
maxCollapseFaceToPointSideLengthCoeff 0.3;
// Allow early collapse of edges to a point
allowEarlyCollapseToPoint on;
// Fraction to premultiply maxCollapseFaceToPointSideLengthCoeff by if
// allowEarlyCollapseToPoint is enabled
allowEarlyCollapseCoeff 0.2;
// Defining how close to the midpoint (M) of the projected
// vertices line a projected vertex (X) can be before making this
// an invalid edge collapse
//
// X---X-g----------------M----X-----------g----X--X
//
// Only allow a collapse if all projected vertices are outwith
// guardFraction (g) of the distance form the face centre to the
// furthest vertex in the considered direction
guardFraction 0.1;
}
controlMeshQualityCoeffs
{
// Name of the dictionary that has the mesh quality coefficients used
// by motionSmoother::checkMesh
#include "meshQualityDict";
// The amount that minimumEdgeLength will be reduced by for each
// edge if that edge's collapse generates a poor quality face
edgeReductionFactor 0.5;
// The amount that initialFaceLengthFactor will be reduced by for each
// face if its collapse generates a poor quality face
faceReductionFactor 0.5;
// Maximum number of outer iterations is mesh quality checking is enabled
maximumIterations 10;
maximumSmoothingIterations 1;
maxPointErrorCount 3;
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
collapseDict.collapseFaces

View File

@ -4,28 +4,28 @@ 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
runApplication surfaceOrient \ runApplication -s cone \
constant/triSurface/cone.stl \ surfaceOrient constant/triSurface/cone.stl \
-inside '(0 -0.5 0)' \ -inside '(0 -0.5 0)' \
constant/triSurface/cone_orient.stl constant/triSurface/cone_orient.stl
mv log.surfaceOrient log.surfaceOrient.cone
runApplication surfaceOrient \ runApplication -s sphere \
constant/triSurface/sphere.stl \ surfaceOrient constant/triSurface/sphere.stl \
-inside '(0 -0.5 0)' \ -inside '(0 -0.5 0)' \
constant/triSurface/sphere_orient.stl constant/triSurface/sphere_orient.stl
mv log.surfaceOrient log.surfaceOrient.sphere
runApplication surfaceBooleanFeatures intersection \ runApplication \
surfaceBooleanFeatures intersection \
constant/triSurface/cone_orient.stl \ constant/triSurface/cone_orient.stl \
constant/triSurface/sphere_orient.stl constant/triSurface/sphere_orient.stl
runApplication foamyHexMesh runApplication foamyHexMesh
runApplication collapseEdges -latestTime -collapseFaceSet indirectPatchFaces runApplication -s collapseFaceSet \
mv log.collapseEdges log.collapseFaceSet collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
runApplication collapseEdges -latestTime -collapseFaces runApplication -s collapseFaces \
collapseEdges -latestTime -collapseFaces
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -17,16 +17,15 @@ mkdir 0
# Refine over Z, in 6 passes # Refine over Z, in 6 passes
for index in 1 2 3 4 5 6; do for index in 1 2 3 4 5 6; do
runApplication calcRadiusField runApplication -s tier$index calcRadiusField
mv log.calcRadiusField log.calcRadiusField.tier$index
runApplication topoSet -dict system/topoSetDict.tier$index runApplication -s tier$index \
mv log.topoSet log.topoSet.tier$index topoSet -dict system/topoSetDict.tier$index
## foamToVTK -cellSet tier$index ## foamToVTK -cellSet tier$index
runApplication refineMesh -dict system/refineMeshDict.tier$index -overwrite runApplication -s tier$index \
mv log.refineMesh log.refineMesh.tier$index refineMesh -dict system/refineMeshDict.tier$index -overwrite
rm -r 0/* rm -r 0/*
@ -35,17 +34,15 @@ done
# Refine over cylindrical coordinates, in 3 passes # Refine over cylindrical coordinates, in 3 passes
for index in 1 2 3; do for index in 1 2 3; do
runApplication calcRadiusField -calcDirections runApplication -s range$index calcRadiusField -calcDirections
mv log.calcRadiusField log.calcRadiusField.range$index
runApplication topoSet -dict system/topoSetDict.range$index runApplication -s range$index \
mv log.topoSet log.topoSet.range$index topoSet -dict system/topoSetDict.range$index
## foamToVTK -cellSet tier$index ## foamToVTK -cellSet tier$index
runApplication refineMesh -dict system/refineMeshDict.range$index \ runApplication -s range$index \
-overwrite refineMesh -dict system/refineMeshDict.range$index -overwrite
mv log.refineMesh log.refineMesh.range$index
rm -r 0/* rm -r 0/*

View File

@ -4,12 +4,6 @@ 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
runRefineMesh ()
{
echo "Running refineMesh on $PWD"
refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh 2>&1
}
# copy DTC hull surface from resources folder # copy DTC hull surface from resources folder
cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/ cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/
@ -17,17 +11,13 @@ runApplication surfaceFeatureExtract
runApplication blockMesh runApplication blockMesh
i=1 for i in 1 2 3 4 5 6
if [ -f log.topoSet.6 ] ; then do
i=7 runApplication -s $i \
fi topoSet -dict system/topoSetDict.${i}
while [ "$i" -lt 7 ] ; do
cp system/topoSetDict.${i} system/topoSetDict runApplication -s $i \
runApplication topoSet refineMesh -dict system/refineMeshDict -overwrite
runRefineMesh
mv log.topoSet log.topoSet.$i
mv log.refineMesh log.refineMesh.$i
i=$(expr $i + 1)
done done
runApplication snappyHexMesh -overwrite runApplication snappyHexMesh -overwrite

View File

@ -7,28 +7,15 @@ cd ${0%/*} || exit 1 # Run from this directory
# Get application name # Get application name
application=`getApplication` application=`getApplication`
runRefineMesh ()
{
echo "Running refineMesh on $PWD"
refineMesh -dict system/refineMeshDict > log.refineMesh 2>&1
}
runApplication blockMesh runApplication blockMesh
i=1 for i in 1 2
if [ -f log.topoSet ] ; then do
i=3 runApplication -s $i \
fi topoSet -dict system/topoSetDict.${i}
while [ "$i" -lt 3 ] ; do
if [ -f log.topoSet ] ; then runApplication -s $i \
mv log.topoSet log.topoSet.1 refineMesh -dict system/refineMeshDict -overwrite
fi
cp system/topoSetDict.${i} system/topoSetDict
runApplication topoSet
runRefineMesh
cp -r 1e-08/polyMesh/* constant/polyMesh
rm -rf 1e-08
i=`expr $i + 1`
done done
runApplication $application runApplication $application

View File

@ -4,12 +4,6 @@ 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
runRefineMesh ()
{
echo "Running refineMesh on $PWD"
refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh 2>&1
}
# copy DTC hull surface from resources folder # copy DTC hull surface from resources folder
cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/ cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/
@ -17,17 +11,13 @@ runApplication surfaceFeatureExtract
runApplication blockMesh runApplication blockMesh
i=1 for i in 1 2 3 4 5 6
if [ -f log.topoSet.6 ] ; then do
i=7 runApplication -s $i \
fi topoSet -dict system/topoSetDict.${i}
while [ "$i" -lt 7 ] ; do
cp system/topoSetDict.${i} system/topoSetDict runApplication -s $i \
runApplication topoSet refineMesh -dict system/refineMeshDict -overwrite
runRefineMesh
mv log.topoSet log.topoSet.$i
mv log.refineMesh log.refineMesh.$i
i=$(expr $i + 1)
done done
runApplication snappyHexMesh -overwrite runApplication snappyHexMesh -overwrite

View File

@ -25,9 +25,7 @@ runApplication renumberMesh -overwrite
# - generate face/cell sets and zones # - generate face/cell sets and zones
#runApplication setSet -batch createInletOutletSets.setSet #runApplication setSet -batch createInletOutletSets.setSet
#mv log.setSet log.createInletOutletSets.setSet
runApplication topoSet -dict system/createInletOutletSets.topoSetDict runApplication topoSet -dict system/createInletOutletSets.topoSetDict
#mv log.topoSet log.createInletOutletSets.topoSet
# - create the inlet/outlet and AMI patches # - create the inlet/outlet and AMI patches
@ -35,7 +33,7 @@ runApplication topoSet -dict system/createInletOutletSets.topoSetDict
runApplication createPatch -overwrite runApplication createPatch -overwrite
# - test by running moveDynamicMes # - test by running moveDynamicMesh
#runApplication moveDynamicMesh -checkAMI #runApplication moveDynamicMesh -checkAMI

View File

@ -8,10 +8,14 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication` application=`getApplication`
runApplication blockMesh runApplication blockMesh
runApplication topoSet
mv log.topoSet log.topoSet.1 runApplication -s 1 topoSet
runApplication subsetMesh -overwrite c0 -patch floatingObject runApplication subsetMesh -overwrite c0 -patch floatingObject
runApplication topoSet -dict system/topoSetDict-selectBottom
runApplication -s selectBottom \
topoSet -dict system/topoSetDict-selectBottom
runApplication createPatch -overwrite runApplication createPatch -overwrite
cp -r 0.org 0 > /dev/null 2>&1 cp -r 0.org 0 > /dev/null 2>&1