mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/repositories/OpenFOAM-dev
This commit is contained in:
@ -1121,6 +1121,38 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
// Refinement parameters
|
||||
const refinementParameters refineParams(refineDict);
|
||||
|
||||
// Snap parameters
|
||||
const snapParameters snapParams(snapDict);
|
||||
|
||||
|
||||
|
||||
// Add all the cellZones and faceZones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// 1. cellZones relating to surface (faceZones added later)
|
||||
|
||||
const labelList namedSurfaces
|
||||
(
|
||||
surfaceZonesInfo::getNamedSurfaces(surfaces.surfZones())
|
||||
);
|
||||
|
||||
labelList surfaceToCellZone = surfaceZonesInfo::addCellZonesToMesh
|
||||
(
|
||||
surfaces.surfZones(),
|
||||
namedSurfaces,
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
// 2. cellZones relating to locations
|
||||
|
||||
refineParams.addCellZonesToMesh(mesh);
|
||||
|
||||
|
||||
|
||||
// Add all the surface regions as patches
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -1128,6 +1160,8 @@ int main(int argc, char *argv[])
|
||||
// (faceZone surfaces)
|
||||
labelList globalToMasterPatch;
|
||||
labelList globalToSlavePatch;
|
||||
|
||||
|
||||
{
|
||||
Info<< nl
|
||||
<< "Adding patches for surface regions" << nl
|
||||
@ -1148,6 +1182,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const labelList& surfaceGeometry = surfaces.surfaces();
|
||||
const PtrList<dictionary>& surfacePatchInfo = surfaces.patchInfo();
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
forAll(surfaceGeometry, surfI)
|
||||
{
|
||||
@ -1157,7 +1192,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< surfaces.names()[surfI] << ':' << nl << nl;
|
||||
|
||||
if (surfaces.surfZones()[surfI].faceZoneName().empty())
|
||||
const word& fzName = surfaces.surfZones()[surfI].faceZoneName();
|
||||
|
||||
if (fzName.empty())
|
||||
{
|
||||
// 'Normal' surface
|
||||
forAll(regNames, i)
|
||||
@ -1188,7 +1225,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< setf(ios_base::left)
|
||||
<< setw(6) << patchI
|
||||
<< setw(20) << mesh.boundaryMesh()[patchI].type()
|
||||
<< setw(20) << pbm[patchI].type()
|
||||
<< setw(30) << regNames[i] << nl;
|
||||
|
||||
globalToMasterPatch[globalRegionI] = patchI;
|
||||
@ -1228,7 +1265,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< setf(ios_base::left)
|
||||
<< setw(6) << patchI
|
||||
<< setw(20) << mesh.boundaryMesh()[patchI].type()
|
||||
<< setw(20) << pbm[patchI].type()
|
||||
<< setw(30) << regNames[i] << nl;
|
||||
|
||||
globalToMasterPatch[globalRegionI] = patchI;
|
||||
@ -1260,12 +1297,27 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< setf(ios_base::left)
|
||||
<< setw(6) << patchI
|
||||
<< setw(20) << mesh.boundaryMesh()[patchI].type()
|
||||
<< setw(20) << pbm[patchI].type()
|
||||
<< setw(30) << slaveName << nl;
|
||||
|
||||
globalToSlavePatch[globalRegionI] = patchI;
|
||||
}
|
||||
}
|
||||
|
||||
// For now: have single faceZone per surface. Use first
|
||||
// region in surface for patch for zoneing
|
||||
if (regNames.size())
|
||||
{
|
||||
label globalRegionI = surfaces.globalRegion(surfI, 0);
|
||||
|
||||
meshRefiner.addFaceZone
|
||||
(
|
||||
fzName,
|
||||
pbm[globalToMasterPatch[globalRegionI]].name(),
|
||||
pbm[globalToSlavePatch[globalRegionI]].name(),
|
||||
surfaces.surfZones()[surfI].faceType()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl;
|
||||
@ -1275,6 +1327,73 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Add all information for all the remaining faceZones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
wordPairHashTable zonesToFaceZone;
|
||||
forAll(mesh.faceZones(), zoneI)
|
||||
{
|
||||
const word& fzName = mesh.faceZones()[zoneI].name();
|
||||
|
||||
label mpI, spI;
|
||||
surfaceZonesInfo::faceZoneType fzType;
|
||||
bool hasInfo = meshRefiner.getFaceZoneInfo(fzName, mpI, spI, fzType);
|
||||
|
||||
if (!hasInfo)
|
||||
{
|
||||
// faceZone does not originate from a surface but presumably
|
||||
// from a cellZone pair instead
|
||||
string::size_type i = fzName.find("_to_");
|
||||
if (i != string::npos)
|
||||
{
|
||||
word cz0 = fzName.substr(0, i);
|
||||
word cz1 = fzName.substr(i+4, fzName.size()-i+4);
|
||||
zonesToFaceZone.insert(Pair<word>(cz0, cz1), fzName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (zonesToFaceZone.size())
|
||||
{
|
||||
autoRefineDriver::addFaceZones
|
||||
(
|
||||
meshRefiner,
|
||||
refineParams,
|
||||
zonesToFaceZone
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Re-do intersections on meshed boundaries since they use an extrapolated
|
||||
// other side
|
||||
{
|
||||
const labelList adaptPatchIDs(meshRefiner.meshedPatches());
|
||||
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
label nFaces = 0;
|
||||
forAll(adaptPatchIDs, i)
|
||||
{
|
||||
nFaces += pbm[adaptPatchIDs[i]].size();
|
||||
}
|
||||
|
||||
labelList faceLabels(nFaces);
|
||||
nFaces = 0;
|
||||
forAll(adaptPatchIDs, i)
|
||||
{
|
||||
const polyPatch& pp = pbm[adaptPatchIDs[i]];
|
||||
forAll(pp, i)
|
||||
{
|
||||
faceLabels[nFaces++] = pp.start()+i;
|
||||
}
|
||||
}
|
||||
meshRefiner.updateIntersections(faceLabels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Parallel
|
||||
// ~~~~~~~~
|
||||
|
||||
@ -1312,14 +1431,13 @@ int main(int argc, char *argv[])
|
||||
const Switch wantSnap(meshDict.lookup("snap"));
|
||||
const Switch wantLayers(meshDict.lookup("addLayers"));
|
||||
|
||||
// Refinement parameters
|
||||
const refinementParameters refineParams(refineDict);
|
||||
const Switch keepHex(meshDict.lookupOrDefault("keepHex", false));
|
||||
|
||||
// Snap parameters
|
||||
const snapParameters snapParams(snapDict);
|
||||
|
||||
// Layer addition parameters
|
||||
const layerParameters layerParams(layerDict, mesh.boundaryMesh());
|
||||
if (keepHex)
|
||||
{
|
||||
Info<< "Avoiding generating non-(split)hex cells." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
if (wantRefine)
|
||||
@ -1348,6 +1466,7 @@ int main(int argc, char *argv[])
|
||||
refineParams,
|
||||
snapParams,
|
||||
refineParams.handleSnapProblems(),
|
||||
keepHex, // keepHex
|
||||
motionDict
|
||||
);
|
||||
|
||||
@ -1387,6 +1506,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
snapDict,
|
||||
motionDict,
|
||||
!keepHex, // mergePatchFaces
|
||||
curvature,
|
||||
planarAngle,
|
||||
snapParams
|
||||
@ -1408,6 +1528,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
cpuTime timer;
|
||||
|
||||
// Layer addition parameters
|
||||
const layerParameters layerParams(layerDict, mesh.boundaryMesh());
|
||||
|
||||
autoLayerDriver layerDriver
|
||||
(
|
||||
meshRefiner,
|
||||
@ -1433,6 +1556,7 @@ int main(int argc, char *argv[])
|
||||
layerDict,
|
||||
motionDict,
|
||||
layerParams,
|
||||
!keepHex, //mergePatchFaces
|
||||
preBalance,
|
||||
decomposer,
|
||||
distributor
|
||||
|
||||
@ -71,6 +71,12 @@ geometry
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Optional: avoid patch-face merging. Allows mesh to be used for
|
||||
// refinement/unrefinement
|
||||
//keepHex true;
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
{
|
||||
@ -177,7 +183,7 @@ castellatedMeshControls
|
||||
// how to select the cells that are in the cellZone
|
||||
// (inside / outside / specified insidePoint)
|
||||
// The orientation of the faceZone is
|
||||
// - if on cellZone(s) : point out of (maximum) cellZone
|
||||
// - if on cellZone(s) : point out of (minimum) cellZone
|
||||
// - if freestanding : oriented according to surface
|
||||
|
||||
//faceZone sphere;
|
||||
@ -249,17 +255,70 @@ castellatedMeshControls
|
||||
|
||||
// After refinement patches get added for all refinementSurfaces and
|
||||
// all cells intersecting the surfaces get put into these patches. The
|
||||
// section reachable from the locationInMesh is kept.
|
||||
// section reachable from the location(s)InMesh is kept.
|
||||
// NOTE: This point should never be on a face, always inside a cell, even
|
||||
// after refinement.
|
||||
locationInMesh (5 0.28 0.43);
|
||||
//
|
||||
// There are two different ways of specifying the regions to keep:
|
||||
// 1. a single locationInMesh. All the 'zoned' surfaces are marked as such
|
||||
// in the refinementSurfaces with the faceZone and cellZone keywords.
|
||||
//
|
||||
// or
|
||||
//
|
||||
// 2. multiple locationsInMesh, with per location the name of the cellZone.
|
||||
// This uses walking to determine zones and automatically creates
|
||||
// faceZones on the outside of cellZones.
|
||||
|
||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||
// are only on the boundary of corresponding cellZones or also allow
|
||||
// free-standing zone faces and zone faces on boundaries. Not used if
|
||||
// there are no faceZones.
|
||||
allowFreeStandingZoneFaces true;
|
||||
|
||||
// Ad 1. Specify a single location and how to treat faces inbetween
|
||||
// cellZones
|
||||
locationInMesh (5 0.28 0.43);
|
||||
|
||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||
// are only on the boundary of corresponding cellZones or also allow
|
||||
// free-standing zone faces. Not used if there are no faceZones.
|
||||
allowFreeStandingZoneFaces true;
|
||||
|
||||
|
||||
|
||||
// 2. Specify multiple locations with optional cellZones for the
|
||||
// regions. faceZones are automatically constructed from the
|
||||
// names of the cellZones: <cellZoneA> _to_ <cellZoneB>
|
||||
// where the cellZoneA is the lowest numbered cellZone (non-cellZone
|
||||
// cells are in a special region called "none" which is always
|
||||
// last).
|
||||
|
||||
locationsInMesh
|
||||
(
|
||||
((-0.09 -0.039 -0.049) bottomAir) // cellZone 0
|
||||
((-0.09 0.009 -0.049) topAir) // cellZone 1
|
||||
((-0.09 0.001 -0.049) leftSolid) // cellZone 2
|
||||
((0.02 0.001 -0.049) rightSolid) // cellZone 3
|
||||
((-0.001 -0.039 0.0015) heater) // cellZone 4
|
||||
);
|
||||
|
||||
// Per synthesised faceZone name the faceType and type of baffles to
|
||||
// create
|
||||
faceZoneControls
|
||||
{
|
||||
bottomAir_to_heater
|
||||
{
|
||||
// Optional specification of patch type (default is wall). No
|
||||
// constraint types (cyclic, symmetry) etc. are allowed.
|
||||
patchInfo
|
||||
{
|
||||
type patch;
|
||||
inGroups (patchPatches);
|
||||
}
|
||||
faceType baffle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Optional locations that should not be reachable from
|
||||
// location(s)InMesh
|
||||
locationsOutsideMesh ((100 100 100));
|
||||
|
||||
// Optional: do not remove cells likely to give snapping problems
|
||||
// handleSnapProblems false;
|
||||
@ -288,6 +347,11 @@ snapControls
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 5;
|
||||
|
||||
// (wip) disable snapping to opposite near surfaces (revert to 22x
|
||||
// behaviour)
|
||||
// detectNearSurfacesSnap false;
|
||||
|
||||
|
||||
// Feature snapping
|
||||
|
||||
// Number of feature edge snapping iterations.
|
||||
@ -306,8 +370,28 @@ snapControls
|
||||
multiRegionFeatureSnap false;
|
||||
|
||||
|
||||
// wip: disable snapping to opposite near surfaces (revert to 22x behaviour)
|
||||
// detectNearSurfacesSnap false;
|
||||
//- When to run face splitting (never at first iteration, always
|
||||
// at last iteration). Is interval. Default -1 (disabled)
|
||||
//nFaceSplitInterval 5;
|
||||
|
||||
|
||||
// (wip) Optional for explicit feature snapping:
|
||||
//- Detect baffle edges. Default is true.
|
||||
//detectBaffles false;
|
||||
//- Erase attraction close to feature point. Default is false.
|
||||
//releasePoints true;
|
||||
//- Walk along feature edges, adding missing ones. Default is true.
|
||||
//stringFeatures false;
|
||||
//- If diagonal attraction also attract other face points. Default is
|
||||
// false
|
||||
//avoidDiagonal true;
|
||||
//- When splitting what concave faces to leave intact. Default is 45
|
||||
// degrees.
|
||||
//concaveAngle 30;
|
||||
//- When splitting the minimum area ratio of faces. If face split
|
||||
// causes ratio of area less than this do not split. Default is 0.3
|
||||
//minAreaRatio 0.3;
|
||||
|
||||
}
|
||||
|
||||
// Settings for the layer addition.
|
||||
@ -348,7 +432,7 @@ addLayersControls
|
||||
// cannot be above minThickness do not add layer.
|
||||
// If relativeSizes this is relative to undistorted size of cell
|
||||
// outside layer..
|
||||
minThickness 0.25;
|
||||
minThickness 0.1;
|
||||
|
||||
|
||||
// Per final patch (so not geometry!) the layer information
|
||||
@ -395,6 +479,13 @@ addLayersControls
|
||||
// are perpendicular
|
||||
featureAngle 130;
|
||||
|
||||
// When to merge patch faces. Default is 0.5*featureAngle
|
||||
//mergePatchFacesAngle 45;
|
||||
|
||||
// Do not extrude around sharp edge if not both faces are extruded.
|
||||
// Default is 0.5*featureAngle. Set to -180 always attempt extrusion
|
||||
layerTerminationAngle -180;
|
||||
|
||||
// Stop layer growth on highly warped cells
|
||||
maxFaceThicknessRatio 0.5;
|
||||
|
||||
@ -431,8 +522,10 @@ addLayersControls
|
||||
// default is 0.
|
||||
//nSmoothDisplacement 90;
|
||||
|
||||
// (wip)Optional: do not extrude a point if none of the surrounding points is
|
||||
// not extruded. Default is false.
|
||||
// (wip)Optional: do not extrude any point where
|
||||
// (false) : all surrounding faces are not fully extruded
|
||||
// (true) : all surrounding points are not extruded
|
||||
// Default is false.
|
||||
//detectExtrusionIsland true;
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -40,28 +40,46 @@ getApplication()
|
||||
|
||||
runApplication()
|
||||
{
|
||||
APP_LOGFILE=''
|
||||
if [ "$1" = "-l" ]
|
||||
then
|
||||
APP_LOGFILE=$2
|
||||
shift 2
|
||||
fi
|
||||
|
||||
APP_RUN=$1
|
||||
APP_NAME=${1##*/}
|
||||
shift
|
||||
|
||||
if [ -f log.$APP_NAME ]
|
||||
APP_LOGFILE=${APP_LOGFILE:="log.$APP_NAME"}
|
||||
|
||||
if [ -f $APP_LOGFILE ]
|
||||
then
|
||||
echo "$APP_NAME already run on $PWD: remove log file to re-run"
|
||||
echo "$APP_NAME already run on $PWD: remove log file $APP_LOGFILE to re-run"
|
||||
else
|
||||
echo "Running $APP_RUN on $PWD"
|
||||
$APP_RUN "$@" > log.$APP_NAME 2>&1
|
||||
$APP_RUN "$@" > $APP_LOGFILE 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
runParallel()
|
||||
{
|
||||
APP_LOGFILE=''
|
||||
if [ "$1" = "-l" ]
|
||||
then
|
||||
APP_LOGFILE=$2
|
||||
shift 2
|
||||
fi
|
||||
|
||||
APP_RUN=$1
|
||||
APP_NAME=${1##*/}
|
||||
shift
|
||||
|
||||
if [ -f log.$APP_NAME ]
|
||||
APP_LOGFILE=${APP_LOGFILE:="log.$APP_NAME"}
|
||||
|
||||
if [ -f $APP_LOGFILE ]
|
||||
then
|
||||
echo "$APP_NAME already run on $PWD: remove log file to re-run"
|
||||
echo "$APP_NAME already run on $PWD: remove log file $APP_LOGFILE to re-run"
|
||||
else
|
||||
nProcs=$1
|
||||
shift
|
||||
@ -70,9 +88,9 @@ runParallel()
|
||||
#if [ "$WM_SCHEDULER" ]
|
||||
#then
|
||||
# echo "$PWD: $WM_SCHEDULER -np $nProcs" 1>&2
|
||||
# $WM_SCHEDULER -np $nProcs "( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$APP_NAME 2>&1 )"
|
||||
# $WM_SCHEDULER -np $nProcs "( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > $APP_LOGFILE 2>&1 )"
|
||||
#else
|
||||
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$APP_NAME 2>&1 )
|
||||
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > $APP_LOGFILE 2>&1 )
|
||||
#fi
|
||||
fi
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -109,7 +109,6 @@ private:
|
||||
const labelList globalToSlavePatch_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
// Layers
|
||||
@ -371,6 +370,14 @@ private:
|
||||
const List<extrudeMode>& extrudeStatus
|
||||
);
|
||||
|
||||
//- After adding to mesh get the new baffles
|
||||
static List<labelPair> getBafflesOnAddedMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& newToOldFaces,
|
||||
const List<labelPair>& baffles
|
||||
);
|
||||
|
||||
//- Collect layer faces and layer cells into bools
|
||||
// for ease of handling
|
||||
static void getLayerCellsFaces
|
||||
@ -394,6 +401,15 @@ private:
|
||||
) const;
|
||||
|
||||
//- Write cellSet,faceSet for layers
|
||||
bool writeLayerSets
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelList& cellNLayers,
|
||||
const scalarField& faceRealThickness
|
||||
) const;
|
||||
|
||||
//- Write volFields,cellSet,faceSet for layers depending
|
||||
// on write level
|
||||
bool writeLayerData
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
@ -596,6 +612,7 @@ public:
|
||||
const dictionary& shrinkDict,
|
||||
const dictionary& motionDict,
|
||||
const layerParameters& layerParams,
|
||||
const bool mergePatchFaces, // merging patch faces
|
||||
const bool preBalance, // balance before adding?
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor
|
||||
|
||||
@ -37,6 +37,7 @@ License
|
||||
#include "unitConversion.H"
|
||||
#include "snapParameters.H"
|
||||
#include "localPointRegion.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -94,7 +95,7 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints(),
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.curvature(),
|
||||
refineParams.planarAngle(),
|
||||
|
||||
@ -207,7 +208,7 @@ Foam::label Foam::autoRefineDriver::surfaceOnlyRefine
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints(),
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.curvature(),
|
||||
refineParams.planarAngle(),
|
||||
|
||||
@ -341,7 +342,7 @@ Foam::label Foam::autoRefineDriver::gapOnlyRefine
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints(),
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.curvature(),
|
||||
refineParams.planarAngle(),
|
||||
|
||||
@ -692,7 +693,9 @@ void Foam::autoRefineDriver::removeInsideCells
|
||||
nBufferLayers, // nBufferLayers
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
);
|
||||
|
||||
if (debug&meshRefinement::MESH)
|
||||
@ -753,7 +756,7 @@ Foam::label Foam::autoRefineDriver::shellRefine
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints(),
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.curvature(),
|
||||
refineParams.planarAngle(),
|
||||
|
||||
@ -921,14 +924,17 @@ void Foam::autoRefineDriver::baffleAndSplitMesh
|
||||
const_cast<Time&>(mesh.time()),
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::zonify
|
||||
(
|
||||
const refinementParameters& refineParams
|
||||
const refinementParameters& refineParams,
|
||||
wordPairHashTable& zonesToFaceZone
|
||||
)
|
||||
{
|
||||
// Mesh is at its finest. Do zoning
|
||||
@ -940,7 +946,11 @@ void Foam::autoRefineDriver::zonify
|
||||
const labelList namedSurfaces =
|
||||
surfaceZonesInfo::getNamedSurfaces(meshRefiner_.surfaces().surfZones());
|
||||
|
||||
if (namedSurfaces.size())
|
||||
if
|
||||
(
|
||||
namedSurfaces.size()
|
||||
|| refineParams.zonesInMesh().size()
|
||||
)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Introducing zones for interfaces" << nl
|
||||
@ -956,8 +966,10 @@ void Foam::autoRefineDriver::zonify
|
||||
|
||||
meshRefiner_.zonify
|
||||
(
|
||||
refineParams.keepPoints()[0],
|
||||
refineParams.allowFreeStandingZoneFaces()
|
||||
refineParams.allowFreeStandingZoneFaces(),
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
zonesToFaceZone
|
||||
);
|
||||
|
||||
if (debug&meshRefinement::MESH)
|
||||
@ -1023,7 +1035,9 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
||||
const_cast<Time&>(mesh.time()),
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
);
|
||||
|
||||
if (debug)
|
||||
@ -1061,7 +1075,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
||||
(
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
);
|
||||
|
||||
if (debug)
|
||||
@ -1092,8 +1107,82 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::addFaceZones
|
||||
(
|
||||
meshRefinement& meshRefiner,
|
||||
const refinementParameters& refineParams,
|
||||
const wordPairHashTable& zonesToFaceZone
|
||||
)
|
||||
{
|
||||
if (zonesToFaceZone.size())
|
||||
{
|
||||
Info<< nl
|
||||
<< "Adding patches for inter-region zones" << nl
|
||||
<< "-------------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
Info<< setf(ios_base::left)
|
||||
<< setw(6) << "Patch"
|
||||
<< setw(20) << "Type"
|
||||
<< setw(30) << "Name"
|
||||
<< setw(30) << "FaceZone"
|
||||
<< setw(10) << "FaceType"
|
||||
<< nl
|
||||
<< setw(6) << "-----"
|
||||
<< setw(20) << "----"
|
||||
<< setw(30) << "----"
|
||||
<< setw(30) << "--------"
|
||||
<< setw(10) << "--------"
|
||||
<< endl;
|
||||
|
||||
const polyMesh& mesh = meshRefiner.mesh();
|
||||
|
||||
// Add patches for added inter-region faceZones
|
||||
forAllConstIter(wordPairHashTable, zonesToFaceZone, iter)
|
||||
{
|
||||
const Pair<word>& czNames = iter.key();
|
||||
const word& fzName = iter();
|
||||
|
||||
// Get any user-defined faceZone data
|
||||
surfaceZonesInfo::faceZoneType fzType;
|
||||
dictionary patchInfo = refineParams.getZoneInfo(fzName, fzType);
|
||||
|
||||
const word& masterName = fzName;
|
||||
//const word slaveName = fzName + "_slave";
|
||||
const word slaveName = czNames.second() + "_to_" + czNames.first();
|
||||
|
||||
label mpI = meshRefiner.addMeshedPatch(masterName, patchInfo);
|
||||
|
||||
Info<< setf(ios_base::left)
|
||||
<< setw(6) << mpI
|
||||
<< setw(20) << mesh.boundaryMesh()[mpI].type()
|
||||
<< setw(30) << masterName
|
||||
<< setw(30) << fzName
|
||||
<< setw(10) << surfaceZonesInfo::faceZoneTypeNames[fzType]
|
||||
<< nl;
|
||||
|
||||
|
||||
label slI = meshRefiner.addMeshedPatch(slaveName, patchInfo);
|
||||
|
||||
Info<< setf(ios_base::left)
|
||||
<< setw(6) << slI
|
||||
<< setw(20) << mesh.boundaryMesh()[slI].type()
|
||||
<< setw(30) << slaveName
|
||||
<< setw(30) << fzName
|
||||
<< setw(10) << surfaceZonesInfo::faceZoneTypeNames[fzType]
|
||||
<< nl;
|
||||
|
||||
meshRefiner.addFaceZone(fzName, masterName, slaveName, fzType);
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::mergePatchFaces
|
||||
(
|
||||
const bool keepHex,
|
||||
const refinementParameters& refineParams,
|
||||
const dictionary& motionDict
|
||||
)
|
||||
@ -1105,14 +1194,27 @@ void Foam::autoRefineDriver::mergePatchFaces
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
meshRefiner_.mergePatchFacesUndo
|
||||
(
|
||||
Foam::cos(degToRad(45.0)),
|
||||
Foam::cos(degToRad(45.0)),
|
||||
meshRefiner_.meshedPatches(),
|
||||
motionDict,
|
||||
labelList(mesh.nFaces(), -1)
|
||||
);
|
||||
if (keepHex)
|
||||
{
|
||||
meshRefiner_.mergePatchFaces
|
||||
(
|
||||
Foam::cos(degToRad(45.0)),
|
||||
Foam::cos(degToRad(45.0)),
|
||||
4, // only merge faces split into 4
|
||||
meshRefiner_.meshedPatches()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshRefiner_.mergePatchFacesUndo
|
||||
(
|
||||
Foam::cos(degToRad(45.0)),
|
||||
Foam::cos(degToRad(45.0)),
|
||||
meshRefiner_.meshedPatches(),
|
||||
motionDict,
|
||||
labelList(mesh.nFaces(), -1)
|
||||
);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -1134,6 +1236,7 @@ void Foam::autoRefineDriver::doRefine
|
||||
const refinementParameters& refineParams,
|
||||
const snapParameters& snapParams,
|
||||
const bool prepareForSnapping,
|
||||
const bool keepHex,
|
||||
const dictionary& motionDict
|
||||
)
|
||||
{
|
||||
@ -1145,7 +1248,7 @@ void Foam::autoRefineDriver::doRefine
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Check that all the keep points are inside the mesh.
|
||||
refineParams.findCells(mesh);
|
||||
refineParams.findCells(true, mesh, refineParams.locationsInMesh());
|
||||
|
||||
// Refine around feature edges
|
||||
featureEdgeRefine
|
||||
@ -1206,8 +1309,12 @@ void Foam::autoRefineDriver::doRefine
|
||||
motionDict
|
||||
);
|
||||
|
||||
// Mesh is at its finest. Do optional zoning.
|
||||
zonify(refineParams);
|
||||
// Mesh is at its finest. Do optional zoning (cellZones and faceZones)
|
||||
wordPairHashTable zonesToFaceZone;
|
||||
zonify(refineParams, zonesToFaceZone);
|
||||
|
||||
// Create pairs of patches for faceZones
|
||||
addFaceZones(meshRefiner_, refineParams, zonesToFaceZone);
|
||||
|
||||
// Pull baffles apart
|
||||
splitAndMergeBaffles
|
||||
@ -1221,7 +1328,7 @@ void Foam::autoRefineDriver::doRefine
|
||||
// Do something about cells with refined faces on the boundary
|
||||
if (prepareForSnapping)
|
||||
{
|
||||
mergePatchFaces(refineParams, motionDict);
|
||||
mergePatchFaces(keepHex, refineParams, motionDict);
|
||||
}
|
||||
|
||||
|
||||
@ -1232,19 +1339,14 @@ void Foam::autoRefineDriver::doRefine
|
||||
<< "---------------------" << nl
|
||||
<< endl;
|
||||
|
||||
//if (debug)
|
||||
//{
|
||||
// const_cast<Time&>(mesh.time())++;
|
||||
//}
|
||||
|
||||
// Do final balancing. Keep zoned faces on one processor since the
|
||||
// snap phase will convert them to baffles and this only works for
|
||||
// internal faces.
|
||||
meshRefiner_.balance
|
||||
(
|
||||
true,
|
||||
false,
|
||||
scalarField(mesh.nCells(), 1), // dummy weights
|
||||
true, // keepZoneFaces
|
||||
false, // keepBaffles
|
||||
scalarField(mesh.nCells(), 1), // cellWeights
|
||||
decomposer_,
|
||||
distributor_
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,7 +34,8 @@ SourceFiles
|
||||
#ifndef autoRefineDriver_H
|
||||
#define autoRefineDriver_H
|
||||
|
||||
#include "treeBoundBox.H"
|
||||
#include "wordPairHashTable.H"
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -129,7 +130,11 @@ class autoRefineDriver
|
||||
);
|
||||
|
||||
//- Add zones
|
||||
void zonify(const refinementParameters& refineParams);
|
||||
void zonify
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
wordPairHashTable& zonesToFaceZone
|
||||
);
|
||||
|
||||
void splitAndMergeBaffles
|
||||
(
|
||||
@ -142,11 +147,11 @@ class autoRefineDriver
|
||||
//- Merge refined boundary faces (from exposing coarser cell)
|
||||
void mergePatchFaces
|
||||
(
|
||||
const bool keepHex,
|
||||
const refinementParameters& refineParams,
|
||||
const dictionary& motionDict
|
||||
);
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
autoRefineDriver(const autoRefineDriver&);
|
||||
|
||||
@ -182,8 +187,18 @@ public:
|
||||
const refinementParameters& refineParams,
|
||||
const snapParameters& snapParams,
|
||||
const bool prepareForSnapping,
|
||||
const bool keepHexOnly,
|
||||
const dictionary& motionDict
|
||||
);
|
||||
|
||||
//- Helper: add faceZones and patches
|
||||
static void addFaceZones
|
||||
(
|
||||
meshRefinement& meshRefiner,
|
||||
const refinementParameters& refineParams,
|
||||
const wordPairHashTable& zonesToFaceZone
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ Description
|
||||
#include "unitConversion.H"
|
||||
#include "localPointRegion.H"
|
||||
#include "PatchTools.H"
|
||||
#include "refinementFeatures.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -648,35 +649,6 @@ Foam::autoSnapDriver::autoSnapDriver
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::mergeZoneBaffles
|
||||
(
|
||||
const List<labelPair>& baffles
|
||||
)
|
||||
{
|
||||
labelList zonedSurfaces =
|
||||
surfaceZonesInfo::getNamedSurfaces(meshRefiner_.surfaces().surfZones());
|
||||
|
||||
autoPtr<mapPolyMesh> map;
|
||||
|
||||
// No need to sync; all processors will have all same zonedSurfaces.
|
||||
label nBaffles = returnReduce(baffles.size(), sumOp<label>());
|
||||
if (zonedSurfaces.size() && nBaffles > 0)
|
||||
{
|
||||
// Merge any baffles
|
||||
Info<< "Converting " << nBaffles << " baffles back into zoned faces ..."
|
||||
<< endl;
|
||||
|
||||
map = meshRefiner_.mergeBaffles(baffles);
|
||||
|
||||
Info<< "Converted baffles in = "
|
||||
<< meshRefiner_.mesh().time().cpuTimeIncrement()
|
||||
<< " s\n" << nl << endl;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalarField Foam::autoSnapDriver::calcSnapDistance
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
@ -2454,10 +2426,45 @@ void Foam::autoSnapDriver::detectWarpedFaces
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::autoSnapDriver::getInternalOrBaffleDuplicateFace() const
|
||||
{
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
labelList internalOrBaffleFaceZones;
|
||||
{
|
||||
List<surfaceZonesInfo::faceZoneType> fzTypes(2);
|
||||
fzTypes[0] = surfaceZonesInfo::INTERNAL;
|
||||
fzTypes[1] = surfaceZonesInfo::BAFFLE;
|
||||
internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
|
||||
}
|
||||
|
||||
List<labelPair> baffles
|
||||
(
|
||||
meshRefiner_.subsetBaffles
|
||||
(
|
||||
mesh,
|
||||
internalOrBaffleFaceZones,
|
||||
localPointRegion::findDuplicateFacePairs(mesh)
|
||||
)
|
||||
);
|
||||
|
||||
labelList faceToDuplicate(mesh.nFaces(), -1);
|
||||
forAll(baffles, i)
|
||||
{
|
||||
const labelPair& p = baffles[i];
|
||||
faceToDuplicate[p[0]] = p[1];
|
||||
faceToDuplicate[p[1]] = p[0];
|
||||
}
|
||||
|
||||
return faceToDuplicate;
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoSnapDriver::doSnap
|
||||
(
|
||||
const dictionary& snapDict,
|
||||
const dictionary& motionDict,
|
||||
const bool mergePatchFaces,
|
||||
const scalar featureCos,
|
||||
const scalar planarAngle,
|
||||
const snapParameters& snapParams
|
||||
@ -2470,10 +2477,6 @@ void Foam::autoSnapDriver::doSnap
|
||||
<< "--------------" << nl
|
||||
<< endl;
|
||||
|
||||
// Get the labels of added patches.
|
||||
labelList adaptPatchIDs(meshRefiner_.meshedPatches());
|
||||
|
||||
|
||||
// faceZone handling
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
@ -2488,223 +2491,55 @@ void Foam::autoSnapDriver::doSnap
|
||||
//
|
||||
// internal
|
||||
// --------
|
||||
// - baffles: contains all faces on faceZone so
|
||||
// - mesh checks check across baffles
|
||||
// - they get back merged into internal faces
|
||||
// - baffles: need to be checked across
|
||||
// - duplicateFace: from face to duplicate face. Contains
|
||||
// all faces on faceZone to prevents merging patch faces.
|
||||
//
|
||||
// baffle
|
||||
// ------
|
||||
// - baffles: contains no faces on faceZone since need not be merged/checked
|
||||
// across
|
||||
// - baffles: no need to be checked across
|
||||
// - duplicateFace: contains all faces on faceZone to prevent
|
||||
// merging patch faces.
|
||||
//
|
||||
// boundary
|
||||
// --------
|
||||
// - baffles: contains no faces on faceZone since need not be merged/checked
|
||||
// across
|
||||
// - baffles: no need to be checked across. Also points get duplicated
|
||||
// so will no longer be baffles
|
||||
// - duplicateFace: contains no faces on faceZone since both sides can
|
||||
// merge faces independently.
|
||||
|
||||
|
||||
// Create baffles (pairs of faces that share the same points)
|
||||
// Baffles stored as owner and neighbour face that have been created.
|
||||
List<labelPair> baffles;
|
||||
meshRefiner_.createZoneBaffles
|
||||
|
||||
// faceZones of type internal
|
||||
const labelList internalFaceZones
|
||||
(
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
baffles
|
||||
meshRefiner_.getZones
|
||||
(
|
||||
List<surfaceZonesInfo::faceZoneType>
|
||||
(
|
||||
1,
|
||||
surfaceZonesInfo::INTERNAL
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Maintain map from face to baffle face (-1 for non-baffle faces). Used
|
||||
// later on to prevent patchface merging if faceType=baffle
|
||||
labelList duplicateFace(mesh.nFaces(), -1);
|
||||
|
||||
forAll(baffles, i)
|
||||
// Create baffles (pairs of faces that share the same points)
|
||||
// Baffles stored as owner and neighbour face that have been created.
|
||||
{
|
||||
const labelPair& baffle = baffles[i];
|
||||
duplicateFace[baffle.first()] = baffle.second();
|
||||
duplicateFace[baffle.second()] = baffle.first();
|
||||
}
|
||||
|
||||
// Selectively 'forget' about the baffles, i.e. not check across them
|
||||
// or merge across them.
|
||||
{
|
||||
const faceZoneMesh& fZones = mesh.faceZones();
|
||||
const refinementSurfaces& surfaces = meshRefiner_.surfaces();
|
||||
const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
|
||||
|
||||
// Determine which
|
||||
// - faces to remove from list of baffles (so not merge)
|
||||
// - points to duplicate
|
||||
|
||||
// Per face if is on faceType 'baffle' or 'boundary'
|
||||
labelList filterFace(mesh.nFaces(), -1);
|
||||
label nFilterFaces = 0;
|
||||
// Per point whether it need to be duplicated
|
||||
PackedBoolList duplicatePoint(mesh.nPoints());
|
||||
label nDuplicatePoints = 0;
|
||||
forAll(surfZones, surfI)
|
||||
{
|
||||
const word& faceZoneName = surfZones[surfI].faceZoneName();
|
||||
|
||||
if (faceZoneName.size())
|
||||
{
|
||||
const surfaceZonesInfo::faceZoneType& faceType =
|
||||
surfZones[surfI].faceType();
|
||||
|
||||
if
|
||||
(
|
||||
faceType == surfaceZonesInfo::BAFFLE
|
||||
|| faceType == surfaceZonesInfo::BOUNDARY
|
||||
)
|
||||
{
|
||||
// Filter out all faces for this zone.
|
||||
label zoneI = fZones.findZoneID(faceZoneName);
|
||||
const faceZone& fZone = fZones[zoneI];
|
||||
forAll(fZone, i)
|
||||
{
|
||||
label faceI = fZone[i];
|
||||
filterFace[faceI] = zoneI;
|
||||
nFilterFaces++;
|
||||
}
|
||||
|
||||
if (faceType == surfaceZonesInfo::BOUNDARY)
|
||||
{
|
||||
forAll(fZone, i)
|
||||
{
|
||||
label faceI = fZone[i];
|
||||
|
||||
// Allow combining patch faces across this face
|
||||
duplicateFace[faceI] = -1;
|
||||
|
||||
const face& f = mesh.faces()[faceI];
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (!duplicatePoint[f[fp]])
|
||||
{
|
||||
duplicatePoint[f[fp]] = 1;
|
||||
nDuplicatePoints++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Surface : " << surfaces.names()[surfI] << nl
|
||||
<< " faces to become baffle : "
|
||||
<< returnReduce(nFilterFaces, sumOp<label>()) << nl
|
||||
<< " points to duplicate : "
|
||||
<< returnReduce(nDuplicatePoints, sumOp<label>())
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Duplicate points only if all points agree
|
||||
syncTools::syncPointList
|
||||
List<labelPair> baffles;
|
||||
labelList originatingFaceZone;
|
||||
meshRefiner_.createZoneBaffles
|
||||
(
|
||||
mesh,
|
||||
duplicatePoint,
|
||||
andEqOp<unsigned int>(), // combine op
|
||||
0u // null value
|
||||
identity(mesh.faceZones().size()),
|
||||
baffles,
|
||||
originatingFaceZone
|
||||
);
|
||||
// Mark as duplicate (avoids combining patch faces) if one or both
|
||||
syncTools::syncFaceList(mesh, duplicateFace, maxEqOp<label>());
|
||||
// Mark as resulting from baffle/boundary face zone only if both agree
|
||||
syncTools::syncFaceList(mesh, filterFace, minEqOp<label>());
|
||||
|
||||
// Duplicate points
|
||||
if (returnReduce(nDuplicatePoints, sumOp<label>()) > 0)
|
||||
{
|
||||
// Collect all points (recount since syncPointList might have
|
||||
// increased set)
|
||||
nDuplicatePoints = 0;
|
||||
forAll(duplicatePoint, pointI)
|
||||
{
|
||||
if (duplicatePoint[pointI])
|
||||
{
|
||||
nDuplicatePoints++;
|
||||
}
|
||||
}
|
||||
labelList candidatePoints(nDuplicatePoints);
|
||||
nDuplicatePoints = 0;
|
||||
forAll(duplicatePoint, pointI)
|
||||
{
|
||||
if (duplicatePoint[pointI])
|
||||
{
|
||||
candidatePoints[nDuplicatePoints++] = pointI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
localPointRegion regionSide(mesh, candidatePoints);
|
||||
autoPtr<mapPolyMesh> mapPtr = meshRefiner_.dupNonManifoldPoints
|
||||
(
|
||||
regionSide
|
||||
);
|
||||
meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
|
||||
meshRefinement::updateList(mapPtr().faceMap(), -1, duplicateFace);
|
||||
|
||||
// Update baffles and baffle-to-baffle addressing
|
||||
|
||||
const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
|
||||
|
||||
forAll(baffles, i)
|
||||
{
|
||||
labelPair& baffle = baffles[i];
|
||||
baffle.first() = reverseFaceMap[baffle.first()];
|
||||
baffle.second() = reverseFaceMap[baffle.second()];
|
||||
}
|
||||
|
||||
if (debug&meshRefinement::MESH)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
Pout<< "Writing duplicatedPoints mesh to time "
|
||||
<< meshRefiner_.timeName()
|
||||
<< endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
meshRefinement::debugType(debug),
|
||||
meshRefinement::writeType
|
||||
(
|
||||
meshRefinement::writeLevel()
|
||||
| meshRefinement::WRITEMESH
|
||||
),
|
||||
mesh.time().path()/"duplicatedPoints"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Forget about baffles in a BAFFLE/BOUNDARY type zone
|
||||
DynamicList<labelPair> newBaffles(baffles.size());
|
||||
forAll(baffles, i)
|
||||
{
|
||||
const labelPair& baffle = baffles[i];
|
||||
if
|
||||
(
|
||||
filterFace[baffle.first()] == -1
|
||||
&& filterFace[baffles[i].second()] == -1
|
||||
)
|
||||
{
|
||||
newBaffles.append(baffle);
|
||||
}
|
||||
}
|
||||
|
||||
if (newBaffles.size() < baffles.size())
|
||||
{
|
||||
//Info<< "Splitting baffles into" << nl
|
||||
// << " internal : " << newBaffles.size() << nl
|
||||
// << " baffle : " << baffles.size()-newBaffles.size()
|
||||
// << nl << endl;
|
||||
baffles.transfer(newBaffles);
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
// Duplicate points on faceZones of type boundary
|
||||
meshRefiner_.dupNonManifoldBoundaryPoints();
|
||||
|
||||
|
||||
bool doFeatures = false;
|
||||
label nFeatIter = 1;
|
||||
@ -2720,6 +2555,12 @@ void Foam::autoSnapDriver::doSnap
|
||||
|
||||
bool meshOk = false;
|
||||
|
||||
|
||||
// Get the labels of added patches.
|
||||
labelList adaptPatchIDs(meshRefiner_.meshedPatches());
|
||||
|
||||
|
||||
|
||||
{
|
||||
autoPtr<indirectPrimitivePatch> ppPtr
|
||||
(
|
||||
@ -2732,7 +2573,7 @@ void Foam::autoSnapDriver::doSnap
|
||||
|
||||
|
||||
// Distance to attract to nearest feature on surface
|
||||
const scalarField snapDist(calcSnapDistance(mesh, snapParams, ppPtr()));
|
||||
scalarField snapDist(calcSnapDistance(mesh, snapParams, ppPtr()));
|
||||
|
||||
|
||||
// Construct iterative mesh mover.
|
||||
@ -2774,13 +2615,27 @@ void Foam::autoSnapDriver::doSnap
|
||||
Info<< "Checked initial mesh in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
|
||||
// Extract baffles across internal faceZones (for checking mesh quality
|
||||
// across
|
||||
labelPairList internalBaffles
|
||||
(
|
||||
meshRefiner_.subsetBaffles
|
||||
(
|
||||
mesh,
|
||||
internalFaceZones,
|
||||
localPointRegion::findDuplicateFacePairs(mesh)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Pre-smooth patch vertices (so before determining nearest)
|
||||
preSmoothPatch
|
||||
(
|
||||
meshRefiner_,
|
||||
snapParams,
|
||||
nInitErrors,
|
||||
baffles,
|
||||
internalBaffles,
|
||||
meshMoverPtr()
|
||||
);
|
||||
|
||||
@ -2793,235 +2648,35 @@ void Foam::autoSnapDriver::doSnap
|
||||
List<pointConstraint> patchConstraints;
|
||||
|
||||
|
||||
//- Any faces to split
|
||||
DynamicList<label> splitFaces;
|
||||
//- Indices in face to split across
|
||||
DynamicList<labelPair> splits;
|
||||
|
||||
|
||||
for (label iter = 0; iter < nFeatIter; iter++)
|
||||
{
|
||||
//if (doFeatures && (iter == 0 || iter == nFeatIter/2))
|
||||
//{
|
||||
// Info<< "Splitting diagonal attractions" << endl;
|
||||
//
|
||||
// indirectPrimitivePatch& pp = ppPtr();
|
||||
// motionSmoother& meshMover = meshMoverPtr();
|
||||
//
|
||||
// // Calculate displacement at every patch point. Insert into
|
||||
// // meshMover.
|
||||
// // Calculate displacement at every patch point
|
||||
// pointField nearestPoint;
|
||||
// vectorField nearestNormal;
|
||||
//
|
||||
// if (snapParams.detectNearSurfacesSnap())
|
||||
// {
|
||||
// nearestPoint.setSize(pp.nPoints(), vector::max);
|
||||
// nearestNormal.setSize(pp.nPoints(), vector::zero);
|
||||
// }
|
||||
//
|
||||
// vectorField disp = calcNearestSurface
|
||||
// (
|
||||
// meshRefiner_,
|
||||
// snapDist,
|
||||
// pp,
|
||||
// nearestPoint,
|
||||
// nearestNormal
|
||||
// );
|
||||
//
|
||||
//
|
||||
// // Override displacement at thin gaps
|
||||
// if (snapParams.detectNearSurfacesSnap())
|
||||
// {
|
||||
// detectNearSurfaces
|
||||
// (
|
||||
// Foam::cos(degToRad(planarAngle)),// planar gaps
|
||||
// pp,
|
||||
// nearestPoint, // surfacepoint from nearest test
|
||||
// nearestNormal, // surfacenormal from nearest test
|
||||
//
|
||||
// disp
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// // Override displacement with feature edge attempt
|
||||
// const label iter = 0;
|
||||
// calcNearestSurfaceFeature
|
||||
// (
|
||||
// snapParams,
|
||||
// false, // avoidSnapProblems
|
||||
// iter,
|
||||
// featureCos,
|
||||
// scalar(iter+1)/nFeatIter,
|
||||
// snapDist,
|
||||
// disp,
|
||||
// meshMover,
|
||||
// patchAttraction,
|
||||
// patchConstraints
|
||||
// );
|
||||
//
|
||||
//
|
||||
// const labelList& bFaces = ppPtr().addressing();
|
||||
// DynamicList<label> splitFaces(bFaces.size());
|
||||
// DynamicList<labelPair> splits(bFaces.size());
|
||||
//
|
||||
// forAll(bFaces, faceI)
|
||||
// {
|
||||
// const labelPair split
|
||||
// (
|
||||
// findDiagonalAttraction
|
||||
// (
|
||||
// ppPtr(),
|
||||
// patchAttraction,
|
||||
// patchConstraints,
|
||||
// faceI
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// if (split != labelPair(-1, -1))
|
||||
// {
|
||||
// splitFaces.append(bFaces[faceI]);
|
||||
// splits.append(split);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Info<< "Splitting "
|
||||
// << returnReduce(splitFaces.size(), sumOp<label>())
|
||||
// << " faces along diagonal attractions" << endl;
|
||||
//
|
||||
// autoPtr<mapPolyMesh> mapPtr = meshRefiner_.splitFaces
|
||||
// (
|
||||
// splitFaces,
|
||||
// splits
|
||||
// );
|
||||
//
|
||||
// const labelList& faceMap = mapPtr().faceMap();
|
||||
// meshRefinement::updateList(faceMap, -1, duplicateFace);
|
||||
// const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
|
||||
// forAll(baffles, i)
|
||||
// {
|
||||
// labelPair& baffle = baffles[i];
|
||||
// baffle.first() = reverseFaceMap[baffle.first()];
|
||||
// baffle.second() = reverseFaceMap[baffle.second()];
|
||||
// }
|
||||
//
|
||||
// meshMoverPtr.clear();
|
||||
// ppPtr.clear();
|
||||
//
|
||||
// ppPtr = meshRefinement::makePatch(mesh, adaptPatchIDs);
|
||||
// meshMoverPtr.reset
|
||||
// (
|
||||
// new motionSmoother
|
||||
// (
|
||||
// mesh,
|
||||
// ppPtr(),
|
||||
// adaptPatchIDs,
|
||||
// meshRefinement::makeDisplacementField
|
||||
// (
|
||||
// pointMesh::New(mesh),
|
||||
// adaptPatchIDs
|
||||
// ),
|
||||
// motionDict
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// if (debug&meshRefinement::MESH)
|
||||
// {
|
||||
// const_cast<Time&>(mesh.time())++;
|
||||
// Info<< "Writing split diagonal mesh to time "
|
||||
// << meshRefiner_.timeName() << endl;
|
||||
// meshRefiner_.write
|
||||
// (
|
||||
// meshRefinement::debugType(debug),
|
||||
// meshRefinement::writeType
|
||||
// (
|
||||
// meshRefinement::writeLevel()
|
||||
// | meshRefinement::WRITEMESH
|
||||
// ),
|
||||
// mesh.time().path()/meshRefiner_.timeName()
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//if
|
||||
//(
|
||||
// doFeatures
|
||||
// && (iter == 1 || iter == nFeatIter/2+1 || iter == nFeatIter-1)
|
||||
//)
|
||||
//{
|
||||
// Info<< "Splitting warped faces" << endl;
|
||||
//
|
||||
// const labelList& bFaces = ppPtr().addressing();
|
||||
// DynamicList<label> splitFaces(bFaces.size());
|
||||
// DynamicList<labelPair> splits(bFaces.size());
|
||||
//
|
||||
// detectWarpedFaces
|
||||
// (
|
||||
// featureCos,
|
||||
// ppPtr(),
|
||||
//
|
||||
// splitFaces,
|
||||
// splits
|
||||
// );
|
||||
//
|
||||
// Info<< "Splitting "
|
||||
// << returnReduce(splitFaces.size(), sumOp<label>())
|
||||
// << " faces along diagonal to avoid warpage" << endl;
|
||||
//
|
||||
// autoPtr<mapPolyMesh> mapPtr = meshRefiner_.splitFaces
|
||||
// (
|
||||
// splitFaces,
|
||||
// splits
|
||||
// );
|
||||
//
|
||||
// const labelList& faceMap = mapPtr().faceMap();
|
||||
// meshRefinement::updateList(faceMap, -1, duplicateFace);
|
||||
// const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
|
||||
// forAll(baffles, i)
|
||||
// {
|
||||
// labelPair& baffle = baffles[i];
|
||||
// baffle.first() = reverseFaceMap[baffle.first()];
|
||||
// baffle.second() = reverseFaceMap[baffle.second()];
|
||||
// }
|
||||
//
|
||||
// meshMoverPtr.clear();
|
||||
// ppPtr.clear();
|
||||
//
|
||||
// ppPtr = meshRefinement::makePatch(mesh, adaptPatchIDs);
|
||||
// meshMoverPtr.reset
|
||||
// (
|
||||
// new motionSmoother
|
||||
// (
|
||||
// mesh,
|
||||
// ppPtr(),
|
||||
// adaptPatchIDs,
|
||||
// meshRefinement::makeDisplacementField
|
||||
// (
|
||||
// pointMesh::New(mesh),
|
||||
// adaptPatchIDs
|
||||
// ),
|
||||
// motionDict
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// if (debug&meshRefinement::MESH)
|
||||
// {
|
||||
// const_cast<Time&>(mesh.time())++;
|
||||
// Info<< "Writing split warped mesh to time "
|
||||
// << meshRefiner_.timeName() << endl;
|
||||
// meshRefiner_.write
|
||||
// (
|
||||
// meshRefinement::debugType(debug),
|
||||
// meshRefinement::writeType
|
||||
// (
|
||||
// meshRefinement::writeLevel()
|
||||
// | meshRefinement::WRITEMESH
|
||||
// ),
|
||||
// mesh.time().path()/meshRefiner_.timeName()
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
Info<< nl
|
||||
<< "Morph iteration " << iter << nl
|
||||
<< "-----------------" << endl;
|
||||
|
||||
// Splitting iteration?
|
||||
bool doSplit = false;
|
||||
if
|
||||
(
|
||||
doFeatures
|
||||
&& snapParams.nFaceSplitInterval() > 0
|
||||
&& (
|
||||
(iter == nFeatIter-1)
|
||||
|| (iter > 0 && (iter%snapParams.nFaceSplitInterval()) == 0)
|
||||
)
|
||||
)
|
||||
{
|
||||
doSplit = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
indirectPrimitivePatch& pp = ppPtr();
|
||||
motionSmoother& meshMover = meshMoverPtr();
|
||||
|
||||
@ -3065,18 +2720,26 @@ void Foam::autoSnapDriver::doSnap
|
||||
// Override displacement with feature edge attempt
|
||||
if (doFeatures)
|
||||
{
|
||||
splitFaces.clear();
|
||||
splits.clear();
|
||||
disp = calcNearestSurfaceFeature
|
||||
(
|
||||
snapParams,
|
||||
true, // avoidSnapProblems
|
||||
!doSplit, // alignMeshEdges
|
||||
iter,
|
||||
featureCos,
|
||||
scalar(iter+1)/nFeatIter,
|
||||
|
||||
snapDist,
|
||||
disp,
|
||||
nearestNormal,
|
||||
meshMover,
|
||||
|
||||
patchAttraction,
|
||||
patchConstraints
|
||||
patchConstraints,
|
||||
|
||||
splitFaces,
|
||||
splits
|
||||
);
|
||||
}
|
||||
|
||||
@ -3108,7 +2771,7 @@ void Foam::autoSnapDriver::doSnap
|
||||
(
|
||||
snapParams,
|
||||
nInitErrors,
|
||||
baffles,
|
||||
internalBaffles,
|
||||
meshMover
|
||||
);
|
||||
|
||||
@ -3148,66 +2811,190 @@ void Foam::autoSnapDriver::doSnap
|
||||
|
||||
// Use current mesh as base mesh
|
||||
meshMover.correct();
|
||||
|
||||
|
||||
|
||||
// See if any faces need splitting
|
||||
label nTotalSplit = returnReduce(splitFaces.size(), sumOp<label>());
|
||||
if (nTotalSplit && doSplit)
|
||||
{
|
||||
// Filter out baffle faces from faceZones of type
|
||||
// internal/baffle
|
||||
|
||||
labelList duplicateFace(getInternalOrBaffleDuplicateFace());
|
||||
|
||||
{
|
||||
labelList oldSplitFaces(splitFaces.xfer());
|
||||
List<labelPair> oldSplits(splits.xfer());
|
||||
forAll(oldSplitFaces, i)
|
||||
{
|
||||
if (duplicateFace[oldSplitFaces[i]] == -1)
|
||||
{
|
||||
splitFaces.append(oldSplitFaces[i]);
|
||||
splits.append(oldSplits[i]);
|
||||
}
|
||||
}
|
||||
nTotalSplit = returnReduce
|
||||
(
|
||||
splitFaces.size(),
|
||||
sumOp<label>()
|
||||
);
|
||||
}
|
||||
|
||||
// Update mesh
|
||||
meshRefiner_.splitFacesUndo
|
||||
(
|
||||
splitFaces,
|
||||
splits,
|
||||
motionDict,
|
||||
|
||||
duplicateFace,
|
||||
internalBaffles
|
||||
);
|
||||
|
||||
// Redo meshMover
|
||||
meshMoverPtr.clear();
|
||||
ppPtr.clear();
|
||||
|
||||
// Update mesh mover
|
||||
ppPtr = meshRefinement::makePatch(mesh, adaptPatchIDs);
|
||||
meshMoverPtr.reset
|
||||
(
|
||||
new motionSmoother
|
||||
(
|
||||
mesh,
|
||||
ppPtr(),
|
||||
adaptPatchIDs,
|
||||
meshRefinement::makeDisplacementField
|
||||
(
|
||||
pointMesh::New(mesh),
|
||||
adaptPatchIDs
|
||||
),
|
||||
motionDict
|
||||
)
|
||||
);
|
||||
|
||||
// Update snapping distance
|
||||
snapDist = calcSnapDistance(mesh, snapParams, ppPtr());
|
||||
|
||||
|
||||
if (debug&meshRefinement::MESH)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
Info<< "Writing split-faces mesh to time "
|
||||
<< meshRefiner_.timeName() << endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
meshRefinement::debugType(debug),
|
||||
meshRefinement::writeType
|
||||
(
|
||||
meshRefinement::writeLevel()
|
||||
| meshRefinement::WRITEMESH
|
||||
),
|
||||
mesh.time().path()/meshRefiner_.timeName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (debug&meshRefinement::MESH)
|
||||
{
|
||||
forAll(internalBaffles, i)
|
||||
{
|
||||
const labelPair& p = internalBaffles[i];
|
||||
const point& fc0 = mesh.faceCentres()[p[0]];
|
||||
const point& fc1 = mesh.faceCentres()[p[1]];
|
||||
|
||||
if (mag(fc0-fc1) > meshRefiner_.mergeDistance())
|
||||
{
|
||||
FatalErrorIn("autoSnapDriver::doSnap(..)")
|
||||
<< "Separated baffles : f0:" << p[0]
|
||||
<< " centre:" << fc0
|
||||
<< " f1:" << p[1] << " centre:" << fc1
|
||||
<< " distance:" << mag(fc0-fc1)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Merge any introduced baffles (from faceZones of faceType 'internal')
|
||||
{
|
||||
autoPtr<mapPolyMesh> mapPtr = mergeZoneBaffles(baffles);
|
||||
autoPtr<mapPolyMesh> mapPtr = meshRefiner_.mergeZoneBaffles
|
||||
(
|
||||
true, // internal zones
|
||||
false // baffle zones
|
||||
);
|
||||
|
||||
if (mapPtr.valid())
|
||||
{
|
||||
forAll(duplicateFace, faceI)
|
||||
if (debug & meshRefinement::MESH)
|
||||
{
|
||||
if (duplicateFace[faceI] != -1)
|
||||
{
|
||||
duplicateFace[faceI] = mapPtr().reverseFaceMap()[faceI];
|
||||
}
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
Info<< "Writing baffle-merged mesh to time "
|
||||
<< meshRefiner_.timeName() << endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
meshRefinement::debugType(debug),
|
||||
meshRefinement::writeType
|
||||
(
|
||||
meshRefinement::writeLevel()
|
||||
| meshRefinement::WRITEMESH
|
||||
),
|
||||
meshRefiner_.timeName()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Repatch faces according to nearest. Do not repatch baffle faces.
|
||||
{
|
||||
autoPtr<mapPolyMesh> mapPtr = repatchToSurface
|
||||
(
|
||||
snapParams,
|
||||
adaptPatchIDs,
|
||||
duplicateFace
|
||||
);
|
||||
meshRefinement::updateList(mapPtr().faceMap(), -1, duplicateFace);
|
||||
labelList duplicateFace(getInternalOrBaffleDuplicateFace());
|
||||
|
||||
repatchToSurface(snapParams, adaptPatchIDs, duplicateFace);
|
||||
}
|
||||
|
||||
// Repatching might have caused faces to be on same patch and hence
|
||||
// mergeable so try again to merge coplanar faces. Do not merge baffle
|
||||
// faces to ensure they both stay the same.
|
||||
label nChanged = meshRefiner_.mergePatchFacesUndo
|
||||
(
|
||||
featureCos, // minCos
|
||||
featureCos, // concaveCos
|
||||
meshRefiner_.meshedPatches(),
|
||||
motionDict,
|
||||
duplicateFace // faces not to merge
|
||||
);
|
||||
if (mergePatchFaces)
|
||||
{
|
||||
labelList duplicateFace(getInternalOrBaffleDuplicateFace());
|
||||
|
||||
nChanged += meshRefiner_.mergeEdgesUndo(featureCos, motionDict);
|
||||
// Repatching might have caused faces to be on same patch and hence
|
||||
// mergeable so try again to merge coplanar faces. Do not merge baffle
|
||||
// faces to ensure they both stay the same.
|
||||
label nChanged = meshRefiner_.mergePatchFacesUndo
|
||||
(
|
||||
featureCos, // minCos
|
||||
featureCos, // concaveCos
|
||||
meshRefiner_.meshedPatches(),
|
||||
motionDict,
|
||||
duplicateFace // faces not to merge
|
||||
);
|
||||
|
||||
if (nChanged > 0 && debug & meshRefinement::MESH)
|
||||
nChanged += meshRefiner_.mergeEdgesUndo(featureCos, motionDict);
|
||||
|
||||
if (nChanged > 0 && debug & meshRefinement::MESH)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
Info<< "Writing patchFace merged mesh to time "
|
||||
<< meshRefiner_.timeName() << endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
meshRefinement::debugType(debug),
|
||||
meshRefinement::writeType
|
||||
(
|
||||
meshRefinement::writeLevel()
|
||||
| meshRefinement::WRITEMESH
|
||||
),
|
||||
meshRefiner_.timeName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug & meshRefinement::MESH)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
Info<< "Writing patchFace merged mesh to time "
|
||||
<< meshRefiner_.timeName() << endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
meshRefinement::debugType(debug),
|
||||
meshRefinement::writeType
|
||||
(
|
||||
meshRefinement::writeLevel()
|
||||
| meshRefinement::WRITEMESH
|
||||
),
|
||||
meshRefiner_.timeName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
#define autoSnapDriver_H
|
||||
|
||||
#include "meshRefinement.H"
|
||||
#include "DynamicField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -45,6 +46,7 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class motionSmoother;
|
||||
class refinementParameters;
|
||||
class snapParameters;
|
||||
class pointConstraint;
|
||||
|
||||
@ -87,18 +89,18 @@ class autoSnapDriver
|
||||
const List<labelPair>&
|
||||
);
|
||||
|
||||
//static tmp<pointField> avg
|
||||
//(
|
||||
// const indirectPrimitivePatch&,
|
||||
// const pointField&
|
||||
//);
|
||||
static tmp<pointField> avg
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
const pointField&
|
||||
);
|
||||
|
||||
//- Calculate displacement per patch point. Wip.
|
||||
//static tmp<pointField> smoothLambdaMuPatchDisplacement
|
||||
//(
|
||||
// const motionSmoother& meshMover,
|
||||
// const List<labelPair>& baffles
|
||||
//);
|
||||
static pointField smoothLambdaMuPatchDisplacement
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const List<labelPair>& baffles
|
||||
);
|
||||
|
||||
|
||||
//- Check that face zones are synced
|
||||
@ -136,6 +138,10 @@ class autoSnapDriver
|
||||
DynamicList<labelPair>& splits
|
||||
) const;
|
||||
|
||||
//- Get per face -1 or label of opposite face if on internal/baffle
|
||||
// faceZone
|
||||
labelList getInternalOrBaffleDuplicateFace() const;
|
||||
|
||||
// Feature line snapping
|
||||
|
||||
//- Is point on two feature edges that make a largish angle?
|
||||
@ -177,8 +183,8 @@ class autoSnapDriver
|
||||
const scalarField& faceSnapDist,
|
||||
vectorField& faceDisp,
|
||||
vectorField& faceSurfaceNormal,
|
||||
labelList& faceSurfaceRegion,
|
||||
vectorField& faceRotation
|
||||
labelList& faceSurfaceRegion
|
||||
//vectorField& faceRotation
|
||||
) const;
|
||||
void calcNearestFacePointProperties
|
||||
(
|
||||
@ -253,6 +259,86 @@ class autoSnapDriver
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
scalar pyrVol
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const vectorField& featureAttraction,
|
||||
const face& localF,
|
||||
const point& cc
|
||||
) const;
|
||||
void facePoints
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const vectorField& featureAttraction,
|
||||
const vectorField& nearestAttraction,
|
||||
const face& f,
|
||||
DynamicField<point>& points
|
||||
) const;
|
||||
scalar pyrVol
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const vectorField& featureAttraction,
|
||||
const vectorField& nearestAttraction,
|
||||
const face& localF,
|
||||
const point& cc
|
||||
) const;
|
||||
Tuple2<point, vector> centreAndNormal
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const vectorField& featureAttraction,
|
||||
const vectorField& nearestAttraction,
|
||||
const face& localF
|
||||
) const;
|
||||
bool isSplitAlignedWithFeature
|
||||
(
|
||||
const scalar featureCos,
|
||||
const point& newPt0,
|
||||
const pointConstraint& pc0,
|
||||
const point& newPt1,
|
||||
const pointConstraint& pc1
|
||||
) const;
|
||||
bool isConcave
|
||||
(
|
||||
const point& c0,
|
||||
const vector& area0,
|
||||
const point& c1,
|
||||
const vector& area1,
|
||||
const scalar concaveCos
|
||||
) const;
|
||||
labelPair findDiagonalAttraction
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar concaveCos,
|
||||
const scalar minAreaFraction,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const vectorField& patchAttraction,
|
||||
const List<pointConstraint>& patchConstraints,
|
||||
const vectorField& nearestAttraction,
|
||||
const vectorField& nearestNormal,
|
||||
const label faceI,
|
||||
|
||||
DynamicField<point>& points0,
|
||||
DynamicField<point>& points1
|
||||
) const;
|
||||
|
||||
//- Do all logic on whether to add face cut to diagonal
|
||||
// attraction
|
||||
void splitDiagonals
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar concaveCos,
|
||||
const scalar minAreaFraction,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const vectorField& nearestAttraction,
|
||||
const vectorField& nearestNormal,
|
||||
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints,
|
||||
DynamicList<label>& splitFaces,
|
||||
DynamicList<labelPair>& splits
|
||||
) const;
|
||||
|
||||
//- Avoid attraction across face diagonal since would
|
||||
// cause face squeeze
|
||||
void avoidDiagonalAttraction
|
||||
@ -264,6 +350,14 @@ class autoSnapDriver
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Write some stats about constraints
|
||||
void writeStats
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const PackedBoolList& isMasterPoint,
|
||||
const List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Return hit if on multiple points
|
||||
pointIndexHit findMultiPatchPoint
|
||||
(
|
||||
@ -320,7 +414,6 @@ class autoSnapDriver
|
||||
void featureAttractionUsingReconstruction
|
||||
(
|
||||
const label iter,
|
||||
const bool avoidSnapProblems,
|
||||
const scalar featureCos,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
@ -450,12 +543,19 @@ class autoSnapDriver
|
||||
void featureAttractionUsingFeatureEdges
|
||||
(
|
||||
const label iter,
|
||||
const bool avoidSnapProblems,
|
||||
const scalar featureCos,
|
||||
const bool multiRegionFeatureSnap,
|
||||
|
||||
const bool detectBaffles,
|
||||
const bool releasePoints,
|
||||
const bool stringFeatures,
|
||||
const bool avoidDiagonal,
|
||||
|
||||
const scalar featureCos,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestDisp,
|
||||
const vectorField& nearestNormal,
|
||||
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
@ -465,12 +565,14 @@ class autoSnapDriver
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
void preventFaceSqueeze
|
||||
(
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestAttraction,
|
||||
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
@ -483,15 +585,19 @@ class autoSnapDriver
|
||||
vectorField calcNearestSurfaceFeature
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const bool avoidSnapProblems,
|
||||
const bool alignMeshEdges,
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
const scalar featureAttract,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestDisp,
|
||||
const vectorField& nearestNormal,
|
||||
motionSmoother& meshMover,
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
List<pointConstraint>& patchConstraints,
|
||||
|
||||
DynamicList<label>& splitFaces,
|
||||
DynamicList<labelPair>& splits
|
||||
) const;
|
||||
|
||||
|
||||
@ -622,6 +728,7 @@ public:
|
||||
(
|
||||
const dictionary& snapDict,
|
||||
const dictionary& motionDict,
|
||||
const bool mergePatchFaces,
|
||||
const scalar featureCos,
|
||||
const scalar planarAngle,
|
||||
const snapParameters& snapParams
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -124,6 +124,14 @@ Foam::layerParameters::layerParameters
|
||||
readScalar(dict.lookup("minThickness"))
|
||||
),
|
||||
featureAngle_(readScalar(dict.lookup("featureAngle"))),
|
||||
mergePatchFacesAngle_
|
||||
(
|
||||
dict.lookupOrDefault<scalar>
|
||||
(
|
||||
"mergePatchFacesAngle",
|
||||
0.5*featureAngle_
|
||||
)
|
||||
),
|
||||
concaveAngle_
|
||||
(
|
||||
dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
|
||||
|
||||
@ -114,6 +114,8 @@ private:
|
||||
|
||||
scalar featureAngle_;
|
||||
|
||||
scalar mergePatchFacesAngle_;
|
||||
|
||||
scalar concaveAngle_;
|
||||
|
||||
label nGrow_;
|
||||
@ -247,6 +249,11 @@ public:
|
||||
return featureAngle_;
|
||||
}
|
||||
|
||||
scalar mergePatchFacesAngle() const
|
||||
{
|
||||
return mergePatchFacesAngle_;
|
||||
}
|
||||
|
||||
scalar concaveAngle() const
|
||||
{
|
||||
return concaveAngle_;
|
||||
|
||||
@ -27,6 +27,8 @@ License
|
||||
#include "unitConversion.H"
|
||||
#include "polyMesh.H"
|
||||
#include "globalIndex.H"
|
||||
#include "Tuple2.H"
|
||||
#include "wallPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,7 +46,15 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
||||
)
|
||||
),
|
||||
nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))),
|
||||
keepPoints_(pointField(1, dict.lookup("locationInMesh"))),
|
||||
locationsOutsideMesh_
|
||||
(
|
||||
dict.lookupOrDefault
|
||||
(
|
||||
"locationsOutsideMesh",
|
||||
pointField(0)
|
||||
)
|
||||
),
|
||||
faceZoneControls_(dict.subOrEmptyDict("faceZoneControls")),
|
||||
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),
|
||||
useTopologicalSnapDetection_
|
||||
(
|
||||
@ -56,6 +66,29 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
||||
dict.lookupOrDefault<Switch>("handleSnapProblems", true)
|
||||
)
|
||||
{
|
||||
point locationInMesh;
|
||||
if (dict.readIfPresent("locationInMesh", locationInMesh))
|
||||
{
|
||||
locationsInMesh_.append(locationInMesh);
|
||||
zonesInMesh_.append("noneIfNotSet");// special name for no cellZone
|
||||
}
|
||||
|
||||
List<Tuple2<point, word> > pointsToZone;
|
||||
if (dict.readIfPresent("locationsInMesh", pointsToZone))
|
||||
{
|
||||
label nZones = locationsInMesh_.size();
|
||||
locationsInMesh_.setSize(nZones+pointsToZone.size());
|
||||
zonesInMesh_.setSize(locationsInMesh_.size());
|
||||
|
||||
forAll(pointsToZone, i)
|
||||
{
|
||||
locationsInMesh_[nZones] = pointsToZone[i].first();
|
||||
zonesInMesh_[nZones] = pointsToZone[i].second();
|
||||
nZones++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar featAngle(readScalar(dict.lookup("resolveFeatureAngle")));
|
||||
|
||||
if (featAngle < 0 || featAngle > 180)
|
||||
@ -71,8 +104,68 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
|
||||
const
|
||||
Foam::dictionary Foam::refinementParameters::getZoneInfo
|
||||
(
|
||||
const word& fzName,
|
||||
surfaceZonesInfo::faceZoneType& faceType
|
||||
) const
|
||||
{
|
||||
dictionary patchInfo;
|
||||
patchInfo.add("type", wallPolyPatch::typeName);
|
||||
faceType = surfaceZonesInfo::INTERNAL;
|
||||
|
||||
if (faceZoneControls_.found(fzName))
|
||||
{
|
||||
const dictionary& fzDict = faceZoneControls_.subDict(fzName);
|
||||
|
||||
if (fzDict.found("patchInfo"))
|
||||
{
|
||||
patchInfo = fzDict.subDict("patchInfo");
|
||||
}
|
||||
|
||||
word faceTypeName;
|
||||
if (fzDict.readIfPresent("faceType", faceTypeName))
|
||||
{
|
||||
faceType = surfaceZonesInfo::faceZoneTypeNames[faceTypeName];
|
||||
}
|
||||
}
|
||||
return patchInfo;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::refinementParameters::addCellZonesToMesh
|
||||
(
|
||||
polyMesh& mesh
|
||||
) const
|
||||
{
|
||||
labelList zoneIDs(zonesInMesh_.size(), -1);
|
||||
forAll(zonesInMesh_, i)
|
||||
{
|
||||
if
|
||||
(
|
||||
zonesInMesh_[i] != word::null
|
||||
&& zonesInMesh_[i] != "none"
|
||||
&& zonesInMesh_[i] != "noneIfNotSet"
|
||||
)
|
||||
{
|
||||
zoneIDs[i] = surfaceZonesInfo::addCellZone
|
||||
(
|
||||
zonesInMesh_[i], // name
|
||||
labelList(0), // addressing
|
||||
mesh
|
||||
);
|
||||
}
|
||||
}
|
||||
return zoneIDs;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::refinementParameters::findCells
|
||||
(
|
||||
const bool checkInsideMesh,
|
||||
const polyMesh& mesh,
|
||||
const pointField& locations
|
||||
)
|
||||
{
|
||||
// Force calculation of tet-diag decomposition (for use in findCell)
|
||||
(void)mesh.tetBasePtIs();
|
||||
@ -81,13 +174,13 @@ const
|
||||
globalIndex globalCells(mesh.nCells());
|
||||
|
||||
// Cell label per point
|
||||
labelList cellLabels(keepPoints_.size());
|
||||
labelList cellLabels(locations.size());
|
||||
|
||||
forAll(keepPoints_, i)
|
||||
forAll(locations, i)
|
||||
{
|
||||
const point& keepPoint = keepPoints_[i];
|
||||
const point& location = locations[i];
|
||||
|
||||
label localCellI = mesh.findCell(keepPoint);
|
||||
label localCellI = mesh.findCell(location);
|
||||
|
||||
label globalCellI = -1;
|
||||
|
||||
@ -98,12 +191,13 @@ const
|
||||
|
||||
reduce(globalCellI, maxOp<label>());
|
||||
|
||||
if (globalCellI == -1)
|
||||
if (checkInsideMesh && globalCellI == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"refinementParameters::findCells(const polyMesh&) const"
|
||||
) << "Point " << keepPoint
|
||||
"refinementParameters::findCells"
|
||||
"(const polyMesh&, const pointField&) const"
|
||||
) << "Point " << location
|
||||
<< " is not inside the mesh or on a face or edge." << nl
|
||||
<< "Bounding box of the mesh:" << mesh.bounds()
|
||||
<< exit(FatalError);
|
||||
@ -113,10 +207,9 @@ const
|
||||
label procI = globalCells.whichProcID(globalCellI);
|
||||
label procCellI = globalCells.toLocal(procI, globalCellI);
|
||||
|
||||
Info<< "Found point " << keepPoint << " in cell " << procCellI
|
||||
Info<< "Found point " << location << " in cell " << procCellI
|
||||
<< " on processor " << procI << endl;
|
||||
|
||||
|
||||
if (globalCells.isLocal(globalCellI))
|
||||
{
|
||||
cellLabels[i] = localCellI;
|
||||
@ -130,4 +223,48 @@ const
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::refinementParameters::zonedLocations
|
||||
(
|
||||
const wordList& zonesInMesh
|
||||
)
|
||||
{
|
||||
DynamicList<label> indices(zonesInMesh.size());
|
||||
|
||||
forAll(zonesInMesh, i)
|
||||
{
|
||||
if
|
||||
(
|
||||
zonesInMesh[i] == word::null
|
||||
|| zonesInMesh[i] != "noneIfNotSet"
|
||||
)
|
||||
{
|
||||
indices.append(i);
|
||||
}
|
||||
}
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::refinementParameters::unzonedLocations
|
||||
(
|
||||
const wordList& zonesInMesh
|
||||
)
|
||||
{
|
||||
DynamicList<label> indices(0);
|
||||
|
||||
forAll(zonesInMesh, i)
|
||||
{
|
||||
if
|
||||
(
|
||||
zonesInMesh[i] != word::null
|
||||
&& zonesInMesh[i] == "noneIfNotSet"
|
||||
)
|
||||
{
|
||||
indices.append(i);
|
||||
}
|
||||
}
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -38,6 +38,8 @@ SourceFiles
|
||||
#include "dictionary.H"
|
||||
#include "pointField.H"
|
||||
#include "Switch.H"
|
||||
#include "wordPairHashTable.H"
|
||||
#include "surfaceZonesInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -73,8 +75,21 @@ class refinementParameters
|
||||
//- Number of layers between different refinement levels
|
||||
const label nBufferLayers_;
|
||||
|
||||
//- Areas to keep
|
||||
const pointField keepPoints_;
|
||||
|
||||
// Selection of areas
|
||||
|
||||
//- Areas not to keep
|
||||
const pointField locationsOutsideMesh_;
|
||||
|
||||
//- Areas to keep
|
||||
pointField locationsInMesh_;
|
||||
|
||||
//- Region for location
|
||||
wordList zonesInMesh_;
|
||||
|
||||
//- Information on how to handle faces on faceZones
|
||||
dictionary faceZoneControls_;
|
||||
|
||||
|
||||
//- FaceZone faces allowed which have owner and neighbour in same
|
||||
// cellZone?
|
||||
@ -147,9 +162,21 @@ public:
|
||||
}
|
||||
|
||||
//- Areas to keep
|
||||
const pointField& keepPoints() const
|
||||
const pointField& locationsInMesh() const
|
||||
{
|
||||
return keepPoints_;
|
||||
return locationsInMesh_;
|
||||
}
|
||||
|
||||
//- Per area the zone name
|
||||
const wordList& zonesInMesh() const
|
||||
{
|
||||
return zonesInMesh_;
|
||||
}
|
||||
|
||||
//- Optional points which are checked to be outside the mesh
|
||||
const pointField& locationsOutsideMesh() const
|
||||
{
|
||||
return locationsOutsideMesh_;
|
||||
}
|
||||
|
||||
//- Are zone faces allowed only inbetween different cell zones
|
||||
@ -180,8 +207,30 @@ public:
|
||||
|
||||
// Other
|
||||
|
||||
//- Checks that cells are in mesh. Returns cells they are in.
|
||||
labelList findCells(const polyMesh&) const;
|
||||
//- Get patchInfo and faceType for faceZone
|
||||
dictionary getZoneInfo
|
||||
(
|
||||
const word& fzName,
|
||||
surfaceZonesInfo::faceZoneType& faceType
|
||||
) const;
|
||||
|
||||
//- Add cellZones to mesh. Return indices of cellZones (or -1)
|
||||
labelList addCellZonesToMesh(polyMesh&) const;
|
||||
|
||||
//- Checks that cells are in mesh. Returns cells (or -1) they
|
||||
// are in.
|
||||
static labelList findCells
|
||||
(
|
||||
const bool checkInsideMesh,
|
||||
const polyMesh&,
|
||||
const pointField& locations
|
||||
);
|
||||
|
||||
//- Extract indices of named locations (so excludes 'keepPoints')
|
||||
static labelList zonedLocations(const wordList& zonesInMesh);
|
||||
|
||||
//- Extract indices of unnamed locations ('keepPoints')
|
||||
static labelList unzonedLocations(const wordList& zonesInMesh);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::wordPairHashTable
|
||||
|
||||
Description
|
||||
HashTable of Pair<word>
|
||||
|
||||
Typedef
|
||||
Foam::wordPairHashTable
|
||||
|
||||
Description
|
||||
HashTable of Pair<word>
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wordPairHashTable_H
|
||||
#define wordPairHashTable_H
|
||||
|
||||
#include "Pair.H"
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef HashTable<word, Pair<word>, typename FixedList<word, 2>::Hash<> >
|
||||
wordPairHashTable;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,7 +44,17 @@ Foam::snapParameters::snapParameters(const dictionary& dict)
|
||||
detectNearSurfacesSnap_
|
||||
(
|
||||
dict.lookupOrDefault("detectNearSurfacesSnap", true)
|
||||
)
|
||||
),
|
||||
detectBaffles_(dict.lookupOrDefault("detectBaffles", true)),
|
||||
releasePoints_(dict.lookupOrDefault("releasePoints", false)),
|
||||
stringFeatures_(dict.lookupOrDefault("stringFeatures", true)),
|
||||
avoidDiagonal_(dict.lookupOrDefault("avoidDiagonal", false)),
|
||||
nFaceSplitInterval_
|
||||
(
|
||||
dict.lookupOrDefault("nFaceSplitInterval", labelMin)
|
||||
),
|
||||
concaveAngle_(dict.lookupOrDefault("concaveAngle", 45)),
|
||||
minAreaRatio_(dict.lookupOrDefault("minAreaRatio", 0.3))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -72,6 +72,24 @@ class snapParameters
|
||||
|
||||
const Switch detectNearSurfacesSnap_;
|
||||
|
||||
const Switch detectBaffles_;
|
||||
|
||||
const Switch releasePoints_;
|
||||
|
||||
const Switch stringFeatures_;
|
||||
|
||||
const Switch avoidDiagonal_;
|
||||
|
||||
|
||||
//- How often needs face splitting be run
|
||||
label nFaceSplitInterval_;
|
||||
|
||||
//- When is angle too concave too split
|
||||
scalar concaveAngle_;
|
||||
|
||||
//- When is face-split not sufficiently diagonal
|
||||
scalar minAreaRatio_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -123,30 +141,78 @@ public:
|
||||
return nSnap_;
|
||||
}
|
||||
|
||||
label nFeatureSnap() const
|
||||
{
|
||||
return nFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch explicitFeatureSnap() const
|
||||
{
|
||||
return explicitFeatureSnap_;
|
||||
}
|
||||
// Surface snapping specific
|
||||
|
||||
Switch detectNearSurfacesSnap() const
|
||||
{
|
||||
return detectNearSurfacesSnap_;
|
||||
}
|
||||
|
||||
|
||||
// Feature edge snapping specific
|
||||
|
||||
label nFeatureSnap() const
|
||||
{
|
||||
return nFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch explicitFeatureSnap() const
|
||||
{
|
||||
return explicitFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch implicitFeatureSnap() const
|
||||
{
|
||||
return implicitFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch multiRegionFeatureSnap() const
|
||||
{
|
||||
return multiRegionFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch detectBaffles() const
|
||||
{
|
||||
return detectBaffles_;
|
||||
}
|
||||
|
||||
Switch releasePoints() const
|
||||
{
|
||||
return releasePoints_;
|
||||
}
|
||||
|
||||
Switch stringFeatures() const
|
||||
{
|
||||
return stringFeatures_;
|
||||
}
|
||||
|
||||
Switch avoidDiagonal() const
|
||||
{
|
||||
return avoidDiagonal_;
|
||||
}
|
||||
|
||||
|
||||
// Face splitting
|
||||
|
||||
|
||||
label nFaceSplitInterval() const
|
||||
{
|
||||
return nFaceSplitInterval_;
|
||||
}
|
||||
|
||||
scalar concaveAngle() const
|
||||
{
|
||||
return concaveAngle_;
|
||||
}
|
||||
|
||||
scalar minAreaRatio() const
|
||||
{
|
||||
return minAreaRatio_;
|
||||
}
|
||||
|
||||
Switch implicitFeatureSnap() const
|
||||
{
|
||||
return implicitFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch multiRegionFeatureSnap() const
|
||||
{
|
||||
return multiRegionFeatureSnap_;
|
||||
}
|
||||
|
||||
Switch detectNearSurfacesSnap() const
|
||||
{
|
||||
return detectNearSurfacesSnap_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1203,7 +1203,8 @@ handleFeatureAngleLayerTerminations
|
||||
|
||||
//Info<< "Added "
|
||||
// << returnReduce(nPointCounter-nOldPointCounter, sumOp<label>())
|
||||
// << " point not to extrude." << endl;
|
||||
// << " point not to extrude due to minCos "
|
||||
// << minCos << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -1225,7 +1226,19 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
|
||||
const labelListList& pointFaces = pp.pointFaces();
|
||||
|
||||
|
||||
Info<< typeName << " : Removing isolated regions ..." << endl;
|
||||
Info<< typeName << " : Removing isolated regions ..."
|
||||
<< indent << "- if partially extruded faces make angle < "
|
||||
<< Foam::radToDeg(Foam::acos(minCosLayerTermination)) << nl;
|
||||
if (detectExtrusionIsland)
|
||||
{
|
||||
Info<< indent << "- if exclusively surrounded by non-extruded points"
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< indent << "- if exclusively surrounded by non-extruded faces"
|
||||
<< nl;
|
||||
}
|
||||
|
||||
// Keep count of number of points unextruded
|
||||
label nPointCounter = 0;
|
||||
@ -1234,19 +1247,21 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
|
||||
{
|
||||
// Stop layer growth where mesh wraps around edge with a
|
||||
// large feature angle
|
||||
handleFeatureAngleLayerTerminations
|
||||
(
|
||||
minCosLayerTermination,
|
||||
isMasterPoint,
|
||||
meshEdges,
|
||||
if (minCosLayerTermination > -1)
|
||||
{
|
||||
handleFeatureAngleLayerTerminations
|
||||
(
|
||||
minCosLayerTermination,
|
||||
isMasterPoint,
|
||||
meshEdges,
|
||||
|
||||
extrudeStatus,
|
||||
patchDisp,
|
||||
nPointCounter
|
||||
);
|
||||
|
||||
syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
|
||||
extrudeStatus,
|
||||
patchDisp,
|
||||
nPointCounter
|
||||
);
|
||||
|
||||
syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
|
||||
}
|
||||
|
||||
|
||||
// Detect either:
|
||||
@ -1708,10 +1723,12 @@ void Foam::medialAxisMeshMover::calculateDisplacement
|
||||
const scalar featureAngle = readScalar(coeffDict.lookup("featureAngle"));
|
||||
|
||||
//- Stop layer growth where mesh wraps around sharp edge
|
||||
const scalar minCosLayerTermination = Foam::cos
|
||||
scalar layerTerminationAngle = coeffDict.lookupOrDefault<scalar>
|
||||
(
|
||||
degToRad(0.5*featureAngle)
|
||||
"layerTerminationAngle",
|
||||
0.5*featureAngle
|
||||
);
|
||||
scalar minCosLayerTermination = Foam::cos(degToRad(layerTerminationAngle));
|
||||
|
||||
//- Smoothing wanted patch thickness
|
||||
const label nSmoothPatchThickness = readLabel
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -51,6 +51,8 @@ SourceFiles
|
||||
#include "pointFieldsFwd.H"
|
||||
#include "Tuple2.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "wordPairHashTable.H"
|
||||
#include "surfaceZonesInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -74,6 +76,7 @@ class localPointRegion;
|
||||
|
||||
class snapParameters;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class meshRefinement Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -190,6 +193,15 @@ private:
|
||||
// order changes.
|
||||
wordList meshedPatches_;
|
||||
|
||||
//- FaceZone to master patch name
|
||||
HashTable<word, word> faceZoneToMasterPatch_;
|
||||
|
||||
//- FaceZone to slave patch name
|
||||
HashTable<word, word> faceZoneToSlavePatch_;
|
||||
|
||||
//- FaceZone to method to handle faces
|
||||
HashTable<surfaceZonesInfo::faceZoneType, word> faceZoneToType_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -216,9 +228,6 @@ private:
|
||||
pointField& neiCc
|
||||
) const;
|
||||
|
||||
//- Find any intersection of surface. Store in surfaceIndex_.
|
||||
void updateIntersections(const labelList& changedFaces);
|
||||
|
||||
//- Remove cells. Put exposedFaces into exposedPatchIDs.
|
||||
autoPtr<mapPolyMesh> doRemoveCells
|
||||
(
|
||||
@ -369,10 +378,25 @@ private:
|
||||
const labelList& globalToSlavePatch
|
||||
) const;
|
||||
|
||||
//- Calculate intersections. Return per face -1 or the global
|
||||
// surface region
|
||||
void getIntersections
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& neiCc,
|
||||
const labelList& testFaces,
|
||||
|
||||
labelList& globalRegion1,
|
||||
labelList& globalRegion2
|
||||
) const;
|
||||
|
||||
//- Determine patches for baffles
|
||||
void getBafflePatches
|
||||
(
|
||||
const labelList& globalToMasterPatch,
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
|
||||
const labelList& neiLevel,
|
||||
const pointField& neiCc,
|
||||
labelList& ownPatch,
|
||||
@ -494,6 +518,16 @@ private:
|
||||
labelList& cellToZone
|
||||
) const;
|
||||
|
||||
//- Finds zone per cell for cells inside region for which name
|
||||
// is specified.
|
||||
void findCellZoneInsideWalk
|
||||
(
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
const labelList& blockedFace, // per face -1 or some index >= 0
|
||||
labelList& cellToZone
|
||||
) const;
|
||||
|
||||
//- Determines cell zone from cell region information.
|
||||
bool calcRegionToZone
|
||||
(
|
||||
@ -508,7 +542,7 @@ private:
|
||||
// marked in namedSurfaceIndex regarded as blocked.
|
||||
void findCellZoneTopo
|
||||
(
|
||||
const point& keepPoint,
|
||||
const pointField& locationsInMesh,
|
||||
const labelList& namedSurfaceIndex,
|
||||
const labelList& surfaceToCellZone,
|
||||
labelList& cellToZone
|
||||
@ -520,6 +554,26 @@ private:
|
||||
labelList& namedSurfaceIndex
|
||||
) const;
|
||||
|
||||
//- Put cells into cellZone, faces into faceZone
|
||||
void zonify
|
||||
(
|
||||
const PackedBoolList& isMasterFace,
|
||||
const labelList& cellToZone,
|
||||
const labelList& neiCellZone,
|
||||
const labelList& faceToZone,
|
||||
const boolList& meshFlipMap,
|
||||
polyTopoChange& meshMod
|
||||
) const;
|
||||
|
||||
//- Allocate faceZoneName
|
||||
void allocateInterRegionFaceZone
|
||||
(
|
||||
const label ownZone,
|
||||
const label neiZone,
|
||||
wordPairHashTable& zonesToFaceZone,
|
||||
HashTable<word, labelPair, typename labelPair::Hash<> >&
|
||||
) const;
|
||||
|
||||
//- Remove any loose standing cells
|
||||
void handleSnapProblems
|
||||
(
|
||||
@ -840,7 +894,9 @@ public:
|
||||
Time& runTime,
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const point& keepPoint
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
);
|
||||
|
||||
//- Split off (with optional buffer layers) unreachable areas
|
||||
@ -850,7 +906,10 @@ public:
|
||||
const label nBufferLayers,
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const point& keepPoint
|
||||
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
);
|
||||
|
||||
//- Find boundary points that connect to more than one cell
|
||||
@ -861,6 +920,16 @@ public:
|
||||
// region and split them.
|
||||
autoPtr<mapPolyMesh> dupNonManifoldPoints();
|
||||
|
||||
//- Find boundary points that are on faceZones of type boundary
|
||||
// and duplicate them
|
||||
autoPtr<mapPolyMesh> dupNonManifoldBoundaryPoints();
|
||||
|
||||
//- Merge duplicate points
|
||||
autoPtr<mapPolyMesh> mergePoints
|
||||
(
|
||||
const labelList& pointToDuplicate
|
||||
);
|
||||
|
||||
//- Create baffle for every internal face where ownPatch != -1.
|
||||
// External faces get repatched according to ownPatch (neiPatch
|
||||
// should be -1 for these)
|
||||
@ -870,25 +939,50 @@ public:
|
||||
const labelList& neiPatch
|
||||
);
|
||||
|
||||
//- Create baffles for faces straddling zoned surfaces. Return
|
||||
// baffles.
|
||||
autoPtr<mapPolyMesh> createZoneBaffles
|
||||
//- Get zones of given type
|
||||
labelList getZones
|
||||
(
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
List<labelPair>&
|
||||
const List<surfaceZonesInfo::faceZoneType>& fzTypes
|
||||
) const;
|
||||
|
||||
//- Subset baffles according to zones
|
||||
static List<labelPair> subsetBaffles
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& zoneIDs,
|
||||
const List<labelPair>& baffles
|
||||
);
|
||||
|
||||
//- Merge baffles. Gets pairs of faces.
|
||||
//- Create baffles for faces on faceZones. Return created baffles
|
||||
// (= pairs of faces) and corresponding faceZone
|
||||
autoPtr<mapPolyMesh> createZoneBaffles
|
||||
(
|
||||
const labelList& zoneIDs,
|
||||
List<labelPair>& baffles,
|
||||
labelList& originatingFaceZone
|
||||
);
|
||||
|
||||
//- Merge baffles. Gets pairs of faces
|
||||
autoPtr<mapPolyMesh> mergeBaffles(const List<labelPair>&);
|
||||
|
||||
//- Merge all baffles on faceZones
|
||||
autoPtr<mapPolyMesh> mergeZoneBaffles
|
||||
(
|
||||
const bool doInternalZones,
|
||||
const bool doBaffleZones
|
||||
);
|
||||
|
||||
//- Put faces/cells into zones according to surface specification.
|
||||
// Returns null if no zone surfaces present. Region containing
|
||||
// the keepPoint will not be put into a cellZone.
|
||||
// Returns null if no zone surfaces present. Regions containing
|
||||
// locationsInMesh/regionsInMesh will be put in corresponding
|
||||
// cellZone. keepPoints is for backwards compatibility and sets
|
||||
// all yet unassigned cells to be non-zoned (zone = -1)
|
||||
autoPtr<mapPolyMesh> zonify
|
||||
(
|
||||
const point& keepPoint,
|
||||
const bool allowFreeStandingZoneFaces
|
||||
const bool allowFreeStandingZoneFaces,
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
wordPairHashTable& zonesToFaceZone
|
||||
);
|
||||
|
||||
|
||||
@ -913,9 +1007,32 @@ public:
|
||||
//- Get patchIDs for patches added in addMeshedPatch.
|
||||
labelList meshedPatches() const;
|
||||
|
||||
//- Add/lookup faceZone and update information. Return index of
|
||||
// faceZone
|
||||
label addFaceZone
|
||||
(
|
||||
const word& fzName,
|
||||
const word& masterPatch,
|
||||
const word& slavePatch,
|
||||
const surfaceZonesInfo::faceZoneType& fzType
|
||||
);
|
||||
|
||||
//- Lookup faceZone information. Return false if no information
|
||||
// for faceZone
|
||||
bool getFaceZoneInfo
|
||||
(
|
||||
const word& fzName,
|
||||
label& masterPatchID,
|
||||
label& slavePatchID,
|
||||
surfaceZonesInfo::faceZoneType& fzType
|
||||
) const;
|
||||
|
||||
//- Select coupled faces that are not collocated
|
||||
void selectSeparatedCoupledFaces(boolList&) const;
|
||||
|
||||
//- Find any intersection of surface. Store in surfaceIndex_.
|
||||
void updateIntersections(const labelList& changedFaces);
|
||||
|
||||
//- Find region point is in. Uses optional perturbation to re-test.
|
||||
static label findRegion
|
||||
(
|
||||
@ -925,19 +1042,43 @@ public:
|
||||
const point& p
|
||||
);
|
||||
|
||||
static void findRegions
|
||||
(
|
||||
const polyMesh&,
|
||||
const vector& perturbVec,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh,
|
||||
const label nRegions,
|
||||
labelList& cellRegion
|
||||
);
|
||||
|
||||
//- Split mesh. Keep part containing point.
|
||||
autoPtr<mapPolyMesh> splitMeshRegions
|
||||
(
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const point& keepPoint
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
);
|
||||
|
||||
//- Split faces into two
|
||||
autoPtr<mapPolyMesh> splitFaces
|
||||
void doSplitFaces
|
||||
(
|
||||
const labelList& splitFaces,
|
||||
const labelPairList& splits
|
||||
const labelPairList& splits,
|
||||
polyTopoChange& meshMod
|
||||
) const;
|
||||
|
||||
//- Split faces along diagonal. Maintain mesh quality. Return
|
||||
// total number of faces split.
|
||||
label splitFacesUndo
|
||||
(
|
||||
const labelList& splitFaces,
|
||||
const labelPairList& splits,
|
||||
const dictionary& motionDict,
|
||||
|
||||
labelList& duplicateFace,
|
||||
List<labelPair>& baffles
|
||||
);
|
||||
|
||||
//- Update local numbering for mesh redistribution
|
||||
@ -985,6 +1126,16 @@ public:
|
||||
|
||||
// Merging coplanar faces and edges
|
||||
|
||||
//- Merge coplanar faces if sets are of size mergeSize
|
||||
// (usually 4)
|
||||
label mergePatchFaces
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const label mergeSize,
|
||||
const labelList& patchIDs
|
||||
);
|
||||
|
||||
//- Merge coplanar faces. preserveFaces is != -1 for faces
|
||||
// to be preserved
|
||||
label mergePatchFacesUndo
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,110 +34,115 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//// Merge faces that are in-line.
|
||||
//Foam::label Foam::meshRefinement::mergePatchFaces
|
||||
//(
|
||||
// const scalar minCos,
|
||||
// const scalar concaveCos,
|
||||
// const labelList& patchIDs
|
||||
//)
|
||||
//{
|
||||
// // Patch face merging engine
|
||||
// combineFaces faceCombiner(mesh_);
|
||||
//
|
||||
// const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
//
|
||||
// // Pick up all candidate cells on boundary
|
||||
// labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
//
|
||||
// forAll(patchIDs, i)
|
||||
// {
|
||||
// label patchI = patchIDs[i];
|
||||
//
|
||||
// const polyPatch& patch = patches[patchI];
|
||||
//
|
||||
// if (!patch.coupled())
|
||||
// {
|
||||
// forAll(patch, i)
|
||||
// {
|
||||
// boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Get all sets of faces that can be merged
|
||||
// labelListList mergeSets
|
||||
// (
|
||||
// faceCombiner.getMergeSets
|
||||
// (
|
||||
// minCos,
|
||||
// concaveCos,
|
||||
// boundaryCells
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>());
|
||||
//
|
||||
// Info<< "mergePatchFaces : Merging " << nFaceSets
|
||||
// << " sets of faces." << endl;
|
||||
//
|
||||
// if (nFaceSets > 0)
|
||||
// {
|
||||
// // Topology changes container
|
||||
// polyTopoChange meshMod(mesh_);
|
||||
//
|
||||
// // Merge all faces of a set into the first face of the set. Remove
|
||||
// // unused points.
|
||||
// faceCombiner.setRefinement(mergeSets, meshMod);
|
||||
//
|
||||
// // Change the mesh (no inflation)
|
||||
// autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
|
||||
//
|
||||
// // Update fields
|
||||
// mesh_.updateMesh(map);
|
||||
//
|
||||
// // Move mesh (since morphing does not do this)
|
||||
// if (map().hasMotionPoints())
|
||||
// {
|
||||
// mesh_.movePoints(map().preMotionPoints());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Delete mesh volumes. No other way to do this?
|
||||
// mesh_.clearOut();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Reset the instance for if in overwrite mode
|
||||
// mesh_.setInstance(timeName());
|
||||
//
|
||||
// faceCombiner.updateMesh(map);
|
||||
//
|
||||
// // Get the kept faces that need to be recalculated.
|
||||
// // Merging two boundary faces might shift the cell centre
|
||||
// // (unless the faces are absolutely planar)
|
||||
// labelHashSet retestFaces(6*mergeSets.size());
|
||||
//
|
||||
// forAll(mergeSets, setI)
|
||||
// {
|
||||
// label oldMasterI = mergeSets[setI][0];
|
||||
//
|
||||
// label faceI = map().reverseFaceMap()[oldMasterI];
|
||||
//
|
||||
// // faceI is always uncoupled boundary face
|
||||
// const cell& cFaces = mesh_.cells()[mesh_.faceOwner()[faceI]];
|
||||
//
|
||||
// forAll(cFaces, i)
|
||||
// {
|
||||
// retestFaces.insert(cFaces[i]);
|
||||
// }
|
||||
// }
|
||||
// updateMesh(map, retestFaces.toc());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return nFaceSets;
|
||||
//}
|
||||
// Merge faces that are in-line.
|
||||
Foam::label Foam::meshRefinement::mergePatchFaces
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const label mergeSize,
|
||||
const labelList& patchIDs
|
||||
)
|
||||
{
|
||||
// Patch face merging engine
|
||||
combineFaces faceCombiner(mesh_, false);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Pick up all candidate cells on boundary
|
||||
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
|
||||
forAll(patchIDs, i)
|
||||
{
|
||||
label patchI = patchIDs[i];
|
||||
|
||||
const polyPatch& patch = patches[patchI];
|
||||
|
||||
if (!patch.coupled())
|
||||
{
|
||||
forAll(patch, i)
|
||||
{
|
||||
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get all sets of faces that can be merged
|
||||
labelListList mergeSets
|
||||
(
|
||||
faceCombiner.getMergeSets
|
||||
(
|
||||
minCos,
|
||||
concaveCos,
|
||||
boundaryCells
|
||||
)
|
||||
);
|
||||
|
||||
if (mergeSize != -1)
|
||||
{
|
||||
// Keep only those that are mergeSize faces
|
||||
label compactI = 0;
|
||||
forAll(mergeSets, setI)
|
||||
{
|
||||
if (mergeSets[setI].size() == mergeSize)
|
||||
{
|
||||
mergeSets[compactI++] = mergeSets[setI];
|
||||
}
|
||||
}
|
||||
mergeSets.setSize(compactI);
|
||||
}
|
||||
|
||||
|
||||
label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>());
|
||||
|
||||
Info<< "Merging " << nFaceSets << " sets of faces." << nl << endl;
|
||||
|
||||
if (nFaceSets > 0)
|
||||
{
|
||||
// Topology changes container
|
||||
polyTopoChange meshMod(mesh_);
|
||||
|
||||
// Merge all faces of a set into the first face of the set. Remove
|
||||
// unused points.
|
||||
faceCombiner.setRefinement(mergeSets, meshMod);
|
||||
|
||||
// Change the mesh (no inflation)
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh_.movePoints(map().preMotionPoints());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete mesh volumes. No other way to do this?
|
||||
mesh_.clearOut();
|
||||
}
|
||||
|
||||
// Reset the instance for if in overwrite mode
|
||||
mesh_.setInstance(timeName());
|
||||
|
||||
faceCombiner.updateMesh(map);
|
||||
|
||||
// Get the kept faces that need to be recalculated.
|
||||
// Merging two boundary faces might shift the cell centre
|
||||
// (unless the faces are absolutely planar)
|
||||
labelHashSet retestFaces(2*mergeSets.size());
|
||||
|
||||
forAll(mergeSets, setI)
|
||||
{
|
||||
label oldMasterI = mergeSets[setI][0];
|
||||
retestFaces.insert(map().reverseFaceMap()[oldMasterI]);
|
||||
}
|
||||
updateMesh(map, growFaceCellFace(retestFaces));
|
||||
}
|
||||
|
||||
return nFaceSets;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//// Remove points not used by any face or points used by only two faces where
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -341,6 +341,37 @@ Foam::labelList Foam::surfaceZonesInfo::getInsidePointNamedSurfaces
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::surfaceZonesInfo::addCellZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addressing,
|
||||
polyMesh& mesh
|
||||
)
|
||||
{
|
||||
cellZoneMesh& cellZones = mesh.cellZones();
|
||||
|
||||
label zoneI = cellZones.findZoneID(name);
|
||||
|
||||
if (zoneI == -1)
|
||||
{
|
||||
zoneI = cellZones.size();
|
||||
cellZones.setSize(zoneI+1);
|
||||
cellZones.set
|
||||
(
|
||||
zoneI,
|
||||
new cellZone
|
||||
(
|
||||
name, // name
|
||||
addressing, // addressing
|
||||
zoneI, // index
|
||||
cellZones // cellZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
return zoneI;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||
(
|
||||
const PtrList<surfaceZonesInfo>& surfList,
|
||||
@ -350,8 +381,6 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||
{
|
||||
labelList surfaceToCellZone(surfList.size(), -1);
|
||||
|
||||
cellZoneMesh& cellZones = mesh.cellZones();
|
||||
|
||||
forAll(namedSurfaces, i)
|
||||
{
|
||||
label surfI = namedSurfaces[i];
|
||||
@ -360,24 +389,12 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||
|
||||
if (cellZoneName != word::null)
|
||||
{
|
||||
label zoneI = cellZones.findZoneID(cellZoneName);
|
||||
|
||||
if (zoneI == -1)
|
||||
{
|
||||
zoneI = cellZones.size();
|
||||
cellZones.setSize(zoneI+1);
|
||||
cellZones.set
|
||||
(
|
||||
zoneI,
|
||||
new cellZone
|
||||
(
|
||||
cellZoneName, //name
|
||||
labelList(0), //addressing
|
||||
zoneI, //index
|
||||
cellZones //cellZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
label zoneI = addCellZone
|
||||
(
|
||||
cellZoneName,
|
||||
labelList(0), // addressing
|
||||
mesh
|
||||
);
|
||||
|
||||
surfaceToCellZone[surfI] = zoneI;
|
||||
}
|
||||
@ -385,7 +402,7 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||
|
||||
// Check they are synced
|
||||
List<wordList> allCellZones(Pstream::nProcs());
|
||||
allCellZones[Pstream::myProcNo()] = cellZones.names();
|
||||
allCellZones[Pstream::myProcNo()] = mesh.cellZones().names();
|
||||
Pstream::gatherList(allCellZones);
|
||||
Pstream::scatterList(allCellZones);
|
||||
|
||||
@ -409,6 +426,40 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::label Foam::surfaceZonesInfo::addFaceZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addressing,
|
||||
const boolList& flipMap,
|
||||
polyMesh& mesh
|
||||
)
|
||||
{
|
||||
faceZoneMesh& faceZones = mesh.faceZones();
|
||||
|
||||
label zoneI = faceZones.findZoneID(name);
|
||||
|
||||
if (zoneI == -1)
|
||||
{
|
||||
zoneI = faceZones.size();
|
||||
faceZones.setSize(zoneI+1);
|
||||
faceZones.set
|
||||
(
|
||||
zoneI,
|
||||
new faceZone
|
||||
(
|
||||
name, // name
|
||||
addressing, // addressing
|
||||
flipMap, // flipMap
|
||||
zoneI, // index
|
||||
faceZones // faceZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
return zoneI;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh
|
||||
(
|
||||
const PtrList<surfaceZonesInfo>& surfList,
|
||||
@ -426,25 +477,13 @@ Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh
|
||||
|
||||
const word& faceZoneName = surfList[surfI].faceZoneName();
|
||||
|
||||
label zoneI = faceZones.findZoneID(faceZoneName);
|
||||
|
||||
if (zoneI == -1)
|
||||
{
|
||||
zoneI = faceZones.size();
|
||||
faceZones.setSize(zoneI+1);
|
||||
faceZones.set
|
||||
(
|
||||
zoneI,
|
||||
new faceZone
|
||||
(
|
||||
faceZoneName, //name
|
||||
labelList(0), //addressing
|
||||
boolList(0), //flipmap
|
||||
zoneI, //index
|
||||
faceZones //faceZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
label zoneI = addFaceZone
|
||||
(
|
||||
faceZoneName, //name
|
||||
labelList(0), //addressing
|
||||
boolList(0), //flipmap
|
||||
mesh
|
||||
);
|
||||
|
||||
surfaceToFaceZone[surfI] = zoneI;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
#include "word.H"
|
||||
#include "PtrList.H"
|
||||
#include "labelList.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -222,6 +223,13 @@ public:
|
||||
const PtrList<surfaceZonesInfo>& surfList
|
||||
);
|
||||
|
||||
static label addCellZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addressing,
|
||||
polyMesh& mesh
|
||||
);
|
||||
|
||||
static labelList addCellZonesToMesh
|
||||
(
|
||||
const PtrList<surfaceZonesInfo>& surfList,
|
||||
@ -229,6 +237,14 @@ public:
|
||||
polyMesh& mesh
|
||||
);
|
||||
|
||||
static label addFaceZone
|
||||
(
|
||||
const word& name,
|
||||
const labelList& addressing,
|
||||
const boolList& flipMap,
|
||||
polyMesh& mesh
|
||||
);
|
||||
|
||||
static labelList addFaceZonesToMesh
|
||||
(
|
||||
const PtrList<surfaceZonesInfo>& surfList,
|
||||
|
||||
@ -17,15 +17,11 @@ do
|
||||
sed "s/XXX/$e/g" constant/transportProperties.template \
|
||||
> constant/transportProperties
|
||||
|
||||
runApplication `getApplication`
|
||||
|
||||
mv log.boundaryFoam log.boundaryFoam_$e
|
||||
runApplication -l log.boundaryFoam_$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 -l log.foamLog_$e foamLog log.boundaryFoam_$e
|
||||
|
||||
if [ -e logs/yPlus_0 ]
|
||||
then
|
||||
|
||||
@ -9,45 +9,32 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class polyBoundaryMesh;
|
||||
location "constant/polyMesh";
|
||||
object boundary;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
5
|
||||
(
|
||||
leftWall
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
//- Set patchGroups for constraint patches
|
||||
#include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type wall;
|
||||
nFaces 50;
|
||||
startFace 4432;
|
||||
type uniformFixedValue;
|
||||
uniformValue (0 0 0);
|
||||
}
|
||||
rightWall
|
||||
upperWall
|
||||
{
|
||||
type wall;
|
||||
nFaces 50;
|
||||
startFace 4482;
|
||||
type pressureInletOutletVelocity;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
lowerWall
|
||||
{
|
||||
type wall;
|
||||
nFaces 62;
|
||||
startFace 4532;
|
||||
}
|
||||
atmosphere
|
||||
{
|
||||
type patch;
|
||||
nFaces 46;
|
||||
startFace 4594;
|
||||
}
|
||||
defaultFaces
|
||||
{
|
||||
type empty;
|
||||
inGroups 1(empty);
|
||||
nFaces 4536;
|
||||
startFace 4640;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,38 @@
|
||||
/*--------------------------------*- 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 volScalarField;
|
||||
object alpha.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
//- Set patchGroups for constraint patches
|
||||
#include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
upperWall
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform 0;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
46
tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/p_rgh
Normal file
46
tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/p_rgh
Normal file
@ -0,0 +1,46 @@
|
||||
/*--------------------------------*- 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 volScalarField;
|
||||
object p_rgh;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
//- Set patchGroups for constraint patches
|
||||
#include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
phi phiAbs;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
upperWall
|
||||
{
|
||||
type totalPressure;
|
||||
p0 uniform 0;
|
||||
U U;
|
||||
phi phi;
|
||||
rho rho;
|
||||
psi none;
|
||||
gamma 1;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
15
tutorials/multiphase/interDyMFoam/ras/motorBike/Allclean
Executable file
15
tutorials/multiphase/interDyMFoam/ras/motorBike/Allclean
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Source tutorial clean functions
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||
|
||||
# remove surface and features
|
||||
\rm -f constant/triSurface/motorBike.obj.gz > /dev/null 2>&1
|
||||
\rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1
|
||||
\rm -f constant/triSurface/motorBike.eMesh > /dev/null 2>&1
|
||||
|
||||
rm -rf 0 > /dev/null 2>&1
|
||||
|
||||
cleanCase
|
||||
|
||||
\rm -f constant/polyMesh/boundary
|
||||
15
tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun
Executable file
15
tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
./Allrun.pre
|
||||
|
||||
#runApplication `getApplication`
|
||||
runParallel `getApplication` 5
|
||||
runApplication reconstructParMesh -latestTime
|
||||
runApplication reconstructPar -latestTime
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
27
tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre
Executable file
27
tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
# copy motorbike surface from resources directory
|
||||
cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
|
||||
|
||||
runApplication surfaceFeatureExtract
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
#runApplication snappyHexMesh -overwrite
|
||||
#\rm -f constant/polyMesh/refinementHistory*
|
||||
# - set the initial fields
|
||||
#cp -rf 0.org 0
|
||||
#runApplication setFields
|
||||
|
||||
runApplication decomposePar -force -cellDist
|
||||
runParallel snappyHexMesh 5 -overwrite
|
||||
ls -d processor* | xargs -i rm -f ./{}/constant/polyMesh/refinementHistory $1
|
||||
|
||||
# - set the initial fields
|
||||
ls -d processor* | xargs -i rm -rf ./{}/0 $1
|
||||
ls -d processor* | xargs -i cp -r 0.org ./{}/0 $1
|
||||
runParallel setFields 5
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- 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 RASProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "constant";
|
||||
object dynamicMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dynamicFvMesh dynamicRefineFvMesh;
|
||||
|
||||
dynamicRefineFvMeshCoeffs
|
||||
{
|
||||
// How often to refine
|
||||
refineInterval 1;
|
||||
// Field to be refinement on
|
||||
field alpha.water;
|
||||
// Refine field inbetween lower..upper
|
||||
lowerRefineLevel 0.001;
|
||||
upperRefineLevel 0.999;
|
||||
// Have slower than 2:1 refinement
|
||||
nBufferLayers 1;
|
||||
// Refine cells only up to maxRefinement levels
|
||||
maxRefinement 3;
|
||||
// Stop refinement if maxCells reached
|
||||
maxCells 2000000;
|
||||
// Flux field and corresponding velocity field. Fluxes on changed
|
||||
// faces get recalculated by interpolating the velocity. Use 'none'
|
||||
// on surfaceScalarFields that do not need to be reinterpolated.
|
||||
correctFluxes
|
||||
(
|
||||
(phi none)
|
||||
(nHatf none)
|
||||
(rhoPhi none)
|
||||
(ghf none)
|
||||
);
|
||||
// Write the refinement level as a volScalarField
|
||||
dumpLevel true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
22
tutorials/multiphase/interDyMFoam/ras/motorBike/constant/g
Normal file
22
tutorials/multiphase/interDyMFoam/ras/motorBike/constant/g
Normal file
@ -0,0 +1,22 @@
|
||||
/*--------------------------------*- 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 uniformDimensionedVectorField;
|
||||
location "constant";
|
||||
object g;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -2 0 0 0 0];
|
||||
value ( 0 0 -9.81 );
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,89 @@
|
||||
/*--------------------------------*- 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 blockMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
convertToMeters 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(-1 -0.5 0)
|
||||
( 3 -0.5 0)
|
||||
( 3 0.5 0)
|
||||
(-1 0.5 0)
|
||||
(-1 -0.5 2)
|
||||
( 3 -0.5 2)
|
||||
( 3 0.5 2)
|
||||
(-1 0.5 2)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (8 2 4) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
walls
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
(1 5 4 0)
|
||||
(0 4 7 3)
|
||||
(2 6 5 1)
|
||||
(0 3 2 1)
|
||||
);
|
||||
}
|
||||
// inlet
|
||||
// {
|
||||
// type patch;
|
||||
// faces
|
||||
// (
|
||||
// (0 4 7 3)
|
||||
// );
|
||||
// }
|
||||
// outlet
|
||||
// {
|
||||
// type patch;
|
||||
// faces
|
||||
// (
|
||||
// (2 6 5 1)
|
||||
// );
|
||||
// }
|
||||
// lowerWall
|
||||
// {
|
||||
// type wall;
|
||||
// faces
|
||||
// (
|
||||
// (0 3 2 1)
|
||||
// );
|
||||
// }
|
||||
upperWall
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,67 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "constant";
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
phases (water air);
|
||||
|
||||
water
|
||||
{
|
||||
transportModel Newtonian;
|
||||
nu nu [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
rho rho [ 1 -3 0 0 0 0 0 ] 1000;
|
||||
CrossPowerLawCoeffs
|
||||
{
|
||||
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
m m [ 0 0 1 0 0 0 0 ] 1;
|
||||
n n [ 0 0 0 0 0 0 0 ] 0;
|
||||
}
|
||||
|
||||
BirdCarreauCoeffs
|
||||
{
|
||||
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515;
|
||||
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
k k [ 0 0 1 0 0 0 0 ] 99.6;
|
||||
n n [ 0 0 0 0 0 0 0 ] 0.1003;
|
||||
}
|
||||
}
|
||||
|
||||
air
|
||||
{
|
||||
transportModel Newtonian;
|
||||
nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05;
|
||||
rho rho [ 1 -3 0 0 0 0 0 ] 1;
|
||||
CrossPowerLawCoeffs
|
||||
{
|
||||
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
m m [ 0 0 1 0 0 0 0 ] 1;
|
||||
n n [ 0 0 0 0 0 0 0 ] 0;
|
||||
}
|
||||
|
||||
BirdCarreauCoeffs
|
||||
{
|
||||
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515;
|
||||
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
k k [ 0 0 1 0 0 0 0 ] 99.6;
|
||||
n n [ 0 0 0 0 0 0 0 ] 0.1003;
|
||||
}
|
||||
}
|
||||
|
||||
sigma sigma [ 1 0 -2 0 0 0 0 ] 0.07;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,4 @@
|
||||
Directory to house tri-surfaces
|
||||
|
||||
The Allrun script copies the surface from the $FOAM_TUTORIALS/resources/geometry
|
||||
directory
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "constant";
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,60 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//DebugSwitches
|
||||
//{
|
||||
// dynamicRefineFvMesh 1;
|
||||
//}
|
||||
|
||||
application interDyMFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 2;
|
||||
|
||||
deltaT 0.001;
|
||||
|
||||
writeControl adjustableRunTime;
|
||||
writeInterval 0.02;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression uncompressed;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
adjustTimeStep yes;
|
||||
|
||||
maxCo 0.5;
|
||||
maxAlphaCo 0.5;
|
||||
maxDeltaT 1;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,42 @@
|
||||
/*--------------------------------*- 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 decomposeParDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 5;
|
||||
|
||||
method hierarchical;
|
||||
// method ptscotch;
|
||||
|
||||
simpleCoeffs
|
||||
{
|
||||
n (4 1 1);
|
||||
delta 0.001;
|
||||
}
|
||||
|
||||
hierarchicalCoeffs
|
||||
{
|
||||
n (5 1 1);
|
||||
delta 0.001;
|
||||
order xyz;
|
||||
}
|
||||
|
||||
manualCoeffs
|
||||
{
|
||||
dataFile "cellDecomposition";
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,59 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
div(rhoPhi,U) Gauss upwind;
|
||||
div(phi,alpha) Gauss vanLeer;
|
||||
div(phirb,alpha) Gauss linear;
|
||||
div((muEff*dev(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p_rgh;
|
||||
pcorr;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,83 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
"alpha.water.*"
|
||||
{
|
||||
nAlphaCorr 1;
|
||||
nAlphaSubCycles 3;
|
||||
cAlpha 1;
|
||||
}
|
||||
|
||||
p_rgh
|
||||
{
|
||||
solver GAMG;
|
||||
tolerance 1e-7;
|
||||
relTol 0.01;
|
||||
smoother DIC;
|
||||
nPreSweeps 0;
|
||||
nPostSweeps 2;
|
||||
nFinestSweeps 2;
|
||||
cacheAgglomeration false;
|
||||
nCellsInCoarsestLevel 10;
|
||||
agglomerator faceAreaPair;
|
||||
mergeLevels 1;
|
||||
}
|
||||
|
||||
p_rghFinal
|
||||
{
|
||||
$p_rgh;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
"pcorr.*"
|
||||
{
|
||||
$p_rghFinal;
|
||||
tolerance 0.001;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-06;
|
||||
relTol 0;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
"(k|B|nuTilda)"
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-08;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
momentumPredictor no;
|
||||
nCorrectors 3;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
|
||||
pRefPoint (0.51 0.51 0.51);
|
||||
pRefValue 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- 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 meshQualityDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Include defaults parameters from master dictionary
|
||||
#include "$WM_PROJECT_DIR/etc/caseDicts/meshQualityDict"
|
||||
|
||||
//- minFaceWeight (0 -> 0.5)
|
||||
minFaceWeight 0.02;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,38 @@
|
||||
/*--------------------------------*- 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;
|
||||
location "system";
|
||||
object setFieldsDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defaultFieldValues
|
||||
(
|
||||
volScalarFieldValue alpha.water 0
|
||||
volVectorFieldValue U ( 0 0 0 )
|
||||
);
|
||||
|
||||
regions
|
||||
(
|
||||
boxToCell
|
||||
{
|
||||
//box ( -1 -0.5 0 ) ( -0.5 0.5 2 );
|
||||
box ( -1 -0.5 1.5 ) ( 3 0.5 2 );
|
||||
fieldValues
|
||||
(
|
||||
volScalarFieldValue alpha.water 1
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,314 @@
|
||||
/*--------------------------------*- 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 snappyHexMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Which of the steps to run
|
||||
castellatedMesh true;
|
||||
snap true;
|
||||
addLayers true;
|
||||
|
||||
|
||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||
// searchableSurface.
|
||||
// Surfaces are used
|
||||
// - to specify refinement for any mesh cell intersecting it
|
||||
// - to specify refinement for any mesh cell inside/outside/near
|
||||
// - to 'snap' the mesh boundary to the surface
|
||||
geometry
|
||||
{
|
||||
motorBike.obj
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
name motorBike;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Optional: avoid patch-face merging. Allows mesh to be used for
|
||||
// refinement/unrefinement
|
||||
keepHex true;
|
||||
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
||||
// Refinement parameters
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// If local number of cells is >= maxLocalCells on any processor
|
||||
// switches from from refinement followed by balancing
|
||||
// (current method) to (weighted) balancing before refinement.
|
||||
maxLocalCells 100000;
|
||||
|
||||
// Overall cell limit (approximately). Refinement will stop immediately
|
||||
// upon reaching this number so a refinement level might not complete.
|
||||
// Note that this is the number of cells before removing the part which
|
||||
// is not 'visible' from the keepPoint. The final number of cells might
|
||||
// actually be a lot less.
|
||||
maxGlobalCells 2000000;
|
||||
|
||||
// The surface refinement loop might spend lots of iterations refining just a
|
||||
// few cells. This setting will cause refinement to stop if <= minimumRefine
|
||||
// are selected for refinement. Note: it will at least do one iteration
|
||||
// (unless the number of cells to refine is 0)
|
||||
minRefinementCells 10;
|
||||
|
||||
// Allow a certain level of imbalance during refining
|
||||
// (since balancing is quite expensive)
|
||||
// Expressed as fraction of perfect balance (= overall number of cells /
|
||||
// nProcs). 0=balance always.
|
||||
maxLoadUnbalance 0.10;
|
||||
|
||||
|
||||
// Number of buffer layers between different levels.
|
||||
// 1 means normal 2:1 refinement restriction, larger means slower
|
||||
// refinement.
|
||||
nCellsBetweenLevels 3;
|
||||
|
||||
|
||||
|
||||
// Explicit feature edge refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies a level for any cell intersected by its edges.
|
||||
// This is a featureEdgeMesh, read from constant/triSurface for now.
|
||||
features
|
||||
();
|
||||
|
||||
|
||||
|
||||
// Surface based refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies two levels for every surface. The first is the minimum level,
|
||||
// every cell intersecting a surface gets refined up to the minimum level.
|
||||
// The second level is the maximum level. Cells that 'see' multiple
|
||||
// intersections where the intersections make an
|
||||
// angle > resolveFeatureAngle get refined up to the maximum level.
|
||||
|
||||
refinementSurfaces
|
||||
{
|
||||
motorBike
|
||||
{
|
||||
// Surface-wise min and max refinement level
|
||||
level (3 3);
|
||||
|
||||
// Optional specification of patch type (default is wall). No
|
||||
// constraint types (cyclic, symmetry) etc. are allowed.
|
||||
patchInfo
|
||||
{
|
||||
type wall;
|
||||
inGroups (motorBikeGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve sharp angles
|
||||
resolveFeatureAngle 30;
|
||||
|
||||
|
||||
// Region-wise refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies refinement level for cells in relation to a surface. One of
|
||||
// three modes
|
||||
// - distance. 'levels' specifies per distance to the surface the
|
||||
// wanted refinement level. The distances need to be specified in
|
||||
// descending order.
|
||||
// - inside. 'levels' is only one entry and only the level is used. All
|
||||
// cells inside the surface get refined up to the level. The surface
|
||||
// needs to be closed for this to be possible.
|
||||
// - outside. Same but cells outside.
|
||||
|
||||
refinementRegions
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Mesh selection
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
// After refinement patches get added for all refinementSurfaces and
|
||||
// all cells intersecting the surfaces get put into these patches. The
|
||||
// section reachable from the locationInMesh is kept.
|
||||
// NOTE: This point should never be on a face, always inside a cell, even
|
||||
// after refinement.
|
||||
locationInMesh (2.991 0.4991 1.991);
|
||||
|
||||
|
||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||
// are only on the boundary of corresponding cellZones or also allow
|
||||
// free-standing zone faces. Not used if there are no faceZones.
|
||||
allowFreeStandingZoneFaces true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Settings for the snapping.
|
||||
snapControls
|
||||
{
|
||||
//- Number of patch smoothing iterations before finding correspondence
|
||||
// to surface
|
||||
nSmoothPatch 3;
|
||||
|
||||
//- Relative distance for points to be attracted by surface feature point
|
||||
// or edge. True distance is this factor times local
|
||||
// maximum edge length.
|
||||
tolerance 2.0;
|
||||
|
||||
//- Number of mesh displacement relaxation iterations.
|
||||
nSolveIter 30;
|
||||
|
||||
//- Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 5;
|
||||
|
||||
// Feature snapping
|
||||
|
||||
// //- Number of feature edge snapping iterations.
|
||||
// // Leave out altogether to disable.
|
||||
// nFeatureSnapIter 10;
|
||||
//
|
||||
// //- Detect (geometric only) features by sampling the surface
|
||||
// // (default=false).
|
||||
// implicitFeatureSnap false;
|
||||
//
|
||||
// //- Use castellatedMeshControls::features (default = true)
|
||||
// explicitFeatureSnap true;
|
||||
//
|
||||
// //- Detect points on multiple surfaces (only for explicitFeatureSnap)
|
||||
// multiRegionFeatureSnap false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Settings for the layer addition.
|
||||
addLayersControls
|
||||
{
|
||||
// Are the thickness parameters below relative to the undistorted
|
||||
// size of the refined cell outside layer (true) or absolute sizes (false).
|
||||
relativeSizes true;
|
||||
|
||||
// Per final patch (so not geometry!) the layer information
|
||||
layers
|
||||
{
|
||||
"motorBike.*"
|
||||
{
|
||||
nSurfaceLayers 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Expansion factor for layer mesh
|
||||
expansionRatio 1.0;
|
||||
|
||||
// Wanted thickness of final added cell layer. If multiple layers
|
||||
// is the
|
||||
// thickness of the layer furthest away from the wall.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
// is the thickness of the layer furthest away from the wall.
|
||||
// See relativeSizes parameter.
|
||||
finalLayerThickness 0.3;
|
||||
|
||||
// Minimum thickness of cell layer. If for any reason layer
|
||||
// cannot be above minThickness do not add layer.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
minThickness 0.1;
|
||||
|
||||
// If points get not extruded do nGrow layers of connected faces that are
|
||||
// also not grown. This helps convergence of the layer addition process
|
||||
// close to features.
|
||||
// Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
|
||||
nGrow 0;
|
||||
|
||||
// Advanced settings
|
||||
|
||||
// When not to extrude surface. 0 is flat surface, 90 is when two faces
|
||||
// are perpendicular
|
||||
featureAngle 60;
|
||||
|
||||
// At non-patched sides allow mesh to slip if extrusion direction makes
|
||||
// angle larger than slipFeatureAngle.
|
||||
slipFeatureAngle 30;
|
||||
|
||||
// Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 3;
|
||||
|
||||
// Number of smoothing iterations of surface normals
|
||||
nSmoothSurfaceNormals 1;
|
||||
|
||||
// Number of smoothing iterations of interior mesh movement direction
|
||||
nSmoothNormals 3;
|
||||
|
||||
// Smooth layer thickness over surface patches
|
||||
nSmoothThickness 10;
|
||||
|
||||
// Stop layer growth on highly warped cells
|
||||
maxFaceThicknessRatio 0.5;
|
||||
|
||||
// Reduce layer growth where ratio thickness to medial
|
||||
// distance is large
|
||||
maxThicknessToMedialRatio 0.3;
|
||||
|
||||
// Angle used to pick up medial axis points
|
||||
// Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
|
||||
minMedianAxisAngle 90;
|
||||
|
||||
|
||||
// Create buffer region for new layer terminations
|
||||
nBufferCellsNoExtrude 0;
|
||||
|
||||
|
||||
// Overall max number of layer addition iterations. The mesher will exit
|
||||
// if it reaches this number of iterations; possibly with an illegal
|
||||
// mesh.
|
||||
nLayerIter 50;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generic mesh quality settings. At any undoable phase these determine
|
||||
// where to undo.
|
||||
meshQualityControls
|
||||
{
|
||||
#include "meshQualityDict"
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
//- Number of error distribution iterations
|
||||
nSmoothScale 4;
|
||||
//- amount to scale back displacement at error points
|
||||
errorReduction 0.75;
|
||||
}
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
// Write flags
|
||||
writeFlags
|
||||
(
|
||||
layerFields // write volScalarField for layer coverage
|
||||
);
|
||||
|
||||
|
||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||
// Note: the write tolerance needs to be higher than this.
|
||||
mergeTolerance 1e-6;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- 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 surfaceFeatureExtractDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
motorBike.obj
|
||||
{
|
||||
// How to obtain raw features (extractFromFile || extractFromSurface)
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
extractFromSurfaceCoeffs
|
||||
{
|
||||
// Mark edges whose adjacent surface normals are at an angle less
|
||||
// than includedAngle as features
|
||||
// - 0 : selects no edges
|
||||
// - 180: selects all edges
|
||||
includedAngle 150;
|
||||
}
|
||||
|
||||
subsetFeatures
|
||||
{
|
||||
// Keep nonManifold edges (edges with >2 connected faces)
|
||||
nonManifoldEdges no;
|
||||
|
||||
// Keep open edges (edges with 1 connected face)
|
||||
openEdges yes;
|
||||
}
|
||||
|
||||
|
||||
// Write options
|
||||
|
||||
// Write features to obj format for postprocessing
|
||||
writeObj yes;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user