Go to the documentation of this file.
61 weightingFactors_(nullptr),
62 differenceFactors_(nullptr),
64 correctionVectors_(nullptr),
66 skewCorrectionVectors_(nullptr)
95 if (!weightingFactors_)
100 return (*weightingFactors_);
106 if (!differenceFactors_)
111 return (*differenceFactors_);
117 if (orthogonal_ ==
false && !correctionVectors_)
119 makeCorrectionVectors();
131 <<
"cannot return correctionVectors; mesh is orthogonal"
135 return (*correctionVectors_);
141 if (skew_ ==
true && !skewCorrectionVectors_)
143 makeSkewCorrectionVectors();
156 <<
"cannot return skewCorrectionVectors; mesh is now skewed"
160 return (*skewCorrectionVectors_);
207 void Foam::edgeInterpolation::makeLPN()
const
210 <<
"Constructing geodesic distance between points P and N"
219 faMesh_.time().constant(),
252 - faceCentres[owner[edgeI]]
258 faceCentres[neighbour[edgeI]]
263 lPNIn[edgeI] = (lPE + lEN);
267 forAll(lPN.boundaryField(), patchI)
271 lPN.boundaryFieldRef()[patchI]
274 lPN.boundaryFieldRef()[patchI] = 1.0/lPN.boundaryField()[patchI];
279 <<
"Finished constructing geodesic distance PN"
284 void Foam::edgeInterpolation::makeWeights()
const
287 <<
"Constructing weighting factors for edge interpolation"
296 mesh()().pointsInstance(),
314 scalarField& weightingFactorsIn = weightingFactors.primitiveFieldRef();
322 curSkewCorrVec = skewCorrectionVectors()[edgeI];
330 - faceCentres[owner[edgeI]]
336 faceCentres[neighbour[edgeI]]
341 weightingFactorsIn[edgeI] =
345 # ifdef BAD_MESH_STABILISATION
356 weightingFactors.boundaryFieldRef()[patchI]
361 <<
"Finished constructing weighting factors for face interpolation"
366 void Foam::edgeInterpolation::makeDeltaCoeffs()
const
369 <<
"Constructing differencing factors array for edge gradient"
380 "differenceFactors_",
381 mesh()().pointsInstance(),
412 faceCentres[neighbour[edgeI]]
413 - faceCentres[owner[edgeI]];
415 unitDelta -= edgeNormal*(edgeNormal & unitDelta);
424 curSkewCorrVec = skewCorrectionVectors()[edgeI];
432 - faceCentres[owner[edgeI]]
438 faceCentres[neighbour[edgeI]]
443 scalar lPN = lPE + lEN;
453 dc[edgeI] = 1.0/
max((lPN*(unitDelta & edgeNormal)), 0.05*lPN);
457 forAll(DeltaCoeffs.boundaryField(), patchI)
461 DeltaCoeffs.boundaryFieldRef()[patchI]
467 void Foam::edgeInterpolation::makeCorrectionVectors()
const
470 <<
"Constructing non-orthogonal correction vectors"
478 mesh()().pointsInstance(),
502 vectorField& CorrVecsIn = CorrVecs.primitiveFieldRef();
512 faceCentres[neighbour[edgeI]]
513 - faceCentres[owner[edgeI]];
515 unitDelta -= edgeNormal*(edgeNormal & unitDelta);
522 deltaCoeffs[edgeI] = 1.0/(unitDelta & edgeNormal);
527 - deltaCoeffs[edgeI]*unitDelta;
530 edgeVectorField::Boundary& CorrVecsbf = CorrVecs.boundaryFieldRef();
536 scalar NonOrthogCoeff = 0.0;
538 if (owner.size() > 0)
544 sinAlpha[edgeI] =
max(-1,
min(sinAlpha[edgeI], 1));
550 reduce(NonOrthogCoeff, maxOp<scalar>());
553 <<
"non-orthogonality coefficient = " << NonOrthogCoeff <<
" deg."
556 if (NonOrthogCoeff < 0.1)
567 <<
"Finished constructing non-orthogonal correction vectors"
572 void Foam::edgeInterpolation::makeSkewCorrectionVectors()
const
575 <<
"Constructing skew correction vectors"
582 "skewCorrectionVectors",
583 mesh()().pointsInstance(),
607 const vector& P =
C[owner[edgeI]];
608 const vector&
N =
C[neighbour[edgeI]];
613 -(((
N - P)^(S - P))&((
N - P)^
e ))/(((
N - P)^
e)&((
N - P)^
e));
617 SkewCorrVecs[edgeI] = Ce[edgeI] - E;
621 edgeVectorField::Boundary& bSkewCorrVecs =
622 SkewCorrVecs.boundaryFieldRef();
624 forAll(SkewCorrVecs.boundaryField(), patchI)
628 if (patchSkewCorrVecs.coupled())
638 forAll(patchSkewCorrVecs, edgeI)
640 const vector& P =
C[edgeFaces[edgeI]];
646 - (((
N - P)^(S - P))&((
N - P)^
e))
647 /(((
N - P)^
e)&((
N - P)^
e));
651 patchSkewCorrVecs[edgeI] =
652 Ce.boundaryField()[patchI][edgeI] - E;
662 scalar skewCoeff = 0.0;
673 - SkewCorrVecs[edgeI]
680 + SkewCorrVecs[edgeI]
686 skewCoeff =
max(
mag(SkewCorrVecs.internalField())/
mag(lPN));
690 <<
"skew coefficient = " << skewCoeff <<
endl;
703 <<
"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.
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< scalar > 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.