39Foam::reconstructedDistanceFunction::coupledFacesPatch()
const
45 for (
const polyPatch& pp :
patches)
47 if (isA<coupledPolyPatch>(pp))
49 nCoupled += pp.
size();
55 for (
const polyPatch& pp :
patches)
57 if (isA<coupledPolyPatch>(pp))
59 label facei = pp.start();
63 nCoupledFaces[nCoupled++] = facei++;
70 IndirectList<face>(mesh_.
faces(), std::move(nCoupledFaces)),
79 const label neiRingLevel
84 if (mesh_.topoChanging())
87 if (nextToInterface_.size() != mesh_.nCells())
89 nextToInterface_.resize(mesh_.nCells());
91 coupledBoundaryPoints_ = coupledFacesPatch()().meshPoints();
97 boolList alreadyMarkedPoint(mesh_.nPoints(),
false);
98 nextToInterface_ =
false;
103 for (label level=0;level<=neiRingLevel;level++)
108 forAll(coupledBoundaryPoints_, i)
110 const label pi = coupledBoundaryPoints_[i];
111 forAll(mesh_.pointCells()[pi], j)
113 const label celli = cPoints[pi][j];
114 if (cellDistLevel_[celli] == level-1)
127 const label pi = iter.key();
129 if (!alreadyMarkedPoint[pi])
134 const label pCelli = cPoints[pi][j];
135 if (cellDistLevel_[pCelli] == -1)
137 cellDistLevel_[pCelli] = level;
138 nextToInterface_[pCelli] =
true;
142 alreadyMarkedPoint[pi] =
true;
147 forAll(cellDistLevel_, celli)
151 if (interfaceCells[celli])
153 cellDistLevel_[celli] = 0;
154 nextToInterface_[celli] =
true;
158 cellDistLevel_[celli] = -1;
163 if (cellDistLevel_[celli] == level-1)
167 const label pI = pCells[celli][i];
169 if (!alreadyMarkedPoint[pI])
173 const label pCelli = cPoints[pI][j];
174 if (cellDistLevel_[pCelli] == -1)
176 cellDistLevel_[pCelli] = level;
177 nextToInterface_[pCelli] =
true;
181 alreadyMarkedPoint[pI] =
true;
211 coupledBoundaryPoints_(coupledFacesPatch()().meshPoints()),
225 nextToInterface_(
mesh.nCells(), false)
242 if (nextToInterface.
size() != centre.
size())
245 <<
"size of nextToInterface: " << nextToInterface.
size()
246 <<
"size of centre:" << centre.
size()
247 <<
"do not match. Did the mesh change?"
249 return reconDistFunc;
263 forAll(nextToInterface,celli)
265 if (nextToInterface[celli])
267 if (
mag(normal[celli]) != 0)
270 scalar dist = (centre[celli] - mesh_.C()[celli]) &
n;
271 reconDistFunc[celli] = dist;
275 scalar averageDist = 0;
276 scalar avgWeight = 0;
277 const point p = mesh_.C()[celli];
279 for (
const label gblIdx : stencil[celli])
286 vector distanceToIntSeg = (c -
p);
287 scalar distToSurf = distanceToIntSeg & (
n);
290 if (
mag(distanceToIntSeg) != 0)
292 distanceToIntSeg /=
mag(distanceToIntSeg);
293 weight =
sqr(
mag(distanceToIntSeg &
n));
299 averageDist += distToSurf * weight;
306 reconDistFunc[celli] = averageDist / avgWeight;
312 reconDistFunc[celli] = 0;
319 if (isA<calculatedFvPatchScalarField>(pRDF))
326 if (nextToInterface_[pCellI])
328 scalar averageDist = 0;
329 scalar avgWeight = 0;
332 forAll(stencil[pCellI], j)
334 const label gblIdx = stencil[pCellI][j];
340 distribute.
getValue(centre, mapCentres, gblIdx);
341 vector distanceToIntSeg = (c -
p);
342 scalar distToSurf = distanceToIntSeg & (
n);
345 if (
mag(distanceToIntSeg) != 0)
347 distanceToIntSeg /=
mag(distanceToIntSeg);
348 weight =
sqr(
mag(distanceToIntSeg &
n));
354 averageDist += distToSurf * weight;
361 pRDF[i] = averageDist / avgWeight;
378 return reconDistFunc;
397 if (isA<alphaContactAngleTwoPhaseFvPatchScalarField>(abf[patchi]))
402 refCast<const alphaContactAngleTwoPhaseFvPatchScalarField>
415 1/acap.patch().deltaCoeffs()*
cos(theta)
416 + RDFbf[patchi].patchInternalField();
const Mesh & mesh() const
Return mesh.
Generic GeometricBoundaryField class.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A HashTable to objects of type <T> with a label key.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const fvPatch & patch() const
Return patch.
const polyPatch & patch() const
Return the polyPatch.
virtual const faceList & faces() const
Return raw faces.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
const labelUList & faceCells() const
Return face-cell addressing.
Calculates a reconstructed distance function.
void markCellsNearSurf(const boolList &interfaceCells, const label neiRingLevel)
const volScalarField & constructRDF(const boolList &nextToInterface, const volVectorField ¢re, const volVectorField &normal, zoneDistribute &distribute, bool updateStencil=true)
void updateContactAngle(const volScalarField &alpha, const volVectorField &U, surfaceVectorField::Boundary &nHatb)
Class for parallel communication in a narrow band. It either provides a Map with the neighbouring val...
void setUpCommforZone(const boolList &zone, bool updateStencil=true)
Update stencil with boolList the size has to match mesh nCells.
Type getValue(const VolumeField< Type > &phi, const Map< Type > &valuesFromOtherProc, const label gblIdx) const
const labelListList & getStencil() noexcept
Stencil reference.
Map< Type > getDatafromOtherProc(const boolList &zone, const VolumeField< Type > &phi)
Returns stencil and provides a Map with globalNumbering.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionSet dimless
Dimensionless.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Unit conversion functions.