43 #ifndef meshRefinement_H 44 #define meshRefinement_H 62 class mapDistributePolyMesh;
63 class decompositionMethod;
64 class refinementSurfaces;
65 class refinementFeatures;
68 class fvMeshDistribute;
69 class searchableSurface;
73 class localPointRegion;
163 const scalar mergeDistance_;
166 const bool overwrite_;
169 const word oldInstance_;
197 template<
class GeoField>
198 static void addPatchFields(
fvMesh&,
const word& patchFieldType);
201 template<
class GeoField>
213 void calcNeighbourData
220 void updateIntersections(
const labelList& changedFaces);
240 const label exposedPatchI
249 static bool markForRefine
251 const label markValue,
252 const label nAllowRefine,
259 void markFeatureCellLevel
267 label markFeatureRefinement
270 const label nAllowRefine,
277 label markInternalDistanceToFeatureRefinement
279 const label nAllowRefine,
285 label markInternalRefinement
287 const label nAllowRefine,
300 label markSurfaceRefinement
302 const label nAllowRefine,
314 const scalar tol = 1
e-6
320 label markSurfaceCurvatureRefinement
322 const scalar curvature,
323 const label nAllowRefine,
333 const scalar planarCos,
334 const label nAllowRefine,
336 const label surfaceLevel,
338 const vector& surfaceNormal,
351 label markProximityRefinement
353 const scalar curvature,
354 const label nAllowRefine,
367 const bool allowBoundary,
373 void getBafflePatches
388 const label ownPatch,
389 const label neiPatch,
397 void markBoundaryFace
424 const scalar minFaceArea,
425 const scalar maxNonOrtho,
432 const scalar volFraction,
442 const bool removeEdgeConnectedCells,
454 labelList markFacesOnProblemCellsGeometric
468 const scalar freeStandingAngle
478 void findCellZoneGeometric
489 void findCellZoneInsideWalk
498 bool calcRegionToZone
500 const label surfZoneI,
501 const label ownRegion,
502 const label neiRegion,
509 void findCellZoneTopo
511 const point& keepPoint,
519 void makeConsistentFaceIndex
526 void handleSnapProblems
529 const bool useTopologicalSnapDetection,
530 const bool removeEdgeConnectedCells,
552 void calcPatchNumMasterFaces
569 void consistentOrientation
622 return mergeDistance_;
664 return surfaceIndex_;
669 return surfaceIndex_;
678 return userFaceData_;
683 return userFaceData_;
698 const bool keepZoneFaces,
699 const bool keepBaffles,
785 const scalar curvature,
786 const scalar planarAngle,
788 const bool featureRefinement,
789 const bool featureDistanceRefinement,
790 const bool internalRefinement,
791 const bool surfaceRefinement,
792 const bool curvatureRefinement,
793 const bool gapRefinement,
794 const label maxGlobalCells,
795 const label maxLocalCells
808 const scalar maxLoadUnbalance
818 const scalar maxLoadUnbalance
827 const bool handleSnapProblems,
831 const bool useTopologicalSnapDetection,
832 const bool removeEdgeConnectedCells,
836 const bool mergeFreeStanding,
837 const scalar freeStandingAngle,
843 const point& keepPoint
850 const label nBufferLayers,
853 const point& keepPoint
893 const point& keepPoint,
894 const bool allowFreeStandingZoneFaces
904 const label insertPatchI,
936 const point& keepPoint
996 const scalar concaveCos,
1030 const scalar minCos,
1134 template<
class Enum>
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
const hexRef8 & meshCutter() const
Reference to meshcutting engine.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
label countHits() const
Count number of intersections (local)
const pointField & points
autoPtr< mapPolyMesh > createBaffles(const labelList &ownPatch, const labelList &neiPatch)
Create baffle for every internal face where ownPatch != -1.
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
bool write() const
Write mesh and all data.
autoPtr< mapDistributePolyMesh > refineAndBalance(const string &msg, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &cellsToRefine, const scalar maxLoadUnbalance)
Refine some cells and rebalance.
Mesh data needed to do the Finite Volume discretisation.
Container with cells to refine. Refinement given as single direction.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
static label findRegion(const polyMesh &, const labelList &cellRegion, const vector &perturbVec, const point &p)
Find region point is in. Uses optional perturbation to re-test.
void baffleAndSplitMesh(const bool handleSnapProblems, const snapParameters &snapParams, const bool useTopologicalSnapDetection, const bool removeEdgeConnectedCells, const scalarField &perpendicularAngle, const bool mergeFreeStanding, const scalar freeStandingAngle, const dictionary &motionDict, Time &runTime, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const point &keepPoint)
Split off unreachable areas of mesh.
void checkZoneFaces() const
Debug helper: check faceZones are not on processor patches.
word name(const complex &)
Return a string representation of a complex.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
const List< Tuple2< mapType, labelList > > & userFaceData() const
Additional face data that is maintained across.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
static const NamedEnum< IOdebugType, 5 > IOdebugTypeNames
autoPtr< mapDistributePolyMesh > balanceAndRefine(const string &msg, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &cellsToRefine, const scalar maxLoadUnbalance)
Balance before refining some cells.
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
A HashTable to objects of type <T> with a label key.
autoPtr< mapPolyMesh > splitMesh(const label nBufferLayers, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const point &keepPoint)
Split off (with optional buffer layers) unreachable areas.
bool isGap(const scalar, const vector &, const vector &, const vector &, const vector &) const
Is local topology a small gap?
static outputType outputLevel()
Get/set output level.
const word & oldInstance() const
(points)instance of mesh upon construction
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
static const NamedEnum< IOwriteType, 4 > IOwriteTypeNames
Given list of cells to remove insert all the topology changes.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
Refinement of (split) hexes using polyTopoChange.
labelList refineCandidates(const pointField &keepPoints, const scalar curvature, const scalar planarAngle, const bool featureRefinement, const bool featureDistanceRefinement, const bool internalRefinement, const bool surfaceRefinement, const bool curvatureRefinement, const bool gapRefinement, const label maxGlobalCells, const label maxLocalCells) const
Calculate list of cells to refine.
Database for solution data, solver performance and other reduced data.
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const point &keepPoint)
Split mesh. Keep part containing point.
bool isNormalGap(const scalar, const vector &, const vector &, const vector &, const vector &) const
Is local topology a small gap normal to the test vector.
labelList growFaceCellFace(const labelHashSet &set) const
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
Mesh representing a set of points created from polyMesh.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
A list of keyword definitions, which are a keyword followed by any number of values (e...
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
Simple container to keep together snap specific information.
Removes selected points from mesh and updates faces using these points.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
mapType
Enumeration for how the userdata is to be mapped upon refinement.
void setInstance(const fileName &)
Set instance of all local IOobjects.
const shellSurfaces & shells() const
Reference to refinement shells (regions)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static void collectAndPrint(const UList< point > &points, const UList< T > &data)
Print list according to (collected and) sorted coordinate.
const double e
Elementary charge.
autoPtr< mapPolyMesh > splitFaces(const labelList &splitFaces, const labelPairList &splits)
Split faces into two.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
Abstract base class for decomposition.
static void weightedSum(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, const scalarField &edgeWeights, const Field< Type > &data, Field< Type > &sum)
Helper: weighted sum (over all subset of mesh points) by.
const refinementFeatures & features() const
Reference to feature edge mesh.
bool overwrite() const
Overwrite the mesh?
void testSyncBoundaryFaceList(const scalar mergeDistance, const string &, const UList< T > &, const UList< T > &) const
Compare two lists over all boundary faces.
autoPtr< mapPolyMesh > createZoneBaffles(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, List< labelPair > &)
Create baffles for faces straddling zoned surfaces. Return.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
scalar mergeDistance() const
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
labelList collectFaces(const labelList &candidateFaces, const labelHashSet &set) const
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static int readFlags(const Enum &namedEnum, const wordList &)
Helper: convert wordList into bit pattern using provided.
static label appendPatch(fvMesh &, const label insertPatchI, const word &, const dictionary &)
Helper:append patch to end of mesh.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
IOwriteType
Enumeration for what to write.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
Encapsulates queries for features.
A list of faces which address into the list of points.
static writeType writeLevel()
Get/set write level.
static const NamedEnum< IOoutputType, 1 > IOoutputTypeNames
static void calculateEdgeWeights(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
labelList intersectedFaces() const
Get faces with intersection.
Mesh consisting of general polyhedral cells.
ClassName("meshRefinement")
Runtime type information.
autoPtr< mapPolyMesh > dupNonManifoldPoints()
Find boundary points that connect to more than one cell.
const refinementSurfaces & surfaces() const
Reference to surface search engines.
A class for handling file names.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
IOoutputType
Enumeration for what to output.
label mergeEdgesUndo(const scalar minCos, const dictionary &motionDict)
Merge edges, maintain mesh quality. Return global number.
Direct mesh changes based on v1.3 polyTopoChange syntax.
IOdebugType
Enumeration for what to debug.
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
void checkData()
Debugging: check that all faces still obey start()>end()
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
autoPtr< mapPolyMesh > doRemovePoints(removePoints &pointRemover, const boolList &pointCanBeDeleted)
autoPtr< mapPolyMesh > refine(const labelList &cellsToRefine)
Refine some cells.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
autoPtr< mapPolyMesh > mergeBaffles(const List< labelPair > &)
Merge baffles. Gets pairs of faces.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Contains information about location on a triSurface:
const fvMesh & mesh() const
Reference to mesh.
autoPtr< mapPolyMesh > doRestorePoints(removePoints &pointRemover, const labelList &facesToRestore)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
autoPtr< mapPolyMesh > zonify(const point &keepPoint, const bool allowFreeStandingZoneFaces)
Put faces/cells into zones according to surface specification.
label mergePatchFacesUndo(const scalar minCos, const scalar concaveCos, const labelList &patchIDs, const dictionary &motionDict, const labelList &preserveFaces)
Merge coplanar faces. preserveFaces is != -1 for faces.
Encapsulates queries for volume refinement ('refine all cells within shell').