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);
237 correctBoundaryFaceCells
244 correctBoundaryPointCells
253 y.correctBoundaryConditions();
261 label untransformi = 0;
262 untransformedItems_.resize(mesh_.nCells()+mesh_.nBoundaryFaces());
263 untransformedSlots_.resize(untransformedItems_.size());
265 label transformi = 0;
266 transformedItems_.resize(mesh_.nCells()+mesh_.nBoundaryFaces());
269 for (label celli = 0; celli < mesh_.nCells(); celli++)
271 const auto cellFnd = cellToWallFace.
find(celli);
274 const label wallFacei = cellFnd();
276 addItem(celli, data, untransformi, transformi, transformedWallInfo);
281 addItem(celli, data, untransformi, transformi, transformedWallInfo);
284 untransformedPatchStarts_.resize(mesh_.boundary().size()+1);
285 transformedPatchStarts_.resize(mesh_.boundary().size()+1);
286 for (
const auto&
pp : mesh_.boundary())
288 untransformedPatchStarts_[
pp.index()] = untransformi;
289 transformedPatchStarts_[
pp.index()] = transformi;
293 const label facei =
pp.start()+patchFacei;
309 untransformedItems_.resize(untransformi);
310 untransformedSlots_.resize(untransformi);
311 untransformedPatchStarts_.back() = untransformi;
312 transformedItems_.resize(transformi);
313 transformedWallInfo.
resize(transformi);
314 transformedPatchStarts_.back() = transformi;
319 <<
" : untransformed:" << untransformi
320 <<
" transformed:" << transformi
321 <<
" out of nWalls:" << nWalls
322 <<
" untransformStart:" <<
flatOutput(untransformedPatchStarts_)
323 <<
" transformStart:" <<
flatOutput(transformedPatchStarts_)
327 List<Map<label>> compactMap;
346 OBJstream
os(mesh_.polyMesh::path()/
"nearest.obj");
348 <<
" : writing line from cell/face to nearest wall face to " 354 this->map(wallCentre, mapDistribute::transformPosition());
362 "n" & patchTypeName_,
363 mesh_.time().timeName(),
369 patchDistMethod::patchTypes<vector>(mesh_, patchSet)
372 for (
const label patchi : patchIDs_)
374 auto& pnf =
wallNormal.boundaryFieldRef()[patchi];
375 pnf == pnf.patch().nf();
381 const point& cc = mesh_.C()[celli];
382 const point& wallC = wallCentre[celli];
396 const bool correctWalls,
397 const label updateInterval
401 MeshObject_type(
mesh),
403 patchIDs_(
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>().
sortedToc()),
404 patchTypeName_(
"wall"),
405 updateInterval_(updateInterval),
406 correctWalls_(correctWalls),
407 requireUpdate_(true),
412 "y" & patchTypeName_,
415 IOobjectOption::NO_REGISTER
427 const word& patchTypeName,
430 const bool correctWalls,
431 const label updateInterval
434 MeshObject_type(patchTypeName,
mesh),
437 patchTypeName_(patchTypeName),
438 updateInterval_(updateInterval),
439 correctWalls_(correctWalls),
440 requireUpdate_(true),
445 "y" & patchTypeName_,
470 (updateInterval_ > 0)
471 && ((mesh_.time().timeIndex() % updateInterval_) == 0)
474 requireUpdate_ =
true;
481 requireUpdate_ =
false;
498 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.
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.
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/release/v2406/OpenFOAM-v2406/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.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
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)