49 const string& description
59 const string& description,
65 Info<<
nl <<
"--- [ cpuTime "
69 if (!description.empty())
71 Info<<
", " << description <<
" ";
90 memoryTable.add(
"mSize", m.size());
91 memoryTable.add(
"mPeak", m.peak());
92 memoryTable.add(
"mRss", m.rss());
95 memoryTable.print(
Info,
true,
true);
122 bitSet boundaryFacesToRemove;
134 cellToDelaunayVertex,
135 patchToDelaunayVertex,
136 boundaryFacesToRemove
139 Info<<
nl <<
"Writing polyMesh to " << instance <<
endl;
153 boundaryFacesToRemove
158 forAll(dualPatchStarts, patchi)
160 dualPatchStarts[patchi] =
165 if (foamyHexMeshControls().writeCellShapeControlMesh())
167 cellShapeControls().shapeControlMesh().write();
170 if (foamyHexMeshControls().writeBackgroundMeshDecomposition())
172 Info<<
nl <<
"Writing " <<
"backgroundMeshDecomposition" <<
endl;
175 const_cast<fvMesh&
>(decomposition_().mesh()).setInstance
180 decomposition_().mesh().
write();
183 if (foamyHexMeshControls().writeTetDualMesh())
188 Finite_cells_iterator cit = finite_cells_begin();
189 cit != finite_cells_end();
199 cit->cellIndex() = celli++;
203 Info<<
nl <<
"Writing " <<
"tetDualMesh" <<
endl;
208 createMesh(
"tetDualMesh", vertexMap, cellMap);
404Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
423 == processorPolyPatch::typeName
434 patchDicts[patchi].get<label>(
"neighbProcNo"),
458void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
477 == processorPolyPatch::typeName
481 const label procNeighb =
482 patchDicts[patchi].get<label>(
"neighbProcNo");
493 bool allMatch =
true;
495 forAll(procPatchSizes, proci)
497 const labelList& patchSizes = procPatchSizes[proci];
499 forAll(patchSizes, patchi)
501 if (patchSizes[patchi] != procPatchSizes[patchi][proci])
505 Info<<
indent <<
"Patches " << proci <<
" and " << patchi
506 <<
" have different sizes: " << patchSizes[patchi]
507 <<
" and " << procPatchSizes[patchi][proci] <<
endl;
514 Info<<
indent <<
"All processor patches have matching numbers of "
521void Foam::conformalVoronoiMesh::reorderPoints
526 const label nInternalFaces
535 for (label fI = nInternalFaces; fI < faces.size(); ++fI)
537 const face&
f = faces[fI];
541 oldToNew[
f[fpI]] = 1;
547 label countInternal = 0;
548 label countExternal = nInternalPoints;
552 if (oldToNew[pI] == 0)
554 oldToNew[pI] = countInternal++;
558 oldToNew[pI] = countExternal++;
563 <<
"Number of internal points: " << countInternal <<
nl
564 <<
indent <<
"Number of external points: " << countExternal
576 f[fpI] = oldToNew[
f[fpI]];
582void Foam::conformalVoronoiMesh::reorderProcessorPatches
584 const word& meshName,
615 const fvMesh& sortMesh = sortMeshPtr();
624 forAll(sortMesh.boundaryMesh(), patchi)
626 const polyPatch&
pp = sortMesh.boundaryMesh()[patchi];
647 pBufs.finishedSends();
652 bool anyChanged =
false;
654 forAll(sortMesh.boundaryMesh(), patchi)
656 const polyPatch&
pp = sortMesh.boundaryMesh()[patchi];
660 const label nPatchFaces =
663 const label patchStartFace =
666 labelList patchFaceMap(nPatchFaces, label(-1));
689 forAll(patchFaceRotation, patchFacei)
691 rotation[patchFacei + patchStartFace]
692 = patchFaceRotation[patchFacei];
695 forAll(patchFaceMap, patchFacei)
697 if (patchFaceMap[patchFacei] != patchFacei)
699 faceMap[patchFacei + patchStartFace]
700 = patchFaceMap[patchFacei] + patchStartFace;
713 label nReorderedFaces = 0;
723 if (nReorderedFaces > 0)
733 if (rotation[facei] != 0)
735 faces[facei] =
rotateList(faces[facei], rotation[facei]);
741 <<
" faces have been reordered" <<
nl
743 <<
" faces have been rotated"
752 const word& meshName,
762 bitSet& boundaryFacesToRemove
765 if (foamyHexMeshControls().objOutput())
769 time().
path()/
word(meshName +
".obj"),
775 const label nInternalFaces =
patchDicts[0].get<label>(
"startFace");
777 reorderPoints(
points, boundaryPts, faces, nInternalFaces);
781 reorderProcessorPatches
795 timeCheck(
"Before fvMesh construction");
817 label nValidPatches = 0;
821 label totalPatchSize =
patchDicts[
p].get<label>(
"nFaces");
828 == processorPolyPatch::typeName
835 "coincidentFullMatch"
839 if (totalPatchSize > 0)
847 processorPolyPatch::typeName
858 if (totalPatchSize > 0)
879 addZones(
mesh, cellCentres);
888 forAll(dualMeshPointTypeNames_, typeI)
891 dualMeshPointTypeNames_[dualMeshPointType(typeI)];
895 const label& bPtType = boundaryPts[ptI];
897 if (bPtType == typeI)
906 <<
"Adding " << bPts.size()
907 <<
" points of type " << znName
933 boundaryFacesToRemove,
937 labelList addr(boundaryFacesToRemove.toc());
942 "indirectPatchFaces",
947 indirectPatchFaces.sync(
mesh);
952 timeCheck(
"Before fvMesh filtering");
956 label nInitialBadFaces = 0;
958 if (foamyHexMeshControls().filterEdges())
960 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
966 nInitialBadFaces = meshFilter().filterEdges(0);
974 polyMeshFilter::copySets(newMesh(),
mesh);
978 if (foamyHexMeshControls().filterFaces())
999 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1003 meshFilter().filter(nInitialBadFaces);
1011 polyMeshFilter::copySets(newMesh(),
mesh);
1015 timeCheck(
"After fvMesh filtering");
1022 <<
"Failed writing polyMesh."
1027 Info<<
nl <<
"Written filtered mesh to "
1028 <<
mesh.polyMesh::instance() <<
nl
1037 "boundaryPoints_collapsed",
1066 boundaryPtsScalarField.write();
1067 boundaryPtsIO.write();
1076 findRemainingProtrusionSet(
mesh);
1086 timeCheck(
"Start writeCellSizes");
1088 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1095 mesh.polyMesh::instance(),
1105 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1111 cellSize[i] = cellShapeControls().cellSize(
C[i]);
1175 targetCellSize.correctBoundaryConditions();
1180 targetCellSize.write();
1290 Info<<
"Writing components of cellCentre positions to volScalarFields"
1291 <<
" ccx, ccy, ccz in " << runTime_.timeName() <<
endl;
1300 runTime_.timeName(),
1318 timeCheck(
"Start findRemainingProtrusionSet");
1330 label meshPtI =
patch.meshPoints()[pLPI];
1336 geometryToConformTo_.wellOutside
1339 sqr(targetCellSize(pt))
1343 protrudingBoundaryPoints.insert(meshPtI);
1351 "foamyHexMesh_remainingProtrusions",
1355 for (
const label pointi : protrudingBoundaryPoints)
1358 protrudingCells.insert(pCells);
1361 const label protrudingCellsSize =
1364 if (foamyHexMeshControls().objOutput() && protrudingCellsSize)
1366 Info<<
nl <<
"Found " << protrudingCellsSize
1367 <<
" cells protruding from the surface, writing cellSet "
1368 << protrudingCells.name()
1371 protrudingCells.write();
1374 return protrudingCells;
1378void Foam::conformalVoronoiMesh::writePointPairs
1387 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1388 eit != finite_edges_end();
1392 Cell_handle
c = eit->first;
1393 Vertex_handle vA =
c->vertex(eit->second);
1394 Vertex_handle vB =
c->vertex(eit->third);
1396 if (ptPairs_.isPointPair(vA, vB))
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Various functions to operate on Lists.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Graphite solid properties.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files.
Ostream & writeLine(const point &p0, const point &p1)
Write line joining two points.
Print a table in parallel, e.g.;.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void setSize(const label n)
Same as resize().
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
A non-owning sub-view of a List (allocated or unallocated storage).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
@ gatherList
gatherList [manual algorithm]
const T * get(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
label size() const noexcept
The number of entries in the list.
static const char *const componentNames[]
static constexpr direction nComponents
Number of components in this vector space.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A collection of cell labels.
double cpuTimeIncrement() const
Return CPU time [seconds] since last call to cpuTimeIncrement(), resetCpuTimeIncrement().
double elapsedCpuTime() const
Return CPU time [seconds] from the start.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Mesh data needed to do the Finite Volume discretisation.
const volVectorField & C() const
Return cell centres as volVectorField.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Memory usage information for the current process, and the system memory that is free.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Remove the edges and faces of a polyMesh whilst satisfying the given mesh quality criteria.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
static word defaultRegion
Return the default region name.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const labelListList & pointCells() const
const vectorField & cellCentres() const
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
Neighbour processor patch.
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const polyBoundaryMesh & patches
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const dimensionedScalar c
Speed of light in a vacuum.
const std::string patch
OpenFOAM patch number as a std::string.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
List< word > wordList
List of word.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
const dimensionSet dimless
Dimensionless.
List< labelList > labelListList
List of labelList.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
pointFromPoint topoint(const Point &P)
IOList< label > labelIOList
IO for a List of label.
messageStream Info
Information stream (stdout output on master, null elsewhere).
ListType rotateList(const ListType &list, const label n)
Rotate a list by n places.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
List< face > faceList
List of faces.
static void check(const int retVal, const char *what)
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.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
HashTable< label, labelPair, Foam::Hash< labelPair > > labelPairLookup
This is a Map of a labelPair to a label. Used for e.g. for face1, face2 to shared edge....
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
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...
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a).
wordList patchNames(nPatches)
PtrList< dictionary > patchDicts
#define forAll(list, i)
Loop across all elements in list.