74 auto& bfld =
y.boundaryFieldRef();
76 for (
auto& pfld : bfld)
82 const label meshFacei = pfld.patch().start() + patchFacei;
83 const scalar dist =
allFaceInfo[meshFacei].distSqr();
89 patchField[patchFacei] =
Foam::sqrt(dist) + SMALL;
93 patchField[patchFacei] = dist;
113 const auto& gt = mesh_.globalData().globalTransforms();
115 if (gt.transformIndex(data) == gt.nullTransformIndex())
118 const label proci = gt.processor(data);
119 const label index = gt.index(data);
120 untransformedItems_[untransformi] = item;
121 untransformedSlots_[untransformi++] =
122 globalWallsPtr_().toGlobal(proci, index);
128 transformedWallInfo[transformi++] = data;
137 const auto&
C = mesh_.C();
138 const auto& gt = mesh_.globalData().globalTransforms();
141 for (
const label patchi : patchIDs_)
143 nWalls +=
C.boundaryField()[patchi].size();
147 const globalIndex& globalWalls = globalWallsPtr_();
154 for (
const label patchi : patchIDs_)
156 const auto& fc =
C.boundaryField()[patchi];
157 const auto areaFraction(fc.patch().patch().areaFraction());
164 || (areaFraction()[patchFacei] > 0.5)
167 seedFaces.append(fc.patch().start()+patchFacei);
177 gt.nullTransformIndex()
196 gt.nullTransformIndex()
206 gt.nullTransformIndex()
218 mesh_.globalData().nTotalCells()+1
236 cellToWallFace.reserve(nWalls);
252 correctBoundaryFaceCells
258 correctBoundaryPointCells
268 y.correctBoundaryConditions();
276 label untransformi = 0;
277 untransformedItems_.
resize(mesh_.nCells()+mesh_.nBoundaryFaces());
278 untransformedSlots_.resize(untransformedItems_.size());
280 label transformi = 0;
281 transformedItems_.resize(mesh_.nCells()+mesh_.nBoundaryFaces());
284 for (label celli = 0; celli < mesh_.nCells(); celli++)
286 const auto cellFnd = cellToWallFace.find(celli);
289 const label wallFacei = cellFnd();
291 addItem(celli, data, untransformi, transformi, transformedWallInfo);
296 addItem(celli, data, untransformi, transformi, transformedWallInfo);
299 untransformedPatchStarts_.resize(mesh_.boundary().size()+1);
300 transformedPatchStarts_.resize(mesh_.boundary().size()+1);
301 for (
const auto&
pp : mesh_.boundary())
303 untransformedPatchStarts_[
pp.index()] = untransformi;
304 transformedPatchStarts_[
pp.index()] = transformi;
308 const label facei =
pp.start()+patchFacei;
324 untransformedItems_.resize(untransformi);
325 untransformedSlots_.resize(untransformi);
326 untransformedPatchStarts_.back() = untransformi;
327 transformedItems_.resize(transformi);
328 transformedWallInfo.resize(transformi);
329 transformedPatchStarts_.back() = transformi;
334 <<
" : untransformed:" << untransformi
335 <<
" transformed:" << transformi
336 <<
" out of nWalls:" << nWalls
337 <<
" untransformStart:" <<
flatOutput(untransformedPatchStarts_)
338 <<
" transformStart:" <<
flatOutput(transformedPatchStarts_)
361 OBJstream os(mesh_.polyMesh::path()/
"nearest.obj");
363 <<
" : writing line from cell/face to nearest wall face to "
377 "n" & patchTypeName_,
378 mesh_.time().timeName(),
387 for (
const label patchi : patchIDs_)
389 auto& pnf =
wallNormal.boundaryFieldRef()[patchi];
390 pnf == pnf.patch().nf();
396 const point& cc = mesh_.C()[celli];
397 const point& wallC = wallCentre[celli];
411 const bool correctWalls,
412 const label updateInterval
416 MeshObject_type(
mesh),
419 patchTypeName_(
"wall"),
420 updateInterval_(updateInterval),
421 correctWalls_(correctWalls),
422 requireUpdate_(true),
427 "y" & patchTypeName_,
442 const word& patchTypeName,
445 const bool correctWalls,
446 const label updateInterval
449 MeshObject_type(patchTypeName,
mesh),
452 patchTypeName_(patchTypeName),
453 updateInterval_(updateInterval),
454 correctWalls_(correctWalls),
455 requireUpdate_(true),
460 "y" & patchTypeName_,
485 (updateInterval_ > 0)
486 && ((mesh_.time().timeIndex() % updateInterval_) == 0)
489 requireUpdate_ =
true;
496 requireUpdate_ =
false;
513 requireUpdate_ =
true;
static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5)
Macros for easy insertion into run-time selection tables.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Graphite solid properties.
C() noexcept
Default construct.
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.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
const TrackingData & data() const noexcept
Additional data to be passed into container.
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
void resize(label newCapacity)
Rehash the hash table with new number of buckets. Currently identical to setCapacity().
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
@ NO_REGISTER
Do not request registration (bool: false).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Time & time() const noexcept
Return Time associated with the objectRegistry.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize(const label len)
Adjust allocated size of list.
A HashTable to objects of type <T> with a label key.
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files.
virtual Ostream & write(const char c) override
Write character.
virtual const fileName & name() const override
Read/write access to the name of the stream.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Collection of functions used in wall distance calculation.
const polyMesh & mesh() const
Access mesh.
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
void correctBoundaryCells(const labelList &patchIDs, const bool doPointCells, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to any of the patches in patchIDs. Sets.
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
static bool useCombinedWallPatch
Use combined-wall-patches wall distance v.s. v2406 per-patch distance. Default is true.
Mesh data needed to do the Finite Volume discretisation.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
static wordList patchTypes(const fvMesh &mesh, const labelHashSet &patchIDs)
Return the patch types for y and n.
Variant of wallDist that uses meshWave and stores the addressing.
labelList transformedPatchStarts_
virtual bool movePoints()
Update the y-field when the mesh moves.
const word patchTypeName_
Name for the patch set, e.g. "wall".
labelList untransformedPatchStarts_
Start of patches. Start of untransformedPatchStarts_[0] is end.
void correct(volScalarField &y)
Extract nearest-patch distance data.
volScalarField y_
Distance-to-wall field.
void addItem(const label item, const labelPair &data, label &untransformi, label &transformi, labelPairList &transformedWallInfo)
Store nearest-data to cell or boundary face.
const VolField & map(VolField &fld, const TransformOp &top=mapDistribute::transform()) const
Map nearest-patch information. Take wall patch values.
label getValues(const FaceCellWave< wallPointAddressing > &wave, const List< wallPointAddressing > &allCellInfo, const List< wallPointAddressing > &allFaceInfo, volScalarField &y) const
Extract FaceCellWave data.
const bool correctWalls_
Do accurate distance calculation for near-wall cells.
autoPtr< globalIndex > globalWallsPtr_
Number of wall faces.
labelList untransformedSlots_
Corresponding slot in mapPtr distribution result.
const labelUList & patchIDs() const noexcept
Return the patchIDs.
wallDistAddressing(const wallDistAddressing &)=delete
No copy construct.
virtual ~wallDistAddressing()
Destructor.
bool requireUpdate_
Flag to indicate whether the wall distance requires updating.
autoPtr< mapDistribute > mapPtr_
Map to pull wall face info to cell or boundary face.
labelList transformedSlots_
labelList untransformedItems_
Indices of cells followed by boundary faces.
virtual void updateMesh(const mapPolyMesh &)
Update the y-field when the mesh changes.
const label updateInterval_
Update wall distance every updateInterval_ steps.
const volScalarField & y() const noexcept
Return reference to cached distance-to-wall field. Unvisited.
const labelList patchIDs_
Set of patch IDs.
labelList transformedItems_
Holds information (coordinate and origin) regarding nearest wall point.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
List< wallPoints > allFaceInfo(mesh_.nFaces())
List< wallPoints > allCellInfo(mesh_.nCells())
#define DebugInfo
Report an information message using Foam::Info.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Namespace for handling debugging switches.
Pair< label > labelPair
A pair of labels.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
List< labelPair > labelPairList
List of labelPair.
List< label > labelList
A List of labels.
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
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
line< point, const point & > linePointRef
A line using referred points.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
#define forAll(list, i)
Loop across all elements in list.