Go to the documentation of this file.
60 weightingFactors_(nullptr),
61 differenceFactors_(nullptr),
63 correctionVectors_(nullptr),
65 skewCorrectionVectors_(nullptr)
92 if (!weightingFactors_)
97 return (*weightingFactors_);
103 if (!differenceFactors_)
108 return (*differenceFactors_);
114 if (orthogonal_ ==
false && !correctionVectors_)
116 makeCorrectionVectors();
128 <<
"cannot return correctionVectors; mesh is orthogonal"
132 return (*correctionVectors_);
138 if (skew_ ==
true && !skewCorrectionVectors_)
140 makeSkewCorrectionVectors();
153 <<
"cannot return skewCorrectionVectors; mesh is now skewed"
157 return (*skewCorrectionVectors_);
177 void Foam::edgeInterpolation::makeLPN()
const
180 <<
"Constructing geodesic distance between points P and N"
189 faMesh_.time().constant(),
222 - faceCentres[owner[edgeI]]
228 faceCentres[neighbour[edgeI]]
233 lPNIn[edgeI] = (lPE + lEN);
237 forAll(lPN.boundaryField(), patchI)
241 lPN.boundaryFieldRef()[patchI]
244 lPN.boundaryFieldRef()[patchI] = 1.0/lPN.boundaryField()[patchI];
249 <<
"Finished constructing geodesic distance PN"
254 void Foam::edgeInterpolation::makeWeights()
const
257 <<
"Constructing weighting factors for edge interpolation"
266 mesh()().pointsInstance(),
284 scalarField& weightingFactorsIn = weightingFactors.primitiveFieldRef();
292 curSkewCorrVec = skewCorrectionVectors()[edgeI];
300 - faceCentres[owner[edgeI]]
306 faceCentres[neighbour[edgeI]]
311 weightingFactorsIn[edgeI] =
315 # ifdef BAD_MESH_STABILISATION
326 weightingFactors.boundaryFieldRef()[patchI]
331 <<
"Finished constructing weighting factors for face interpolation"
336 void Foam::edgeInterpolation::makeDeltaCoeffs()
const
339 <<
"Constructing differencing factors array for edge gradient"
350 "differenceFactors_",
351 mesh()().pointsInstance(),
382 faceCentres[neighbour[edgeI]]
383 - faceCentres[owner[edgeI]];
385 unitDelta -= edgeNormal*(edgeNormal & unitDelta);
394 curSkewCorrVec = skewCorrectionVectors()[edgeI];
402 - faceCentres[owner[edgeI]]
408 faceCentres[neighbour[edgeI]]
413 scalar lPN = lPE + lEN;
423 dc[edgeI] = 1.0/
max((lPN*(unitDelta & edgeNormal)), 0.05*lPN);
427 forAll(DeltaCoeffs.boundaryField(), patchI)
431 DeltaCoeffs.boundaryFieldRef()[patchI]
437 void Foam::edgeInterpolation::makeCorrectionVectors()
const
440 <<
"Constructing non-orthogonal correction vectors"
448 mesh()().pointsInstance(),
472 vectorField& CorrVecsIn = CorrVecs.primitiveFieldRef();
482 faceCentres[neighbour[edgeI]]
483 - faceCentres[owner[edgeI]];
485 unitDelta -= edgeNormal*(edgeNormal & unitDelta);
492 deltaCoeffs[edgeI] = 1.0/(unitDelta & edgeNormal);
497 - deltaCoeffs[edgeI]*unitDelta;
501 edgeVectorField::Boundary& CorrVecsbf = CorrVecs.boundaryFieldRef();
503 forAll(CorrVecs.boundaryField(), patchI)
505 mesh().
boundary()[patchI].makeCorrectionVectors(CorrVecsbf[patchI]);
508 scalar NonOrthogCoeff = 0.0;
510 if (owner.size() > 0)
516 sinAlpha[edgeI] =
max(-1,
min(sinAlpha[edgeI], 1));
522 reduce(NonOrthogCoeff, maxOp<scalar>());
525 <<
"non-orthogonality coefficient = " << NonOrthogCoeff <<
" deg."
528 if (NonOrthogCoeff < 0.1)
539 <<
"Finished constructing non-orthogonal correction vectors"
544 void Foam::edgeInterpolation::makeSkewCorrectionVectors()
const
547 <<
"Constructing skew correction vectors"
554 "skewCorrectionVectors",
555 mesh()().pointsInstance(),
579 const vector& P =
C[owner[edgeI]];
580 const vector&
N =
C[neighbour[edgeI]];
585 -(((
N - P)^(S - P))&((
N - P)^
e ))/(((
N - P)^
e)&((
N - P)^
e));
589 SkewCorrVecs[edgeI] = Ce[edgeI] - E;
593 edgeVectorField::Boundary& bSkewCorrVecs =
594 SkewCorrVecs.boundaryFieldRef();
596 forAll(SkewCorrVecs.boundaryField(), patchI)
600 if (patchSkewCorrVecs.coupled())
610 forAll(patchSkewCorrVecs, edgeI)
612 const vector& P =
C[edgeFaces[edgeI]];
618 - (((
N - P)^(S - P))&((
N - P)^
e))
619 /(((
N - P)^
e)&((
N - P)^
e));
623 patchSkewCorrVecs[edgeI] =
624 Ce.boundaryField()[patchI][edgeI] - E;
634 scalar skewCoeff = 0.0;
645 - SkewCorrVecs[edgeI]
652 + SkewCorrVecs[edgeI]
658 skewCoeff =
max(
mag(SkewCorrVecs.internalField())/
mag(lPN));
662 <<
"skew coefficient = " << skewCoeff <<
endl;
675 <<
"Finished constructing skew correction vectors"
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
List< edge > edgeList
A List of edges.
dimensionedTensor skew(const dimensionedTensor &dt)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
GeometricField< vector, faePatchField, edgeMesh > edgeVectorField
static constexpr const zero Zero
Global zero (0)
Template functions to aid in the implementation of demand driven data.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
bool skew() const
Return whether mesh is skew or not.
const edgeVectorField & skewCorrectionVectors() const
Return reference to skew vectors array.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
faePatchField< vector > faePatchVectorField
Vector< Cmpt > & normalise()
Normalise the vector by its magnitude.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
void deleteDemandDrivenData(DataPtr &dataPtr)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const edgeScalarField & deltaCoeffs() const
Return reference to difference factors array.
~edgeInterpolation()
Destructor.
void clearOut()
Clear all geometry and addressing.
#define DebugInFunction
Report an information message using Foam::Info.
const edgeScalarField & lPN() const
Return reference to PN geodesic distance.
GeometricField< scalar, faePatchField, edgeMesh > edgeScalarField
bool orthogonal() const
Return whether mesh is orthogonal or not.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
SubList< T > subList
Declare type of subList.
const labelUList & neighbour() const
Internal face neighbour.
errorManip< error > abort(error &err)
Skew-correction vectors for the skewness-corrected interpolation scheme.
Vector< scalar > vector
A scalar version of the templated Vector.
bool movePoints() const
Do what is necessary if the mesh has moved.
const edgeScalarField & weights() const
Return reference to weighting factors array.
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
const edgeVectorField & correctionVectors() const
Return reference to non-orthogonality correction vectors array.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
Finite area mesh. Used for 2-D non-Euclidian finite area method.
static const Vector< Cmpt > zero
const Vector< label > N(dict.get< Vector< label >>("N"))
Calculate the matrix for the second temporal derivative.
edgeInterpolation(const faMesh &)
Construct given an faMesh.
UList< label > labelUList
A UList of labels.
Generic GeometricField class.
defineTypeNameAndDebug(combustionModel, 0)
dimensionedScalar asin(const dimensionedScalar &ds)
const Boundary & boundaryField() const
Return const-reference to the boundary field.