31#include "surfaceInterpolate.H"
59 unrefineableCell.
clear();
94 unrefineableCell.
test(own)
95 && (cellLevel[nei] > cellLevel[own])
100 unrefineableCell.
test(nei)
101 && (cellLevel[own] > cellLevel[nei])
116 unrefineableCell.
test(own)
129 bool hasExtended =
false;
133 if (seedFace.test(facei))
147 if (seedFace.test(facei))
151 if (unrefineableCell.
set(own))
181 ).optionalSubDict(
typeName +
"Coeffs")
184 auto fluxVelocities = refineDict.get<
List<Pair<word>>>(
"correctFluxes");
187 correctFluxes_.reserve(fluxVelocities.size());
188 for (
const auto& pr : fluxVelocities)
193 refineDict.readEntry(
"dumpLevel", dumpLevel_);
208 const labelList& cellMap = mpm.cellMap();
209 const labelList& reverseCellMap = mpm.reverseCellMap();
216 const label oldCelli = cellMap[celli];
217 if (oldCelli >= 0 && reverseCellMap[oldCelli] >= 0)
220 nSubCells[oldCelli]++;
228 const auto&
V = this->
V();
231 const label oldCelli = cellMap[celli];
232 if (oldCelli >= 0 && nSubCells[oldCelli] == 8)
236 correctedV0[celli] =
V[celli];
240 const auto& cellsFromCells = mpm.cellsFromCellsMap();
241 for (
const auto&
s : cellsFromCells)
244 const label celli =
s.index();
245 correctedV0[celli] =
V[celli];
253 setV0().field() = correctedV0;
261 const labelList& reverseFaceMap = mpm.reverseFaceMap();
268 bitSet masterFaces(nFaces());
272 const label oldFacei =
faceMap[facei];
276 const label masterFacei = reverseFaceMap[oldFacei];
281 <<
"Problem: should not have removed faces"
283 <<
nl <<
"face:" << facei <<
endl
286 else if (masterFacei != facei)
288 masterFaces.set(masterFacei);
295 Pout<<
"Found " << masterFaces.count() <<
" split faces " <<
endl;
315 <<
"Cannot find surfaceScalarField " <<
phi.name()
316 <<
" in user-provided flux mapping table "
317 << correctFluxes_ <<
endl
318 <<
" The flux mapping table is used to recreate the"
319 <<
" flux on newly created faces." <<
endl
320 <<
" Either add the entry if it is a flux or use ("
321 <<
phi.name() <<
" none) to suppress this warning."
331 Pout<<
"Setting surfaceScalarField " <<
phi.name()
332 <<
" to NaN" <<
endl;
340 Pout<<
"Mapping flux " <<
phi.name()
341 <<
" using interpolated flux " <<
UName
349 lookupObject<volVectorField>(
UName)
355 for (label facei = 0; facei < nInternalFaces(); ++facei)
357 const label oldFacei =
faceMap[facei];
362 phi[facei] = phiU[facei];
364 else if (reverseFaceMap[oldFacei] != facei)
367 phi[facei] = phiU[facei];
372 auto& phiBf =
phi.boundaryFieldRef();
378 phiU.boundaryField()[patchi];
380 label facei = patchPhi.patch().start();
384 const label oldFacei =
faceMap[facei];
389 patchPhi[i] = patchPhiU[i];
391 else if (reverseFaceMap[oldFacei] != facei)
394 patchPhi[i] = patchPhiU[i];
402 for (
const label facei : masterFaces)
404 if (isInternalFace(facei))
406 phi[facei] = phiU[facei];
414 phiU.boundaryField()[patchi];
418 patchPhi[i] = patchPhiU[i];
430 mapNewInternalFaces<scalar>(this->Sf(), this->magSf(),
faceMap);
431 mapNewInternalFaces<vector>(this->Sf(), this->magSf(),
faceMap);
434 mapNewInternalFaces<sphericalTensor>(
faceMap);
435 mapNewInternalFaces<symmTensor>(
faceMap);
449 polyTopoChange meshMod(*
this);
452 meshCutter_.setRefinement(cellsToRefine, meshMod);
462 autoPtr<mapPolyMesh> map = meshMod.changeMesh(*
this,
false);
464 Info<<
"Refined from "
466 <<
" to " << globalData().nTotalCells() <<
" cells." <<
endl;
471 for (label facei = 0; facei < nInternalFaces(); ++facei)
473 const label oldFacei = map().faceMap()[facei];
475 if (oldFacei >= nInternalFaces())
478 <<
"New internal face:" << facei
479 <<
" fc:" << faceCentres()[facei]
480 <<
" originates from boundary oldFace:" << oldFacei
512 meshCutter_.updateMesh(*map);
515 if (protectedCell_.size())
517 bitSet newProtectedCell(nCells());
519 forAll(newProtectedCell, celli)
521 const label oldCelli = map().cellMap()[celli];
522 if (protectedCell_.test(oldCelli))
524 newProtectedCell.set(celli);
527 protectedCell_.transfer(newProtectedCell);
546 meshCutter_.setUnrefinement(splitPoints, meshMod);
558 for (
const label pointi : splitPoints)
560 const labelList& pEdges = pointEdges()[pointi];
562 for (
const label edgei : pEdges)
564 const label otherPointi = edges()[edgei].otherVertex(pointi);
568 for (
const label facei :
pFaces)
570 faceToSplitPoint.
insert(facei, otherPointi);
585 autoPtr<mapPolyMesh> map = meshMod.
changeMesh(*
this,
false);
587 Info<<
"Unrefined from "
589 <<
" to " << globalData().nTotalCells() <<
" cells."
612 const labelList& reversePointMap = map().reversePointMap();
613 const labelList& reverseFaceMap = map().reverseFaceMap();
615 UPtrList<surfaceScalarField> fluxes
627 <<
"Cannot find surfaceScalarField " <<
phi.name()
628 <<
" in user-provided flux mapping table "
629 << correctFluxes_ <<
endl
630 <<
" The flux mapping table is used to recreate the"
631 <<
" flux on newly created faces." <<
endl
632 <<
" Either add the entry if it is a flux or use ("
633 <<
phi.name() <<
" none) to suppress this warning."
643 <<
"Mapping flux " <<
phi.name()
644 <<
" using interpolated flux " <<
UName
647 auto& phiBf =
phi.boundaryFieldRef();
653 lookupObject<volVectorField>(
UName)
661 const label oldFacei = iter.key();
662 const label oldPointi = iter.val();
664 if (reversePointMap[oldPointi] < 0)
667 const label facei = reverseFaceMap[oldFacei];
671 if (isInternalFace(facei))
673 phi[facei] = phiU[facei];
681 phiU.boundaryField()[patchi];
683 patchPhi[i] = patchPhiU[i];
693 meshCutter_.updateMesh(*map);
696 if (protectedCell_.size())
698 bitSet newProtectedCell(nCells());
700 forAll(newProtectedCell, celli)
702 const label oldCelli = map().cellMap()[celli];
703 if (protectedCell_.test(oldCelli))
705 newProtectedCell.set(celli);
708 protectedCell_.transfer(newProtectedCell);
727 for (
const label celli : pCells)
729 vFld[celli] =
max(vFld[celli], pFld[pointi]);
745 for (
const label celli : pCells)
747 pFld[pointi] =
max(pFld[pointi], vFld[celli]);
764 for (
const label celli : pCells)
768 pFld[pointi] =
sum/pCells.size();
777 const scalar minLevel,
778 const scalar maxLevel
785 scalar err =
min(
fld[i]-minLevel, maxLevel-
fld[i]);
798 const scalar lowerRefineLevel,
799 const scalar upperRefineLevel,
822 if (cellError[celli] > 0)
824 candidateCell.set(celli);
832 const label maxCells,
833 const label maxRefinement,
834 const bitSet& candidateCell
838 label nTotToRefine = (maxCells - globalData().nTotalCells()) / 7;
840 const labelList& cellLevel = meshCutter_.cellLevel();
845 calculateProtectedCells(unrefineableCell);
848 label nLocalCandidates = candidateCell.count();
854 if (nCandidates < nTotToRefine)
856 for (
const label celli : candidateCell)
860 (!unrefineableCell.test(celli))
861 && cellLevel[celli] < maxRefinement
864 candidates.append(celli);
871 for (label level = 0; level < maxRefinement; ++level)
873 for (
const label celli : candidateCell)
877 (!unrefineableCell.test(celli))
878 && cellLevel[celli] == level
881 candidates.append(celli);
895 meshCutter_.consistentRefinement
903 <<
" cells for refinement out of " <<
globalData().nTotalCells()
906 return consistentSet;
912 const scalar unrefineLevel,
918 const labelList splitPoints(meshCutter_.getSplitPoints());
928 if (protectedCell_.size())
935 if (protectedCell_.test(celli))
937 protectedPoint.
set(pointi);
953 <<
" protected cells found "
955 <<
" protected points." <<
endl;
959 DynamicList<label> newSplitPoints(splitPoints.
size());
961 for (
const label pointi : splitPoints)
963 if (!protectedPoint[pointi] && pFld[pointi] < unrefineLevel)
966 bool hasMarked =
false;
968 for (
const label celli : pointCells[pointi])
970 if (markedCell.
test(celli))
979 newSplitPoints.append(pointi);
985 newSplitPoints.shrink();
990 meshCutter_.consistentUnrefinement
997 <<
" split points out of a possible "
1001 return consistentSet;
1011 bitSet markedFace(nFaces());
1013 for (
const label celli : markedCell)
1021 for (label facei = 0; facei < nInternalFaces(); ++facei)
1023 if (markedFace.
test(facei))
1025 markedCell.
set(faceOwner()[facei]);
1026 markedCell.
set(faceNeighbour()[facei]);
1029 for (label facei = nInternalFaces(); facei < nFaces(); ++facei)
1031 if (markedFace.
test(facei))
1044 const labelList& cellLevel = meshCutter_.cellLevel();
1045 const labelList& pointLevel = meshCutter_.pointLevel();
1049 forAll(pointLevel, pointi)
1053 for (
const label celli : pCells)
1055 if (pointLevel[pointi] <= cellLevel[celli])
1058 if (nAnchorPoints[celli] == 8)
1060 protectedCell.set(celli);
1063 if (!protectedCell.test(celli))
1065 ++nAnchorPoints[celli];
1072 forAll(protectedCell, celli)
1074 if (nAnchorPoints[celli] != 8)
1076 protectedCell.set(celli);
1084Foam::dynamicRefineFvMesh::dynamicRefineFvMesh
1110 protectedCell_.setSize(nCells());
1111 nRefinementIterations_ = 0;
1118 const labelList& cellLevel = meshCutter_.cellLevel();
1119 const labelList& pointLevel = meshCutter_.pointLevel();
1135 for (
const label celli : pCells)
1137 if (!protectedCell_.test(celli))
1139 if (pointLevel[pointi] <= cellLevel[celli])
1143 if (nAnchors[celli] > 8)
1145 protectedCell_.set(celli);
1161 for (label facei = 0; facei < nInternalFaces(); ++facei)
1163 neiLevel[facei] = cellLevel[faceNeighbour()[facei]];
1165 for (label facei = nInternalFaces(); facei < nFaces(); ++facei)
1167 neiLevel[facei] = cellLevel[faceOwner()[facei]];
1172 bitSet protectedFace(nFaces());
1174 forAll(faceOwner(), facei)
1176 const label faceLevel =
max
1178 cellLevel[faceOwner()[facei]],
1182 const face&
f = faces()[facei];
1186 for (
const label pointi :
f)
1188 if (pointLevel[pointi] <= faceLevel)
1194 protectedFace.set(facei);
1203 for (label facei = 0; facei < nInternalFaces(); ++facei)
1205 if (protectedFace.test(facei))
1207 protectedCell_.set(faceOwner()[facei]);
1208 protectedCell_.set(faceNeighbour()[facei]);
1211 for (label facei = nInternalFaces(); facei < nFaces(); ++facei)
1213 if (protectedFace.test(facei))
1215 protectedCell_.set(faceOwner()[facei]);
1224 if (cFaces.size() < 6)
1226 protectedCell_.set(celli);
1230 for (
const label cfacei : cFaces)
1232 if (faces()[cfacei].size() < 4)
1234 protectedCell_.set(celli);
1242 checkEightAnchorPoints(protectedCell_);
1247 protectedCell_.clear();
1260 <<
" cells that are protected from refinement."
1261 <<
" Writing these to cellSet "
1262 << protectedCells.name()
1265 protectedCells.write();
1292 ).optionalSubDict(
typeName +
"Coeffs")
1295 const label refineInterval = refineDict.
get<label>(
"refineInterval");
1297 bool hasChanged =
false;
1299 if (refineInterval == 0)
1301 topoChanging(hasChanged);
1305 else if (refineInterval < 0)
1308 <<
"Illegal refineInterval " << refineInterval <<
nl
1309 <<
"The refineInterval setting in the dynamicMeshDict should"
1310 <<
" be >= 1." <<
nl
1320 const label maxCells = refineDict.
get<label>(
"maxCells");
1325 <<
"Illegal maximum number of cells " << maxCells <<
nl
1326 <<
"The maxCells setting in the dynamicMeshDict should"
1331 const label maxRefinement = refineDict.
get<label>(
"maxRefinement");
1333 if (maxRefinement <= 0)
1336 <<
"Illegal maximum refinement level " << maxRefinement <<
nl
1337 <<
"The maxCells setting in the dynamicMeshDict should"
1342 const word fieldName(refineDict.
get<
word>(
"field"));
1344 const volScalarField& vFld = lookupObject<volScalarField>(fieldName);
1346 const scalar lowerRefineLevel =
1347 refineDict.
get<scalar>(
"lowerRefineLevel");
1348 const scalar upperRefineLevel =
1349 refineDict.
get<scalar>(
"upperRefineLevel");
1350 const scalar unrefineLevel = refineDict.
getOrDefault<scalar>
1355 const label nBufferLayers = refineDict.
get<label>(
"nBufferLayers");
1361 selectRefineCandidates
1369 if (globalData().nTotalCells() < maxCells)
1391 const labelList& cellMap = map().cellMap();
1392 const labelList& reverseCellMap = map().reverseCellMap();
1394 bitSet newRefineCell(cellMap.size());
1398 const label oldCelli = cellMap[celli];
1403 || (reverseCellMap[oldCelli] != celli)
1407 newRefineCell.set(celli);
1415 for (label i = 0; i < nBufferLayers; ++i)
1429 selectUnrefinePoints
1440 unrefine(pointsToUnrefine);
1447 if ((nRefinementIterations_ % 10) == 0)
1453 nRefinementIterations_++;
1456 topoChanging(hasChanged);
1470 bool hasChanged = updateTopology();
1481 const bool writeOnProc
1491 && meshCutter_.write(writeOnProc)
1511 const labelList& cellLevel = meshCutter_.cellLevel();
1515 scalarCellLevel[celli] = cellLevel[celli];
1518 writeOk = writeOk && scalarCellLevel.
write();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const word UName(propsDict.getOrDefault< word >("U", "U"))
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))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
A simple container for options an IOstream can normally have.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A HashTable to objects of type <T> with a label key.
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
void clear()
Clear the list, i.e. set addressable size to zero.
void reset()
Clear all bits but do not adjust the addressable size.
void size(const label n)
Older name for setAddressableSize.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
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...
unsigned int count(const bool on=true) const
Count number of bits set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A collection of cell labels.
A topoSetPointSource to select all the points from given cellSet(s).
A cell is defined as a list of faces with extra functionality.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
Abstract base class for geometry and/or topology changing fvMesh.
Dynamic mesh able to handle multiple motion solvers. NOTE: If the word entry "solvers" is not found i...
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual void mapFields(const mapPolyMesh &mpm)
Map all fields in time using given map. Triggered by topo change.
A fvMesh with built-in refinement.
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.
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.
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.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
A face is a list of labels corresponding to mesh vertices.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write the underlying polyMesh and other data.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
DimensionedField< scalar, volMesh > & setV0()
Return old-time cell volumes.
const Time & time() const
Return the top-level database.
const surfaceScalarField & phi() const
Return cell face motion fluxes.
const DimensionedField< scalar, volMesh > & V0() const
Return old-time cell volumes.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
const surfaceVectorField & Sf() const
Return cell face area vectors.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
label start() const noexcept
The patch start within the polyMesh face list.
const fvPatch & patch() const noexcept
Return the patch.
Refinement of (split) hexes using polyTopoChange.
const labelIOList & cellLevel() const
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseCellMap() const noexcept
Reverse cell map.
label nOldCells() const noexcept
Number of old cells.
const List< objectMap > & cellsFromCellsMap() const noexcept
Cells originating from cells.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
const labelList & faceMap() const noexcept
Old face map.
const labelList & cellMap() const noexcept
Old cell map.
UPtrList< Type > sorted()
Return sorted list of objects with a class satisfying isA<Type> or isType<Type> (with Strict).
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
Smooth ATC in cells having a point to a set of patches supplied by type.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
virtual const faceList & faces() const
Return raw faces.
bool moving() const noexcept
Is mesh moving.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info (demand-driven).
bool topoChanging() const noexcept
Is mesh topology changing.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces).
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
label nInternalFaces() const noexcept
Number of internal faces.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
const labelListList & pointFaces() const
Container with cells to refine. Refinement given as single direction.
All refinement history. Used in unrefinement.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static void fillNan(char *buf, size_t count)
Fill data block with signaling_NaN values. Does a reinterpret to Foam::scalar.
void clearOut()
Clear all geometry and addressing.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
const expr V(m.psi().mesh().V())
labelHashSet used(const bitSet &select)
Convert a bitset to a labelHashSet of the indices used.
const dimensionedScalar c
Speed of light in a vacuum.
Different types of constants.
Namespace for handling debugging switches.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvsPatchField< scalar > fvsPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};constexpr label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.