1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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
25 \*---------------------------------------------------------------------------*/
27 #include "gaussConvectionScheme.H"
28 #include "fvcSurfaceIntegrate.H"
29 #include "fvMatrices.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
45 gaussConvectionScheme<Type>::interpolate
47 const surfaceScalarField&,
48 const GeometricField<Type, fvPatchField, volMesh>& vf
51 return tinterpScheme_().interpolate(vf);
56 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
57 gaussConvectionScheme<Type>::flux
59 const surfaceScalarField& faceFlux,
60 const GeometricField<Type, fvPatchField, volMesh>& vf
63 return faceFlux*interpolate(faceFlux, vf);
69 gaussConvectionScheme<Type>::fvmDiv
71 const surfaceScalarField& faceFlux,
72 GeometricField<Type, fvPatchField, volMesh>& vf
75 tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf);
76 const surfaceScalarField& weights = tweights();
78 tmp<fvMatrix<Type> > tfvm
83 faceFlux.dimensions()*vf.dimensions()
86 fvMatrix<Type>& fvm = tfvm();
88 fvm.lower() = -weights.internalField()*faceFlux.internalField();
89 fvm.upper() = fvm.lower() + faceFlux.internalField();
92 forAll(fvm.psi().boundaryField(), patchI)
94 const fvPatchField<Type>& psf = fvm.psi().boundaryField()[patchI];
95 const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI];
96 const fvsPatchScalarField& pw = weights.boundaryField()[patchI];
98 fvm.internalCoeffs()[patchI] = patchFlux*psf.valueInternalCoeffs(pw);
99 fvm.boundaryCoeffs()[patchI] = -patchFlux*psf.valueBoundaryCoeffs(pw);
102 if (tinterpScheme_().corrected())
104 fvm += fvc::surfaceIntegrate(faceFlux*tinterpScheme_().correction(vf));
112 tmp<GeometricField<Type, fvPatchField, volMesh> >
113 gaussConvectionScheme<Type>::fvcDiv
115 const surfaceScalarField& faceFlux,
116 const GeometricField<Type, fvPatchField, volMesh>& vf
119 tmp<GeometricField<Type, fvPatchField, volMesh> > tConvection
121 fvc::surfaceIntegrate(flux(faceFlux, vf))
126 "convection(" + faceFlux.name() + ',' + vf.name() + ')'
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 } // End namespace fv
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 } // End namespace Foam
141 // ************************************************************************* //