gaussConvectionScheme.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "fvcSurfaceIntegrate.H"
30#include "fvMatrices.H"
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38
39namespace fv
40{
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44template<class Type>
45const surfaceInterpolationScheme<Type>&
47{
48 return tinterpScheme_();
49}
50
51
52template<class Type>
55(
56 const surfaceScalarField&,
58) const
59{
60 return tinterpScheme_().interpolate(vf);
61}
62
63
64template<class Type>
67(
68 const surfaceScalarField& faceFlux,
70) const
71{
72 return faceFlux*interpolate(faceFlux, vf);
73}
74
75
76template<class Type>
79(
80 const surfaceScalarField& faceFlux,
82) const
83{
84 tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf);
85 const surfaceScalarField& weights = tweights();
86
88 (
90 (
91 vf,
92 faceFlux.dimensions()*vf.dimensions()
93 )
94 );
95 fvMatrix<Type>& fvm = tfvm.ref();
96
97 fvm.lower() = -weights.primitiveField()*faceFlux.primitiveField();
98 fvm.upper() = fvm.lower() + faceFlux.primitiveField();
99 fvm.negSumDiag();
100
101 forAll(vf.boundaryField(), patchi)
102 {
103 const fvPatchField<Type>& psf = vf.boundaryField()[patchi];
104 const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchi];
105 const fvsPatchScalarField& pw = weights.boundaryField()[patchi];
106
107 fvm.internalCoeffs()[patchi] = patchFlux*psf.valueInternalCoeffs(pw);
108 fvm.boundaryCoeffs()[patchi] = -patchFlux*psf.valueBoundaryCoeffs(pw);
109 }
110
111 if (tinterpScheme_().corrected())
112 {
113 fvm += fvc::surfaceIntegrate(faceFlux*tinterpScheme_().correction(vf));
114 }
115
116 return tfvm;
117}
118
119
120template<class Type>
123(
124 const surfaceScalarField& faceFlux,
126) const
127{
129 (
130 fvc::surfaceIntegrate(flux(faceFlux, vf))
131 );
132
133 tConvection.ref().rename
134 (
135 "convection(" + faceFlux.name() + ',' + vf.name() + ')'
136 );
137
138 return tConvection;
139}
140
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144} // End namespace fv
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148} // End namespace Foam
149
150// ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
Computes the flux of an input vector field.
Definition: flux.H:144
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
const FieldField< Field, Type > & internalCoeffs() const noexcept
Definition: fvMatrix.H:470
const FieldField< Field, Type > & boundaryCoeffs() const noexcept
Definition: fvMatrix.H:484
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< Field< scalar > > &) const
Return the matrix source coefficients corresponding to the.
Definition: fvPatchField.H:489
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< Field< scalar > > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: fvPatchField.H:478
const surfaceInterpolationScheme< Type > & interpScheme() const
tmp< fvMatrix< Type > > fvmDiv(const surfaceScalarField &, const GeometricField< Type, fvPatchField, volMesh > &) const
tmp< GeometricField< Type, fvPatchField, volMesh > > fvcDiv(const surfaceScalarField &, const GeometricField< Type, fvPatchField, volMesh > &) const
scalarField & upper()
Definition: lduMatrix.C:203
scalarField & lower()
Definition: lduMatrix.C:174
bool interpolate() const noexcept
Same as isPointData()
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
void surfaceIntegrate(Field< Type > &ivf, const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Namespace for OpenFOAM.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
labelList fv(nPoints)
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333