Commit 499c221d authored by Henry Weller's avatar Henry Weller
Browse files

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
parent 37157f43
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -80,6 +80,7 @@ int main(int argc, char *argv[])
"Collapse faces that are in the supplied face set"
);
#include "addDictOption.H"
#include "addOverwriteOption.H"
#include "setRootCase.H"
#include "createTime.H"
......@@ -91,6 +92,13 @@ int main(int argc, char *argv[])
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 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();
// newMesh will be empty until it is filtered
......@@ -177,7 +188,10 @@ int main(int argc, char *argv[])
if (collapseFaceSet)
{
meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority));
meshFilterPtr.reset
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);
polyMeshFilter& meshFilter = meshFilterPtr();
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
......@@ -198,7 +212,10 @@ int main(int argc, char *argv[])
if (collapseFaces)
{
meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority));
meshFilterPtr.reset
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);
polyMeshFilter& meshFilter = meshFilterPtr();
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
......
......@@ -55,35 +55,43 @@ runApplication()
APP_RUN=
LOG_IGNORE=false
LOG_APPEND=false
LOG_SUFFIX=
# Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
key="$1"
case "$key" in
-append)
-append|-a)
LOG_IGNORE=true
LOG_APPEND=true
;;
-overwrite)
-overwrite|-o)
LOG_IGNORE=true
;;
-suffix|-s)
LOG_SUFFIX=".$2"
shift
;;
*)
APP_RUN="$key"
APP_NAME="${key##*/}"
LOG_SUFFIX="${APP_NAME}${LOG_SUFFIX}"
;;
esac
shift
shift
done
if [ -f log.$APP_NAME ] && [ "$LOG_IGNORE" = "false" ]
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
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
echo "Running $APP_RUN on $PWD"
if [ "$LOG_APPEND" = "true" ]; then
$APP_RUN "$@" >> log.$APP_NAME 2>&1
$APP_RUN "$@" >> log.$LOG_SUFFIX 2>&1
else
$APP_RUN "$@" > log.$APP_NAME 2>&1
$APP_RUN "$@" > log.$LOG_SUFFIX 2>&1
fi
fi
}
......@@ -93,40 +101,48 @@ runParallel()
APP_RUN=
LOG_IGNORE=false
LOG_APPEND=false
LOG_SUFFIX=
nProcs=$(getNumberOfProcessors)
# Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
key="$1"
case "$key" in
-append)
-append|-a)
LOG_IGNORE=true
LOG_APPEND=true
;;
-overwrite)
-overwrite|-o)
LOG_IGNORE=true
;;
-np)
-suffix|-s)
LOG_SUFFIX=".$2"
shift
;;
-np|-n)
nProcs="$2"
shift
;;
*)
APP_RUN="$key"
APP_NAME="${key##*/}"
LOG_SUFFIX="${APP_NAME}${LOG_SUFFIX}"
;;
esac
shift
shift
done
if [ -f log.$APP_NAME ] && [ "$LOG_IGNORE" = "false" ]
if [ -f log.$SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
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
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
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
( 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
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -946,6 +946,24 @@ Foam::polyMeshFilter::polyMeshFilter
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 * * * * * * * * * * * * * * * //
......
......@@ -207,6 +207,14 @@ public:
//- Construct from fvMesh and a label list of point priorities
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
~polyMeshFilter();
......@@ -257,7 +265,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "polyMeshFilterTemplates.C"
# include "polyMeshFilterTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -38,7 +38,7 @@ cd ${0%/*} || exit 1 # Run from this directory
logReport()
{
caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
app=`echo $1 | sed s/"\(.*\)\."/""/g`
app=`echo $1 | sed s/"\(.*\)log\."/""/g`
appAndCase="Application $app - case $caseName"
fatalError=`grep "FOAM FATAL" $1`
......
......@@ -9,26 +9,31 @@ application=`getApplication`
runApplication blockMesh
runApplication topoSet -dict system/cRefine.topoSetDict
runApplication -s cRefine \
topoSet -dict system/cRefine.topoSetDict
runApplication refineMesh -overwrite -dict system/refineMeshDict
rm log.topoSet
runApplication topoSet -dict system/f.topoSetDict
runApplication -s f \
topoSet -dict system/f.topoSetDict
# create the pyrolysis region.
runApplication extrudeToRegionMesh -overwrite
rm log.topoSet
runApplication topoSet -dict system/fBurner.topoSetDict
runApplication -s fBurner \
topoSet -dict system/fBurner.topoSetDict
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`
......
......@@ -18,7 +18,7 @@ done
for i in bottomWater topAir heater leftSolid rightSolid
do
changeDictionary -region $i > log.changeDictionary.$i 2>&1
runApplication -s $i changeDictionary -region $i
done
......
......@@ -22,7 +22,7 @@ done
for i in bottomAir topAir heater leftSolid rightSolid
do
changeDictionary -region $i > log.changeDictionary.$i 2>&1
runApplication -s $i changeDictionary -region $i
done
......
......@@ -7,16 +7,10 @@ cd ${0%/*} || exit 1 # Run from this directory
./Allrun.pre
runApplication decomposePar -region air
mv log.decomposePar log.decomposePar.air
runApplication decomposePar -region porous
mv log.decomposePar log.decomposePar.porous
runApplication -s air decomposePar -region air
runApplication -s porous decomposePar -region porous
runParallel $(getApplication)
runApplication reconstructPar -latestTime -region air
mv log.reconstructPar log.reconstructPar.air
runApplication reconstructPar -latestTime -region porous
mv log.reconstructPar log.reconstructPar.porous
runApplication -s air reconstructPar -latestTime -region air
runApplication -s porous reconstructPar -latestTime -region porous
......@@ -6,20 +6,18 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions
#create meshes
runApplication blockMesh -region air
mv log.blockMesh log.blockMesh.air
runApplication blockMesh -region porous
mv log.blockMesh log.blockMesh.porous
runApplication -s air blockMesh -region air
runApplication -s porous blockMesh -region porous
# create rotor blades in air region
runApplication topoSet -region air -dict system/topoSetDict.1
mv log.topoSet log.topoSet.air.1
runApplication -s air.1 \
topoSet -region air -dict system/topoSetDict.1
runApplication createBaffles -region air -overwrite
# create rotor zone in air region for MRF
runApplication topoSet -region air -dict system/topoSetDict.2
mv log.topoSet log.topoSet.air.2
runApplication -s air.2 \
topoSet -region air -dict system/topoSetDict.2
rm -rf constant/air/polyMesh/sets
......
......@@ -15,13 +15,15 @@ cd ${0%/*} || exit 1 # Run from this directory
# Agglomerate patch faces
for i in bottomAir topAir
do
faceAgglomerate -region $i -dict constant/viewFactorsDict > log.faceAgglomerate.$i 2>&1
runApplication -s $i \
faceAgglomerate -region $i -dict constant/viewFactorsDict
done
# Generate view factors
for i in bottomAir topAir
do
viewFactorsGen -region $i > log.viewFactorsGen.$i 2>&1
runApplication -s $i \
viewFactorsGen -region $i
done
runApplication `getApplication`
......
......@@ -18,13 +18,15 @@ runApplication decomposePar -allRegions
# Agglomerate patch faces
for i in bottomAir topAir
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
# Generate view factors
for i in bottomAir topAir
do
mpirun -np 4 viewFactorsGen -region $i -parallel > log.viewFactorsGen.$i 2>&1
runParallel -s $i -np 4 \
viewFactorsGen -region $i
done
# Run
......
......@@ -17,7 +17,7 @@ done
for i in bottomAir topAir heater leftSolid rightSolid
do
changeDictionary -region $i > log.changeDictionary.$i 2>&1
runApplication -s $i changeDictionary -region $i
done
......
......@@ -17,15 +17,11 @@ do
sed "s/XXX/$e/g" constant/transportProperties.template \
> constant/transportProperties
runApplication `getApplication`
mv log.boundaryFoam log.boundaryFoam_$e
runApplication -s $e `getApplication`
# extract y+, U+
# note: both must be added to foamLog.db
runApplication foamLog log.boundaryFoam_$e
mv log.foamLog log.foamLog_$e
runApplication -s $e foamLog log.boundaryFoam.$e
if [ -e logs/yPlus_0 ]
then
......
......@@ -9,13 +9,14 @@ runApplication surfaceFeatureExtract
runApplication foamyHexMesh
# Collapse only patch faces from incomplete conformation
cp system/collapseDict.indirectPatchFaces system/collapseDict
runApplication collapseEdges -collapseFaceSet indirectPatchFaces -latestTime -overwrite
mv log.collapseEdges log.collapseEdges-indirectPatchFaces
runApplication -s indirectPatchFaces \
collapseEdges -collapseFaceSet indirectPatchFaces -latestTime -overwrite \
-dict system/collapseDict.indirectPatchFaces
# Collapse small edges and sliver faces
cp system/collapseDict.collapseFaces system/collapseDict
runApplication collapseEdges -collapseFaces -latestTime -overwrite
runApplication -s collapseFaces \
collapseEdges -collapseFaces -latestTime -overwrite \
-dict system/collapseDict.collapseFaces
runApplication checkMesh -allTopology -allGeometry -latestTime
......
......@@ -5,7 +5,6 @@ cp -rf 0.org 0
runApplication blockMesh
#runApplication setSet -batch wallFilmRegion.setSet
#mv log.setSet log.wallFilmRegion.setSet
runApplication topoSet
runApplication extrudeToRegionMesh -overwrite
......
......@@ -8,15 +8,11 @@ cd ${0%/*} || exit 1 # Run from this directory
application=`getApplication`
runApplication decomposePar -region wallFilmRegion
mv log.decomposePar log.decomposePar.wallFilmRegion
runApplication decomposePar
mv log.decomposePar log.decomposePar.primaryRegion
runApplication -s wallFilmRegion decomposePar -region wallFilmRegion
runApplication -s primaryRegion decomposePar
runParallel $application
runApplication reconstructPar -region wallFilmRegion
mv log.reconstructPar log.reconstructPar.wallFilmRegion
runApplication reconstructPar
mv log.reconstructPar log.reconstructPar.primaryRegion
runApplication -s wallFilmRegion reconstructPar -region wallFilmRegion
runApplication -s primaryRegion reconstructPar
......@@ -16,8 +16,7 @@ runApplication topoSet
runApplication subsetMesh c0 -patch wallFilm -overwrite
# split the obstacle patches into cube[1-6]_patch[1-6]
echo "running patchifyObstacles"
./patchifyObstacles > log.patchifyObstacles 2>&1
runApplication ./patchifyObstacles
# Create the wall film region via extrusion
runApplication extrudeToRegionMesh -overwrite
......
......@@ -6,7 +6,6 @@ cp -rf 0.org 0
runApplication blockMesh
#runApplication setSet -batch wallFilmRegion.setSet
#mv log.setSet log.wallFilmRegion.setSet
runApplication topoSet -dict system/wallFilmRegion.topoSet
runApplication extrudeToRegionMesh -overwrite
......
......@@ -5,17 +5,25 @@ cp -rf 0.org 0
runApplication blockMesh
#runApplication setSet -batch wallFilmRegion.setSet
#mv log.setSet log.wallFilmRegion.setSet
runApplication topoSet -dict system/wallFilmRegion.topoSet
mv log.topoSet log.wallFilmRegion.topoSet
#If using batch mode
#runApplication -s wallFilmRegion \
# setSet -batch wallFilmRegion.setSet
#If using dictionary mode
runApplication -s wallFilmRegion \
topoSet -dict system/wallFilmRegion.topoSet
runApplication extrudeToRegionMesh -overwrite
#runApplication setSet -region wallFilmRegion -batch createWallFilmRegionPatches.setSet
#mv log.setSet log.createWallFilmRegionPatches.setSet
runApplication topoSet -region wallFilmRegion -dict system/createWallFilmRegionPatches.topoSet
mv log.topoSet log.createWallFilmRegionPatches.topoSet
#If using batch mode
#runApplication -s createWallFilmRegionPatches \
# setSet -region wallFilmRegion \
# -batch createWallFilmRegionPatches.setSet
#If using dictionary mode
runApplication -s createWallFilmRegionPatches \
topoSet -region wallFilmRegion \
-dict system/createWallFilmRegionPatches.topoSet
runApplication createPatch -region wallFilmRegion -overwrite
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment