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>
label countHits() const
Count number of intersections (local)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
IOoutputType
Enumeration for what to output.
A class for handling file names.
const double e
Elementary charge.
autoPtr< mapDistributePolyMesh > balanceAndRefine(const string &msg, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &cellsToRefine, const scalar maxLoadUnbalance)
Balance before refining some cells.
A list of keyword definitions, which are a keyword followed by any number of values (e...
IOdebugType
Enumeration for what to debug.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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.
static const NamedEnum< IOoutputType, 1 > IOoutputTypeNames
Given list of cells to remove insert all the topology changes.
static const NamedEnum< IOwriteType, 4 > IOwriteTypeNames
autoPtr< mapPolyMesh > createZoneBaffles(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, List< labelPair > &)
Create baffles for faces straddling zoned surfaces. Return.
autoPtr< mapPolyMesh > createBaffles(const labelList &ownPatch, const labelList &neiPatch)
Create baffle for every internal face where ownPatch != -1.
static writeType writeLevel()
Get/set write level.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
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 selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
autoPtr< mapPolyMesh > splitMesh(const label nBufferLayers, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const point &keepPoint)
Split off (with optional buffer layers) unreachable areas.
set value to -1 any face that was refined
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
scalar mergeDistance() const
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const point &keepPoint)
Split mesh. Keep part containing point.
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
IOwriteType
Enumeration for what to write.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
Mesh representing a set of points created from polyMesh.
label mergeEdgesUndo(const scalar minCos, const dictionary &motionDict)
Merge edges, maintain mesh quality. Return global number.
autoPtr< mapPolyMesh > mergeBaffles(const List< labelPair > &)
Merge baffles. Gets pairs of faces.
Encapsulates queries for features.
const refinementFeatures & features() const
Reference to feature edge mesh.
static label appendPatch(fvMesh &, const label insertPatchi, const word &, const dictionary &)
Helper:append patch to end of mesh.
bool write() const
Write mesh and all data.
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
A list of faces which address into the list of points.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
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))
ClassName("meshRefinement")
Runtime type information.
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.
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)
autoPtr< mapDistributePolyMesh > refineAndBalance(const string &msg, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &cellsToRefine, const scalar maxLoadUnbalance)
Refine some cells and rebalance.
autoPtr< mapPolyMesh > splitFaces(const labelList &splitFaces, const labelPairList &splits)
Split faces into two.
Refinement of (split) hexes using polyTopoChange.
A class for handling words, derived from string.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
Simple container to keep together snap specific information.
const word & oldInstance() const
(points)instance of mesh upon construction
void testSyncBoundaryFaceList(const scalar mergeDistance, const string &, const UList< T > &, const UList< T > &) const
Compare two lists over all boundary faces.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
static const NamedEnum< IOdebugType, 5 > IOdebugTypeNames
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
const refinementSurfaces & surfaces() const
Reference to surface search engines.
Abstract base class for decomposition.
Encapsulates queries for volume refinement ('refine all cells within shell').
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
Container with cells to refine. Refinement given as single direction.
autoPtr< mapPolyMesh > doRemovePoints(removePoints &pointRemover, const boolList &pointCanBeDeleted)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool isGap(const scalar, const vector &, const vector &, const vector &, const vector &) const
Is local topology a small gap?
mapType
Enumeration for how the userdata is to be mapped upon refinement.
void checkData()
Debugging: check that all faces still obey start()>end()
bool isNormalGap(const scalar, const vector &, const vector &, const vector &, const vector &) const
Is local topology a small gap normal to the test vector.
static int readFlags(const Enum &namedEnum, const wordList &)
Helper: convert wordList into bit pattern using provided.
Database for solution data, solver performance and other reduced data.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
autoPtr< mapPolyMesh > doRestorePoints(removePoints &pointRemover, const labelList &facesToRestore)
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
static outputType outputLevel()
Get/set output level.
word name(const complex &)
Return a string representation of a complex.
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
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.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
autoPtr< mapPolyMesh > refine(const labelList &cellsToRefine)
Refine some cells.
const hexRef8 & meshCutter() const
Reference to meshcutting engine.
labelList collectFaces(const labelList &candidateFaces, const labelHashSet &set) const
void setInstance(const fileName &)
Set instance of all local IOobjects.
static void collectAndPrint(const UList< point > &points, const UList< T > &data)
Print list according to (collected and) sorted coordinate.
autoPtr< mapPolyMesh > dupNonManifoldPoints()
Find boundary points that connect to more than one cell.
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
autoPtr< mapPolyMesh > zonify(const point &keepPoint, const bool allowFreeStandingZoneFaces)
Put faces/cells into zones according to surface specification.
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
have slaves (upon refinement) from master
labelList growFaceCellFace(const labelHashSet &set) const
bool overwrite() const
Overwrite the mesh?
void checkZoneFaces() const
Debug helper: check faceZones are not on processor patches.
Mesh data needed to do the Finite Volume discretisation.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
const shellSurfaces & shells() const
Reference to refinement shells (regions)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
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.
Removes selected points from mesh and updates faces using these points.
Mesh consisting of general polyhedral cells.
Contains information about location on a triSurface.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
A class for managing temporary objects.
const List< Tuple2< mapType, labelList > > & userFaceData() const
Additional face data that is maintained across.
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
const fvMesh & mesh() const
Reference to mesh.
labelList intersectedFaces() const
Get faces with intersection.
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
A HashTable to objects of type <T> with a label key.