39 Foam::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++;
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];
113 const label celli = cPoints[
pi][j];
114 if (cellDistLevel_[celli] == level-1)
116 syncMap.insert(
pi,
true);
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;
255 Map<vector> mapCentres =
257 Map<vector> mapNormal =
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])
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))
321 const polyPatch& pp = pRDF.patch().patch();
324 const label pCellI = pp.faceCells()[i];
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);
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 polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelListList & getStencil() noexcept
Stencil reference.
List< labelList > labelListList
A List of labelList.
void size(const label n)
Older name for setAddressableSize.
Map< Type > getDatafromOtherProc(const boolList &zone, const VolumeField< Type > &phi)
Returns stencil and provides a Map with globalNumbering.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
reconstructedDistanceFunction(const fvMesh &mesh)
Construct from fvMesh.
const dimensionSet dimless
Dimensionless.
void updateContactAngle(const volScalarField &alpha, const volVectorField &U, surfaceVectorField::Boundary &nHatb)
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar cos(const dimensionedScalar &ds)
fvPatchField< scalar > fvPatchScalarField
label size() const noexcept
The number of elements in the list.
void markCellsNearSurf(const boolList &interfaceCells, const label neiRingLevel)
constexpr scalar pi(M_PI)
const volScalarField & constructRDF(const boolList &nextToInterface, const volVectorField ¢re, const volVectorField &normal, zoneDistribute &distribute, bool updateStencil=true)
virtual const faceList & faces() const
Return raw faces.
void setUpCommforZone(const boolList &zone, bool updateStencil=true)
Update stencil with boolList the size has to match mesh nCells.
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.
const dimensionedScalar c
Speed of light in a vacuum.
const polyBoundaryMesh & patches
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Class for parallel communication in a narrow band. It either provides a Map with the neighbouring val...
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
List< bool > boolList
A List of bools.
A List with indirect addressing.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
forAllConstIters(mixture.phases(), phase)
Type getValue(const VolumeField< Type > &phi, const Map< Type > &valuesFromOtherProc, const label gblIdx) const
Gives patchNumber and patchFaceNumber for a given Geometric volume field.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
static constexpr const zero Zero
Global zero (0)