75#ifndef dynamicRefineFvMesh_H
76#define dynamicRefineFvMesh_H
92class dynamicRefineFvMesh
95 public dynamicMotionSolverListFvMesh
138 const label maxCells,
139 const label maxRefinement,
140 const scalar refineLevel,
155 const scalar minLevel,
156 const scalar maxLevel
162 const scalar lowerRefineLevel,
163 const scalar upperRefineLevel,
171 const label maxCells,
172 const label maxRefinement,
173 const bitSet& candidateCell
179 const scalar unrefineLevel,
222 dynamicRefineFvMesh(
const dynamicRefineFvMesh&) =
delete;
225 void operator=(
const dynamicRefineFvMesh&) =
delete;
236 explicit dynamicRefineFvMesh
239 const bool doInit=
true
250 virtual bool init(
const bool doInit);
274 virtual void mapFields(
const mapPolyMesh& mpm);
283 const bool writeOnProc
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic GeometricField class.
A HashTable similar to std::unordered_map.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A simple container for options an IOstream can normally have.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
bitSet & protectedCell()
Cells which should not be refined/unrefined.
virtual ~dynamicRefineFvMesh()=default
Destructor.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
void readDict()
Read the projection parameters from dictionary.
scalarField error(const scalarField &fld, const scalar minLevel, const scalar maxLevel) const
scalarField cellToPoint(const scalarField &vFld) const
bool updateTopology()
Update topology (refinement, unrefinement).
void mapNewInternalFaces(const labelList &faceMap, GeometricField< T, fvsPatchField, surfaceMesh > &)
Map single non-flux surface<Type>Field.
hexRef8 meshCutter_
Mesh cutting engine.
scalar getRefineLevel(const label maxCells, const label maxRefinement, const scalar refineLevel, const scalarField &) const
Calculates approximate value for refinement level so.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
const hexRef8 & meshCutter() const
Direct access to the refinement engine.
virtual autoPtr< mapPolyMesh > refine(const labelList &)
Refine cells. Update mesh and fields.
HashTable< word > correctFluxes_
Fluxes to map.
scalarField maxPointField(const scalarField &) const
Get per cell max of connected point.
bool dumpLevel_
Dump cellLevel for post-processing.
void calculateProtectedCells(bitSet &unrefineableCell) const
Calculate cells that cannot be refined since would trigger.
virtual labelList selectRefineCells(const label maxCells, const label maxRefinement, const bitSet &candidateCell) const
Subset candidate cells for refinement.
bitSet protectedCell_
Protected cells (usually since not hexes).
label nRefinementIterations_
Number of refinement/unrefinement steps done so far.
const bitSet & protectedCell() const
Cells which should not be refined/unrefined.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual void selectRefineCandidates(const scalar lowerRefineLevel, const scalar upperRefineLevel, const scalarField &vFld, bitSet &candidateCell) const
Select candidate cells for refinement.
scalarField maxCellField(const volScalarField &) const
Get point max of connected cell.
virtual labelList selectUnrefinePoints(const scalar unrefineLevel, const bitSet &markedCell, const scalarField &pFld) const
Select points that can be unrefined.
TypeName("dynamicRefineFvMesh")
Runtime type information.
void extendMarkedCells(bitSet &markedCell) const
Extend markedCell with cell-face-cell.
virtual void mapFields(const mapPolyMesh &mpm)
Map all fields in time using given map.
virtual autoPtr< mapPolyMesh > unrefine(const labelList &)
Unrefine cells. Gets passed in centre points of cells to combine.
void checkEightAnchorPoints(bitSet &protectedCell) const
Check all cells have 8 anchor points.
const surfaceVectorField & Sf() const
Return cell face area vectors.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
Refinement of (split) hexes using polyTopoChange.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.