60 const scalar dist = allCellInfo[celli].distSqr();
62 if (allCellInfo[celli].valid(wave.
data()))
76 for (
auto& pfld : bfld)
82 const label meshFacei = pfld.patch().start() + patchFacei;
83 const scalar dist = allFaceInfo[meshFacei].distSqr();
85 if (allFaceInfo[meshFacei].valid(wave.
data()))
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_();
150 List<wallPointAddressing> seedInfo(nWalls);
154 for (
const label patchi : patchIDs_)
160 seedFaces[nWalls] = fc.patch().start()+patchFacei;
161 seedInfo[nWalls] = wallPointAddressing
168 gt.nullTransformIndex()
176 List<wallPointAddressing> allCellInfo(mesh_.nCells());
179 forAll(allCellInfo, celli)
181 allCellInfo[celli].
data() = gt.encode
185 gt.nullTransformIndex()
188 List<wallPointAddressing> allFaceInfo(mesh_.nFaces());
189 forAll(allFaceInfo, facei)
191 allFaceInfo[facei].
data() = gt.encode
195 gt.nullTransformIndex()
200 FaceCellWave<wallPointAddressing> wave
207 mesh_.globalData().nTotalCells()+1
214 getValues(wave, allCellInfo, allFaceInfo,
y);
222 Map<label> cellToWallFace;
225 cellToWallFace.resize(2*nWalls);
226 correctBoundaryFaceCells
233 correctBoundaryPointCells
242 y.correctBoundaryConditions();
250 label untransformi = 0;
251 untransformedItems_.resize(mesh_.nCells()+mesh_.nBoundaryFaces());
252 untransformedSlots_.resize(untransformedItems_.size());
254 label transformi = 0;
255 transformedItems_.resize(mesh_.nCells()+mesh_.nBoundaryFaces());
258 for (label celli = 0; celli < mesh_.nCells(); celli++)
260 const auto cellFnd = cellToWallFace.
find(celli);
263 const label wallFacei = cellFnd();
264 const auto& data = allFaceInfo[wallFacei].
data();
265 addItem(celli, data, untransformi, transformi, transformedWallInfo);
267 else if (allCellInfo[celli].valid(wave.
data()))
269 const auto& data = allCellInfo[celli].
data();
270 addItem(celli, data, untransformi, transformi, transformedWallInfo);
273 untransformedPatchStarts_.resize(mesh_.boundary().size()+1);
274 transformedPatchStarts_.resize(mesh_.boundary().size()+1);
275 for (
const auto&
pp : mesh_.boundary())
277 untransformedPatchStarts_[
pp.index()] = untransformi;
278 transformedPatchStarts_[
pp.index()] = transformi;
282 const label facei =
pp.start()+patchFacei;
283 if (allFaceInfo[facei].valid(wave.
data()))
285 const auto& data = allFaceInfo[facei].
data();
298 untransformedItems_.resize(untransformi);
299 untransformedSlots_.resize(untransformi);
300 untransformedPatchStarts_.back() = untransformi;
301 transformedItems_.resize(transformi);
302 transformedWallInfo.
resize(transformi);
303 transformedPatchStarts_.back() = transformi;
308 <<
" : untransformed:" << untransformi
309 <<
" transformed:" << transformi
310 <<
" out of nWalls:" << nWalls
311 <<
" untransformStart:" <<
flatOutput(untransformedPatchStarts_)
312 <<
" transformStart:" <<
flatOutput(transformedPatchStarts_)
316 List<Map<label>> compactMap;
335 OBJstream
os(mesh_.polyMesh::path()/
"nearest.obj");
337 <<
" : writing line from cell/face to nearest wall face to " 343 this->map(wallCentre, mapDistribute::transformPosition());
351 "n" & patchTypeName_,
352 mesh_.time().timeName(),
358 patchDistMethod::patchTypes<vector>(mesh_, patchSet)
361 for (
const label patchi : patchIDs_)
363 auto& pnf =
wallNormal.boundaryFieldRef()[patchi];
364 pnf == pnf.patch().nf();
370 const point& cc = mesh_.C()[celli];
371 const point& wallC = wallCentre[celli];
385 const bool correctWalls,
386 const label updateInterval
390 MeshObject<fvMesh,
Foam::UpdateableMeshObject, wallDistAddressing>(
mesh),
392 patchIDs_(
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>().
sortedToc()),
393 patchTypeName_(
"wall"),
394 updateInterval_(updateInterval),
395 correctWalls_(correctWalls),
396 requireUpdate_(true),
401 "y" & patchTypeName_,
404 IOobjectOption::NO_REGISTER
416 const word& patchTypeName,
419 const bool correctWalls,
420 const label updateInterval
430 patchTypeName_(patchTypeName),
431 updateInterval_(updateInterval),
432 correctWalls_(correctWalls),
433 requireUpdate_(true),
438 "y" & patchTypeName_,
463 (updateInterval_ > 0)
464 && ((mesh_.time().timeIndex() % updateInterval_) == 0)
467 requireUpdate_ =
true;
474 requireUpdate_ =
false;
491 requireUpdate_ =
true;
virtual Ostream & write(const char c)
Write character.
const volScalarField & y() const noexcept
Return reference to cached distance-to-wall field. Unvisited.
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
void resize(const label len)
Adjust allocated size of list.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
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.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
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.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
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.
#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/v2306/OpenFOAM-v2306/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)
Database for solution data, solver performance and other reduced data.
virtual const fileName & name() const
Read/write access to the name of the stream.
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.
List< label > labelList
A List of labels.
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.
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)