48 "volPointInterpolate(" + psi.
name() +
')',
68 scalar
phi[4], phiCandidate[4];
69 label tetLabelCandidate[2], tetPointLabels[2];
76 const vector& cellCentre = this->mesh_.cellCentres()[celli];
77 const labelList& cellFaces = this->mesh_.cells()[celli];
79 vector projection = position - cellCentre;
80 tetPoints[3] = cellCentre;
87 bool foundTet =
false;
88 label closestFace = -1;
89 scalar minDistance = great;
93 label nFace = cellFaces[facei];
95 vector normal = this->mesh_.faceAreas()[nFace];
96 normal /=
mag(normal);
98 const vector& faceCentreTmp = this->mesh_.faceCentres()[nFace];
100 scalar multiplierNumerator = (faceCentreTmp - cellCentre) & normal;
101 scalar multiplierDenominator = projection & normal;
105 if (
mag(multiplierDenominator) > small)
107 scalar multiplier = multiplierNumerator/multiplierDenominator;
108 vector iPoint = cellCentre + multiplier*projection;
109 scalar dist =
mag(position - iPoint);
111 if (dist < minDistance)
126 if (closestFace != -1)
128 label nFace = closestFace;
146 if (minDistance < 1.0
e-5)
149 for (
label i=0; i<4; i++)
151 phi[i] = phiCandidate[i];
153 tetPointLabels[0] = tetLabelCandidate[0];
154 tetPointLabels[1] = tetLabelCandidate[1];
167 while (facei < cellFaces.
size() && !foundTet)
169 label nFace = cellFaces[facei];
170 if (nFace < this->mesh_.faceAreas().size())
193 if (minDistance < 1.0
e-3)
196 for (
label i=0; i<4; i++)
198 phi[i] = phiCandidate[i];
200 tetPointLabels[0] = tetLabelCandidate[0];
201 tetPointLabels[1] = tetLabelCandidate[1];
212 for (
label i=0; i<2; i++)
214 ts[i] = psip_[tetPointLabels[i]];
217 if (closestFace < psis_.size())
219 ts[2] = psis_[closestFace];
224 this->mesh_.boundaryMesh().whichPatch(closestFace);
228 if (this->psi_.boundaryField()[
patchi].size())
230 ts[2] = this->psi_.boundaryField()[
patchi]
232 this->mesh_.boundaryMesh()[
patchi].whichFace
240 ts[2] = this->psi_[celli];
244 ts[3] = this->psi_[celli];
248 phi[
n] =
min(1.0, phi[
n]);
249 phi[
n] =
max(0.0, phi[n]);
257 <<
"search failed; using closest cellFace value" <<
endl 258 <<
"cell number " << celli <<
tab 259 <<
"position " << position <<
endl;
261 if (closestFace < psis_.size())
263 t = psis_[closestFace];
268 this->mesh_.boundaryMesh().whichPatch(closestFace);
272 if (this->psi_.boundaryField()[
patchi].size())
274 t = this->psi_.boundaryField()[
patchi]
276 this->mesh_.boundaryMesh()[
patchi].whichFace
284 t = this->psi_[celli];
291 bool foundTriangle = findTriangle
302 for (
label i=0; i<2; i++)
304 Type vel = psip_[tetPointLabels[i]];
309 if (facei < psis_.size())
311 t += phi[2]*psis_[facei];
315 label patchi = this->mesh_.boundaryMesh().whichPatch(facei);
319 if (this->psi_.boundaryField()[
patchi].size())
321 t += phi[2]*this->psi_.boundaryField()[
patchi]
322 [this->mesh_.boundaryMesh()[
patchi].whichFace(facei)];
326 t += phi[2]*this->psi_[celli];
333 if (facei < psis_.size())
339 label patchi = this->mesh_.boundaryMesh().whichPatch(facei);
343 if (this->psi_.boundaryField()[
patchi].size())
345 t = this->psi_.boundaryField()[
patchi]
346 [this->mesh_.boundaryMesh()[
patchi].whichFace(facei)];
350 t = this->psi_[celli];
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const word & name() const
Return name.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > linearInterpolate(const GeometricField< Type, fvPatchField, volMesh > &vf)
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Generic GeometricField class.
const volScalarField & psi
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const Mesh & mesh() const
Return mesh.
Type interpolate(const vector &position, const label celli, const label facei=-1) const
Interpolate field to the given point in the given cell.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
interpolationCellPointFace(const GeometricField< Type, fvPatchField, volMesh > &psi)
Construct from components.
find the tetrahedron in which the position is. while searching for the tet, store the tet closest to ...
dimensioned< scalar > mag(const dimensioned< Type > &)
const dimensionedScalar e
Elementary charge.
#define InfoInFunction
Report an information message using Foam::Info.