1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Simple central-difference snGrad scheme with non-orthogonal correction.
27 \*---------------------------------------------------------------------------*/
29 #include "patchCorrectedSnGrad.H"
30 #include "volFields.H"
31 #include "surfaceFields.H"
34 #include "gaussGrad.H"
35 #include "fixedValueCorrectedFvPatchFields.H"
36 #include "fixedGradientCorrectedFvPatchFields.H"
37 #include "zeroGradientCorrectedFvPatchFields.H"
38 #include "fixedGradientFvPatchFields.H"
39 #include "zeroGradientFvPatchFields.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 patchCorrectedSnGrad<Type>::~patchCorrectedSnGrad()
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
62 patchCorrectedSnGrad<Type>::correction
64 const GeometricField<Type, fvPatchField, volMesh>& vf
67 const fvMesh& mesh = this->mesh();
69 // construct GeometricField<Type, fvsPatchField, surfaceMesh>
70 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf
72 new GeometricField<Type, fvsPatchField, surfaceMesh>
76 "snGradCorr("+vf.name()+')',
83 vf.dimensions()*mesh.deltaCoeffs().dimensions()
86 GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf();
89 for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
94 mesh.correctionVectors()
98 outerProduct<vector, typename pTraits<Type>::cmptType>::type
101 gradScheme<typename pTraits<Type>::cmptType>::New
104 mesh.schemesDict().gradScheme(ssf.name())
106 //gaussGrad<typename pTraits<Type>::cmptType>(mesh)
107 .grad(vf.component(cmpt))
112 forAll(ssf.boundaryField(), patchI)
116 vf.boundaryField()[patchI].type()
117 == fixedValueCorrectedFvPatchField<Type>::typeName
120 const fixedValueCorrectedFvPatchField<Type>& pField =
121 refCast<const fixedValueCorrectedFvPatchField<Type> >
123 vf.boundaryField()[patchI]
126 ssf.boundaryField()[patchI] = pField.snGradCorrection();
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace fv
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // ************************************************************************* //