gaussFaConvectionScheme.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) 2016-2017 Wikki Ltd
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 "facEdgeIntegrate.H"
30#include "faMatrices.H"
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38
39namespace fa
40{
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44template<class Type>
45tmp<GeometricField<Type, faePatchField, edgeMesh>>
47(
48 const edgeScalarField& faceFlux,
50) const
51{
52 return faceFlux*tinterpScheme_().interpolate(vf);
53}
54
55
56template<class Type>
59(
60 const edgeScalarField& faceFlux,
62) const
63{
64 tmp<edgeScalarField> tweights = tinterpScheme_().weights(vf);
65 const edgeScalarField& weights = tweights();
66
68 (
70 (
71 vf,
72 faceFlux.dimensions()*vf.dimensions()
73 )
74 );
75 faMatrix<Type>& fam = tfam.ref();
76
77 fam.lower() = -weights.internalField()*faceFlux.internalField();
78 fam.upper() = fam.lower() + faceFlux.internalField();
79 fam.negSumDiag();
80
81 forAll(fam.psi().boundaryField(), patchI)
82 {
83 const faPatchField<Type>& psf = fam.psi().boundaryField()[patchI];
84 const faePatchScalarField& patchFlux = faceFlux.boundaryField()[patchI];
85 const faePatchScalarField& pw = weights.boundaryField()[patchI];
86
87 fam.internalCoeffs()[patchI] = patchFlux*psf.valueInternalCoeffs(pw);
88 fam.boundaryCoeffs()[patchI] = -patchFlux*psf.valueBoundaryCoeffs(pw);
89 }
90
91// if (tinterpScheme_().corrected())
92// {
93// fam += fac::edgeIntegrate(faceFlux*tinterpScheme_().correction(vf));
94// }
95
96 // Non-euclidian and other corrections
98 (
99 flux(faceFlux, vf)
100 - faceFlux*tinterpScheme_().euclidianInterpolate(vf)
101 );
102
103 fam += fac::edgeIntegrate(convFluxCorr);
104
105 return tfam;
106}
107
108
109template<class Type>
112(
113 const edgeScalarField& faceFlux,
115) const
116{
118 (
119 fac::edgeIntegrate(flux(faceFlux, vf))
120 );
121
122 tConvection.ref().rename
123 (
124 "convection(" + faceFlux.name() + ',' + vf.name() + ')'
125 );
126
127 return tConvection;
128}
129
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132
133} // End namespace fa
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137} // End namespace Foam
138
139// ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const Internal & internalField() const
Return a const-reference to the dimensioned internal field.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatrix.H:76
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: faPatchField.H:82
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< Field< scalar > > &) const
Definition: faPatchField.H:406
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< Field< scalar > > &) const
Definition: faPatchField.H:395
tmp< faMatrix< Type > > famDiv(const edgeScalarField &, const GeometricField< Type, faPatchField, areaMesh > &) const
tmp< GeometricField< Type, faPatchField, areaMesh > > facDiv(const edgeScalarField &, const GeometricField< Type, faPatchField, areaMesh > &) const
Computes the flux of an input vector field.
Definition: flux.H:144
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
Edge integrate edgeField creating a areaField. Edge sum a edgeField creating a areaField.
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeIntegrate(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Namespace for OpenFOAM.
Calculate the matrix for the second temporal derivative.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333