26 for (
const label facei :
cells[celli])
28 cellFld[celli] =
Foam::max(cellFld[celli], faceData[facei]);
53 for (
const label facei :
cells[celli])
55 cellFld[celli] =
Foam::min(cellFld[celli], faceData[facei]);
84 cellFld[own[facei]] =
Foam::min(cellFld[own[facei]], faceData[facei]);
85 cellFld[nei[facei]] =
Foam::min(cellFld[nei[facei]], faceData[facei]);
95 cellFld[celli] =
Foam::max(cellFld[celli], fvp[pfacei]);
113void writeSurfaceField
127 mesh.time().timeName(),
136 fld.primitiveFieldRef() = faceData;
138 Info<<
" Writing face data to " << fName <<
endl;
147 const bool writeFaceFields
150 if (selectedFields.
empty())
155 Info<<
"Writing fields with mesh quality parameters" <<
endl;
157 if (selectedFields.
found(
"nonOrthoAngle"))
169 faceOrthogonality.clamp_range(-1, 1);
183 mesh.time().timeName(),
193 maxFaceToCell(nonOrthoAngle, cellNonOrthoAngle);
194 Info<<
" Writing non-orthogonality (angle) to "
195 << cellNonOrthoAngle.name() <<
endl;
196 cellNonOrthoAngle.write();
203 "face_nonOrthoAngle",
209 if (selectedFields.
found(
"faceWeight"))
216 mesh.time().timeName(),
226 mesh.boundary().size(),
229 mesh.weights().boundaryField().types()
232 minFaceToCell(
mesh.weights(), cellWeights,
false);
233 Info<<
" Writing face interpolation weights (0..0.5) to "
234 << cellWeights.name() <<
endl;
239 writeSurfaceField(
mesh,
"face_faceWeight",
mesh.weights());
247 if (selectedFields.
found(
"skewness"))
268 mesh.time().timeName(),
278 maxFaceToCell(faceSkewness, cellSkewness);
279 Info<<
" Writing face skewness to " << cellSkewness.name() <<
endl;
280 cellSkewness.write();
297 if (selectedFields.
found(
"cellDeterminant"))
304 mesh.time().timeName(),
314 cellDeterminant.primitiveFieldRef() =
322 cellDeterminant.correctBoundaryConditions();
323 Info<<
" Writing cell determinant to "
324 << cellDeterminant.name() <<
endl;
325 cellDeterminant.write();
332 if (selectedFields.
found(
"aspectRatio"))
339 mesh.time().timeName(),
362 aspectRatio.correctBoundaryConditions();
363 Info<<
" Writing aspect ratio to " << aspectRatio.name() <<
endl;
367 if (selectedFields.
found(
"cellAspectRatio"))
374 mesh.time().timeName(),
387 aspectRatio.correctBoundaryConditions();
388 Info<<
" Writing approximate aspect ratio to "
389 << aspectRatio.name() <<
endl;
397 if (selectedFields.
found(
"cellShapes"))
404 mesh.time().timeName(),
418 shape[cellI] = model.
index();
420 shape.correctBoundaryConditions();
421 Info<<
" Writing cell shape (hex, tet etc.) to " << shape.name()
426 if (selectedFields.
found(
"cellVolume"))
433 mesh.time().timeName(),
443 Info<<
" Writing cell volume to " <<
V.name() <<
endl;
447 if (selectedFields.
found(
"cellVolumeRatio"))
463 mesh.time().timeName(),
473 minFaceToCell(faceVolumeRatio, cellVolumeRatio);
474 Info<<
" Writing cell volume ratio to "
475 << cellVolumeRatio.name() <<
endl;
476 cellVolumeRatio.write();
483 "face_cellVolumeRatio",
490 if (selectedFields.
found(
"minTetVolume"))
497 mesh.time().timeName(),
515 const point& fc =
mesh.faceCentres()[facei];
518 const point& ownCc =
mesh.cellCentres()[own[facei]];
519 scalar& ownVol = minTetVolume[own[facei]];
532 if (
mesh.isInternalFace(facei))
534 const point& neiCc =
mesh.cellCentres()[nei[facei]];
535 scalar& neiVol = minTetVolume[nei[facei]];
550 minTetVolume.correctBoundaryConditions();
551 Info<<
" Writing minTetVolume to " << minTetVolume.name() <<
endl;
552 minTetVolume.write();
556 if (selectedFields.
found(
"minPyrVolume"))
563 mesh.time().timeName(),
597 cellFld[own[facei]] =
598 Foam::min(cellFld[own[facei]], ownPyrVol[facei]);
599 cellFld[nei[facei]] =
600 Foam::min(cellFld[nei[facei]], neiPyrVol[facei]);
604 for (
const auto& fvp : minPyrVolume.boundaryField())
611 Foam::min(cellFld[celli], ownPyrVol[meshFacei]);
617 minPyrVolume.correctBoundaryConditions();
618 Info<<
" Writing minPyrVolume to " << minPyrVolume.name() <<
endl;
619 minPyrVolume.write();
629 writeSurfaceField(
mesh,
"face_minPyrVolume", minFacePyrVol);
633 if (selectedFields.
found(
"cellRegion"))
640 mesh.time().timeName(),
653 cellRegion[celli] = rs[celli];
655 cellRegion.correctBoundaryConditions();
656 Info<<
" Writing cell region to " << cellRegion.name() <<
endl;
660 if (selectedFields.
found(
"wallDistance"))
666 if (schemesDict.
found(
"wallDist"))
672 Info<<
" Writing wall distance to " <<
y.name() <<
endl;
683 if (selectedFields.
found(
"cellZone"))
690 mesh.time().timeName(),
701 for (
const auto&
zone : czs)
706 cellZone.correctBoundaryConditions();
710 if (selectedFields.
found(
"faceZone"))
716 for (
const auto&
zone : czs)
728 mesh.time().timeName(),
741 for (
auto& pfld : bfld)
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))
const Mesh & mesh() const noexcept
Return const reference to mesh.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef().
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
void correctBoundaryConditions()
Correct boundary field.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
bool empty() const noexcept
True if the hash table is empty.
bool found(const Key &key) const
Same as contains().
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static FOAM_NO_DANGLING_REFERENCE const wallDist & New(const fvMesh &mesh, Args &&... args)
SubField is a Field obtained as a section of another Field, without its own allocation....
A List with indirect addressing. Like IndirectList but does not store addressing.
(Rough approximation of) cell aspect ratio
Maps a geometry to a set of cell primitives.
label index() const noexcept
Return index of model in the model list.
virtual void write(Ostream &os) const
Write (dictionary entries).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
A subset of mesh faces organised as a primitive patch.
virtual void write(Ostream &os) const
Write (dictionary entries).
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.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual label size() const
Patch size is the number of faces, but can be overloaded.
const polyPatch & patch() const noexcept
Return the polyPatch.
label start() const noexcept
The patch start within the polyMesh face list.
Selector class for finite volume differencing schemes. fvMesh is derived from fvSchemes so that all f...
label start() const noexcept
Return start label of this patch in the polyMesh face list.
const List< T >::subList patchSlice(const UList< T > &values) const
This patch slice from the complete list, which has size mesh::nFaces(), using the number of patch fac...
const labelUList & faceCells() const
Return face-cell addressing.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
static const word null
An empty word.
label index() const noexcept
The index of this zone in the zone list.
const word & name() const noexcept
The zone name.
Base class for mesh zones.
const expr V(m.psi().mesh().V())
List< word > wordList
List of word.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
vector point
Point is a vector.
void writeFields(const fvMesh &mesh, const wordHashSet &selectedFields, const bool writeFaceFields)
static constexpr const zero Zero
Global zero (0).
const dimensionSet dimVolume(pow3(dimLength))
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
UList< label > labelUList
A UList of labels.
fvsPatchField< scalar > fvsPatchScalarField
List< cellShape > cellShapeList
List of cellShape.
dimensionedScalar acos(const dimensionedScalar &ds)
fvPatchField< scalar > fvPatchScalarField
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
cellMask correctBoundaryConditions()
#define forAll(list, i)
Loop across all elements in list.