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);
127 transformedItems_[transformi] = item;
128 transformedWallInfo[transformi++] = data;
137 const auto&
C = mesh_.C();
138 const auto& gt = mesh_.globalData().globalTransforms();
141 for (
const label patchi : patchIDs_)
146 globalWallsPtr_.reset(
new globalIndex(nWalls));
147 const globalIndex& globalWalls = globalWallsPtr_();
149 DynamicList<label> seedFaces(nWalls);
150 DynamicList<wallPointAddressing> seedInfo(nWalls);
154 for (
const label patchi : patchIDs_)
157 const auto areaFraction(fc.patch().patch().areaFraction());
164 || (areaFraction()[patchFacei] > 0.5)
167 seedFaces.append(fc.patch().start()+patchFacei);
177 gt.nullTransformIndex()
187 List<wallPointAddressing>
allCellInfo(mesh_.nCells());
196 gt.nullTransformIndex()
199 List<wallPointAddressing>
allFaceInfo(mesh_.nFaces());
206 gt.nullTransformIndex()
211 FaceCellWave<wallPointAddressing> wave
218 mesh_.globalData().nTotalCells()+1
233 Map<label> cellToWallFace;
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_)
342 List<Map<label>> compactMap;
361 OBJstream
os(mesh_.polyMesh::path()/
"nearest.obj");
363 <<
" : writing line from cell/face to nearest wall face to " 369 this->map(wallCentre, mapDistribute::transformPosition());
377 "n" & patchTypeName_,
378 mesh_.time().timeName(),
384 patchDistMethod::patchTypes<vector>(mesh_, patchSet)
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),
418 patchIDs_(
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>().
sortedToc()),
419 patchTypeName_(
"wall"),
420 updateInterval_(updateInterval),
421 correctWalls_(correctWalls),
422 requireUpdate_(true),
427 "y" & patchTypeName_,
430 IOobjectOption::NO_REGISTER
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;
const labelList patchIDs(pbm.indices(polyPatchNames, true))
const volScalarField & y() const noexcept
Return reference to cached distance-to-wall field. Unvisited.
List< wallPoints > allCellInfo(mesh_.nCells())
virtual Ostream & write(const char c) override
Write character.
void resize(const label len)
Adjust allocated size of list.
virtual const fileName & name() const override
Read/write access to the name of the stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
wallDistAddressing(const wallDistAddressing &)=delete
No copy construct.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
label getValues(const FaceCellWave< wallPointAddressing > &wave, const List< wallPointAddressing > &allCellInfo, const List< wallPointAddressing > &allFaceInfo, volScalarField &y) const
Extract FaceCellWave data.
void correct(volScalarField &y)
Extract nearest-patch distance data.
const TrackingData & data() const noexcept
Additional data to be passed into container.
List< labelPair > labelPairList
List of labelPair.
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
GeometricField< vector, fvPatchField, volMesh > volVectorField
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Collection of functions used in wall distance calculation.
static bool useCombinedWallPatch
Use combined-wall-patches wall distance v.s. v2406 per-patch distance. Default is true...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
line< point, const point & > linePointRef
A line using referred points.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label size() const noexcept
The number of entries in the list.
virtual ~wallDistAddressing()
Destructor.
label find(const T &val) const
Find index of the first occurrence of the value.
#define DebugInfo
Report an information message using Foam::Info.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
virtual void updateMesh(const mapPolyMesh &)
Update the y-field when the mesh changes.
int debug
Static debugging option.
Pair< label > labelPair
A pair of labels.
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil) - psi) *pSat, rhoMin);# 1 "/home/chef2/andy/OpenFOAM/work/develop/openfoam/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=clamp((rho - rholSat)/(rhovSat - rholSat), zero_one{});alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
vector point
Point is a vector.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
virtual bool movePoints()
Update the y-field when the mesh moves.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
List< wallPoints > allFaceInfo(mesh_.nFaces())
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
void addItem(const label item, const labelPair &data, label &untransformi, label &transformi, labelPairList &transformedWallInfo)
Store nearest-data to cell or boundary face.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Variant of wallDist that uses meshWave and stores the addressing.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)