1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Cubic interpolation scheme class derived from linear and returns
30 linear weighting factors but also applies an explicit correction.
35 \*---------------------------------------------------------------------------*/
41 #include "gaussGrad.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class cubic Declaration
50 \*---------------------------------------------------------------------------*/
57 // Private Member Functions
59 //- Disallow default bitwise copy construct
62 //- Disallow default bitwise assignment
63 void operator=(const cubic&);
68 //- Runtime type information
74 //- Construct from mesh
75 cubic(const fvMesh& mesh)
80 //- Construct from mesh and Istream
90 //- Construct from mesh, faceFlux and Istream
94 const surfaceScalarField&,
104 //- Return true if this scheme uses an explicit correction
105 virtual bool corrected() const
110 //- Return the explicit correction to the face-interpolate
111 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
114 const GeometricField<Type, fvPatchField, volMesh>& vf
117 const fvMesh& mesh = this->mesh();
119 // calculate the appropriate interpolation factors
120 const surfaceScalarField& lambda = mesh.weights();
122 surfaceScalarField kSc =
123 lambda*(scalar(1) - lambda*(scalar(3) - scalar(2)*lambda));
125 surfaceScalarField kVecP = sqr(scalar(1) - lambda)*lambda;
126 surfaceScalarField kVecN = sqr(lambda)*(lambda - scalar(1));
128 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr
130 new GeometricField<Type, fvsPatchField, surfaceMesh>
135 mesh.time().timeName(),
138 surfaceInterpolationScheme<Type>::interpolate(vf, kSc, -kSc)
142 GeometricField<Type, fvsPatchField, surfaceMesh>& sfCorr = tsfCorr();
144 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
149 sfCorr.component(cmpt)
151 surfaceInterpolationScheme
153 typename outerProduct
156 typename pTraits<Type>::cmptType
161 <typename pTraits<Type>::cmptType>(mesh)
162 .grad(vf.component(cmpt)),
166 )/mesh.magSf()/mesh.surfaceInterpolation::deltaCoeffs()
170 forAll (sfCorr.boundaryField(), pi)
172 if (!sfCorr.boundaryField()[pi].coupled())
174 sfCorr.boundaryField()[pi] = pTraits<Type>::zero;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 // ************************************************************************* //