Go to the documentation of this file.
33 template<
class Polynomial>
38 const scalar linearLimitFactor,
39 const scalar centralWeight
49 mesh, stencil,
true, linearLimitFactor, centralWeight
51 coeffs_(
mesh.nFaces())
55 Info<<
"Contructing CentredFitSnGradData<Polynomial>" <<
endl;
62 Info<<
"CentredFitSnGradData<Polynomial>::CentredFitSnGradData() :"
63 <<
"Finished constructing polynomialFit data"
71 template<
class Polynomial>
77 const scalar deltaCoeff,
84 this->findFaceDirs(idir, jdir, kdir, facei);
88 wts[0] = this->centralWeight();
89 wts[1] = this->centralWeight();
92 point p0 = this->
mesh().faceCentres()[facei];
120 Polynomial::addCoeffs(B[ip], d, wts[ip], this->dim());
124 for (
label i = 0; i < B.
n(); i++)
131 label stencilSize =
C.size();
134 bool goodFit =
false;
135 for (
int iIt = 0; iIt < 8 && !goodFit; iIt++)
139 for (
label i=0; i<stencilSize; i++)
141 coeffsi[i] = wts[1]*wts[i]*svd.
VSinvUt()[1][i]/scale;
147 < this->linearLimitFactor()*wLin)
148 && (
mag(wts[0]*wts[1]*svd.
VSinvUt()[0][1] - (1 - wLin)
149 ) < this->linearLimitFactor()*(1 - wLin))
150 && coeffsi[0] < 0 && coeffsi[1] > 0
151 &&
mag(coeffsi[0] + deltaCoeff) < 0.5*deltaCoeff
152 &&
mag(coeffsi[1] - deltaCoeff) < 0.5*deltaCoeff;
160 <<
"Cannot fit face " << facei <<
" iteration " << iIt
161 <<
" with sum of weights " <<
sum(coeffsi) <<
nl
162 <<
" Weights " << coeffsi <<
nl
163 <<
" Linear weights " << wLin <<
" " << 1 - wLin <<
nl
164 <<
" deltaCoeff " << deltaCoeff <<
nl
165 <<
" sing vals " << svd.
S() <<
nl
166 <<
"Components of goodFit:\n"
167 <<
" wts[0]*wts[0]*svd.VSinvUt()[0][0] = "
168 << wts[0]*wts[0]*svd.
VSinvUt()[0][0] <<
nl
169 <<
" wts[0]*wts[1]*svd.VSinvUt()[0][1] = "
170 << wts[0]*wts[1]*svd.
VSinvUt()[0][1]
171 <<
" dim = " << this->dim() <<
endl;
176 for (
label j = 0; j < B.
m(); j++)
182 for (
label i = 0; i < B.
n(); i++)
193 coeffsi[0] += deltaCoeff;
194 coeffsi[1] -= deltaCoeff;
199 <<
"Could not fit face " << facei
200 <<
" Coefficients = " << coeffsi
201 <<
", reverting to uncorrected." <<
endl;
208 template<
class Polynomial>
217 this->stencil().collectData(
mesh.C(), stencilPoints);
224 for (
label facei = 0; facei <
mesh.nInternalFaces(); facei++)
229 stencilPoints[facei],
253 stencilPoints[facei],
label m() const
Return the number of columns.
Data for the upwinded and centred polynomial fit interpolation schemes. The linearCorrection_ determi...
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
#define forAll(list, i)
Loop across all elements in list.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
label n() const
Return the number of rows.
CentredFitSnGradData(const fvMesh &mesh, const extendedCentredCellToFaceStencil &stencil, const scalar linearLimitFactor, const scalar centralWeight)
Construct from components.
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Mesh data needed to do the Finite Volume discretisation.
Data for centred fit snGrad schemes.
const scalarDiagonalMatrix & S() const
Return the singular values.
void setSize(const label)
Reset size of List.
Polynomial templated on size (order):
const scalarRectangularMatrix & VSinvUt() const
Return VSinvUt (the pseudo inverse)
const fvPatch & patch() const
Return patch.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Singular value decomposition of a rectangular matrix.
label start() const
Return start label of this patch in the polyMesh face list.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Graphite solid properties.
Generic GeometricField class.
void calcFit()
Calculate the fit for all the faces.
virtual bool coupled() const
Return true if this patch field is coupled.
#define WarningInFunction
Report a warning using Foam::Warning.