50 "volPointInterpolate(" +
psi.
name() +
')',
70 scalar
phi[4], phiCandidate[4];
71 label tetLabelCandidate[2], tetPointLabels[2];
78 const vector& cellCentre = this->pMesh_.cellCentres()[celli];
79 const labelList& cellFaces = this->pMesh_.cells()[celli];
81 vector projection = position - cellCentre;
89 bool foundTet =
false;
90 label closestFace = -1;
91 scalar minDistance = GREAT;
93 for (
const label nFace : cellFaces)
97 const vector& faceCentreTmp = this->pMeshFaceCentres_[nFace];
99 scalar multiplierNumerator = (faceCentreTmp - cellCentre) & normal;
100 scalar multiplierDenominator = projection & normal;
104 if (
mag(multiplierDenominator) > SMALL)
106 scalar multiplier = multiplierNumerator/multiplierDenominator;
107 vector iPoint = cellCentre + multiplier*projection;
108 scalar dist =
mag(position - iPoint);
110 if (dist < minDistance)
125 if (closestFace != -1)
127 label nFace = closestFace;
145 if (minDistance < 1.0
e-5)
148 for (label i=0; i<4; i++)
150 phi[i] = phiCandidate[i];
152 tetPointLabels[0] = tetLabelCandidate[0];
153 tetPointLabels[1] = tetLabelCandidate[1];
166 while (facei < cellFaces.size() && !foundTet)
168 label nFace = cellFaces[facei];
169 if (nFace < this->pMeshFaceAreas_.size())
192 if (minDistance < 1.0
e-3)
195 for (label i=0; i<4; i++)
197 phi[i] = phiCandidate[i];
199 tetPointLabels[0] = tetLabelCandidate[0];
200 tetPointLabels[1] = tetLabelCandidate[1];
211 for (label i=0; i<2; i++)
213 ts[i] = psip_[tetPointLabels[i]];
216 if (closestFace < psis_.size())
218 ts[2] = psis_[closestFace];
223 this->pMesh_.boundaryMesh().whichPatch(closestFace);
227 if (this->psi_.boundaryField()[patchi].size())
229 ts[2] = this->psi_.boundaryField()[patchi]
231 this->pMesh_.boundaryMesh()[patchi].whichFace
239 ts[2] = this->psi_[celli];
243 ts[3] = this->psi_[celli];
245 for (label
n=0;
n<4;
n++)
256 <<
"search failed; using closest cellFace value" <<
endl 257 <<
"cell number " << celli <<
tab 258 <<
"position " << position <<
endl;
260 if (closestFace < psis_.size())
262 t = psis_[closestFace];
267 this->pMesh_.boundaryMesh().whichPatch(closestFace);
271 if (this->psi_.boundaryField()[patchi].size())
273 t = this->psi_.boundaryField()[patchi]
275 this->pMesh_.boundaryMesh()[patchi].whichFace
283 t = this->psi_[celli];
290 bool foundTriangle = findTriangle
301 for (label i=0; i<2; i++)
303 Type vel = psip_[tetPointLabels[i]];
308 if (facei < psis_.size())
310 t +=
phi[2]*psis_[facei];
314 label patchi = this->pMesh_.boundaryMesh().whichPatch(facei);
318 if (this->psi_.boundaryField()[patchi].size())
320 t +=
phi[2]*this->psi_.boundaryField()[patchi]
321 [this->pMesh_.boundaryMesh()[patchi].whichFace(facei)];
325 t +=
phi[2]*this->psi_[celli];
332 if (facei < psis_.size())
338 label patchi = this->pMesh_.boundaryMesh().whichPatch(facei);
342 if (this->psi_.boundaryField()[patchi].size())
344 t = this->psi_.boundaryField()[patchi]
345 [this->pMesh_.boundaryMesh()[patchi].whichFace(facei)];
349 t = this->psi_[celli];
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > linearInterpolate(const GeometricField< Type, fvPatchField, volMesh > &vf)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
constexpr char tab
The tab '\t' character(0x09)
Generic GeometricField class.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Type interpolate(const vector &position, const label celli, const label facei=-1) const
Interpolate field to the given point in the given cell.
Tet point storage. Default constructable (tetrahedron is not)
interpolationCellPointFace(const GeometricField< Type, fvPatchField, volMesh > &psi)
Construct from components.
Abstract base class for volume field interpolation.
find the tetrahedron in which the position is. while searching for the tet, store the tet closest to ...
const volScalarField & psi
#define InfoInFunction
Report an information message using Foam::Info.
static constexpr const zero Zero
Global zero (0)