53 "volPointInterpolate(" + psi.
name() +
')',
73 scalar
phi[4], phiCandidate[4];
74 label tetLabelCandidate[2], tetPointLabels[2];
81 const vector& cellCentre = this->pMesh_.cellCentres()[cellI];
82 const labelList& cellFaces = this->pMesh_.cells()[cellI];
84 vector projection = position - cellCentre;
85 tetPoints[3] = cellCentre;
92 bool foundTet =
false;
93 label closestFace = -1;
94 scalar minDistance = GREAT;
98 label nFace = cellFaces[faceI];
101 normal /=
mag(normal);
103 const vector& faceCentreTmp = this->pMeshFaceCentres_[nFace];
105 scalar multiplierNumerator = (faceCentreTmp - cellCentre) & normal;
106 scalar multiplierDenominator = projection & normal;
110 if (
mag(multiplierDenominator) > SMALL)
112 scalar multiplier = multiplierNumerator/multiplierDenominator;
113 vector iPoint = cellCentre + multiplier*projection;
114 scalar dist =
mag(position - iPoint);
116 if (dist < minDistance)
131 if (closestFace != -1)
133 label nFace = closestFace;
151 if (minDistance < 1.0
e-5)
154 for (
label i=0; i<4; i++)
156 phi[i] = phiCandidate[i];
158 tetPointLabels[0] = tetLabelCandidate[0];
159 tetPointLabels[1] = tetLabelCandidate[1];
172 while (faceI < cellFaces.
size() && !foundTet)
174 label nFace = cellFaces[faceI];
175 if (nFace < this->pMeshFaceAreas_.size())
198 if (minDistance < 1.0
e-3)
201 for (
label i=0; i<4; i++)
203 phi[i] = phiCandidate[i];
205 tetPointLabels[0] = tetLabelCandidate[0];
206 tetPointLabels[1] = tetLabelCandidate[1];
217 for (
label i=0; i<2; i++)
219 ts[i] = psip_[tetPointLabels[i]];
222 if (closestFace < psis_.size())
224 ts[2] = psis_[closestFace];
229 this->pMesh_.boundaryMesh().whichPatch(closestFace);
233 if (this->psi_.boundaryField()[patchI].size())
235 ts[2] = this->psi_.boundaryField()[patchI]
237 this->pMesh_.boundaryMesh()[patchI].whichFace
245 ts[2] = this->psi_[cellI];
249 ts[3] = this->psi_[cellI];
253 phi[
n] =
min(1.0, phi[
n]);
254 phi[
n] =
max(0.0, phi[n]);
261 Info<<
"interpolationCellPointFace<Type>::interpolate" 262 <<
"(const vector&, const label cellI) const : " 263 <<
"search failed; using closest cellFace value" <<
endl 264 <<
"cell number " << cellI <<
tab 265 <<
"position " << position <<
endl;
267 if (closestFace < psis_.size())
269 t = psis_[closestFace];
274 this->pMesh_.boundaryMesh().whichPatch(closestFace);
278 if (this->psi_.boundaryField()[patchI].size())
280 t = this->psi_.boundaryField()[patchI]
282 this->pMesh_.boundaryMesh()[patchI].whichFace
290 t = this->psi_[cellI];
297 bool foundTriangle = findTriangle
308 for (
label i=0; i<2; i++)
310 Type vel = psip_[tetPointLabels[i]];
315 if (faceI < psis_.size())
317 t += phi[2]*psis_[faceI];
321 label patchI = this->pMesh_.boundaryMesh().whichPatch(faceI);
325 if (this->psi_.boundaryField()[patchI].size())
327 t += phi[2]*this->psi_.boundaryField()[patchI]
328 [this->pMesh_.boundaryMesh()[patchI].whichFace(faceI)];
332 t += phi[2]*this->psi_[cellI];
339 if (faceI < psis_.size())
345 label patchI = this->pMesh_.boundaryMesh().whichPatch(faceI);
349 if (this->psi_.boundaryField()[patchI].size())
351 t = this->psi_.boundaryField()[patchI]
352 [this->pMesh_.boundaryMesh()[patchI].whichFace(faceI)];
356 t = this->psi_[cellI];
dimensioned< scalar > mag(const dimensioned< Type > &)
static const volPointInterpolation & New(const fvMesh &mesh)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Type interpolate(const vector &position, const label cellI, const label faceI=-1) const
Interpolate field to the given point in the given cell.
Abstract base class for interpolation.
void size(const label)
Override size to be inconsistent with allocated storage.
const Mesh & mesh() const
Return mesh.
find the tetrahedron in which the position is. while searching for the tet, store the tet closest to ...
const double e
Elementary charge.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const volScalarField & psi
const word & name() const
Return name.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > linearInterpolate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Generic GeometricField class.
Traits class for primitives.
A normal distribution model.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Tet storage. Null constructable (unfortunately tetrahedron<point, point> is not)
interpolationCellPointFace(const GeometricField< Type, fvPatchField, volMesh > &psi)
Construct from components.