Loading...
Searching...
No Matches
fvcDiv.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
28#include "fvcDiv.H"
29#include "fvMesh.H"
30#include "fvcSurfaceIntegrate.H"
31#include "divScheme.H"
32#include "convectionScheme.H"
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36namespace Foam
37{
38
39// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40
41namespace fvc
42{
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46template<class Type>
48div
49(
51)
52{
54 (
56 (
57 "div("+ssf.name()+')',
59 )
60 );
61}
62
63
64template<class Type>
66div
67(
69)
70{
72 tssf.clear();
73 return Div;
74}
75
76
77template<class Type>
89)
90{
92 (
93 vf.mesh(), vf.mesh().divScheme(name)
94 ).ref().fvcDiv(vf);
95}
96
97
98template<class Type>
100<
102 <
104 >
105>
106div
107(
109 const word& name
110)
111{
112 typedef typename innerProduct<vector, Type>::type DivType;
114 (
115 fvc::div(tvvf(), name)
116 );
117 tvvf.clear();
118 return Div;
119}
120
121template<class Type>
129div
130(
132)
133{
134 return fvc::div(vf, "div("+vf.name()+')');
135}
136
137
138template<class Type>
149)
150{
151 typedef typename innerProduct<vector, Type>::type DivType;
153 tvvf.clear();
154 return Div;
155}
156
157
158template<class Type>
160div
161(
164 const word& name
165)
166{
168 (
169 vf.mesh(),
170 flux,
171 vf.mesh().divScheme(name)
172 ).ref().fvcDiv(flux, vf);
173}
174
175
176template<class Type>
178div
179(
180 const tmp<surfaceScalarField>& tflux,
182 const word& name
183)
184{
186 (
187 fvc::div(tflux(), vf, name)
188 );
189 tflux.clear();
190 return Div;
191}
192
193
194template<class Type>
196div
197(
200 const word& name
201)
202{
204 (
205 fvc::div(flux, tvf(), name)
206 );
207 tvf.clear();
208 return Div;
209}
210
211
212template<class Type>
214div
215(
216 const tmp<surfaceScalarField>& tflux,
218 const word& name
219)
220{
222 (
223 fvc::div(tflux(), tvf(), name)
224 );
225 tflux.clear();
226 tvf.clear();
227 return Div;
228}
229
230
231template<class Type>
233div
234(
237)
238{
239 return fvc::div
240 (
241 flux, vf, "div("+flux.name()+','+vf.name()+')'
242 );
243}
244
245
246template<class Type>
248div
249(
250 const tmp<surfaceScalarField>& tflux,
252)
253{
255 (
256 fvc::div(tflux(), vf)
257 );
258 tflux.clear();
259 return Div;
260}
261
262
263template<class Type>
265div
266(
269)
270{
272 (
273 fvc::div(flux, tvf())
274 );
275 tvf.clear();
276 return Div;
277}
278
279
280template<class Type>
282div
283(
284 const tmp<surfaceScalarField>& tflux,
286)
287{
289 (
290 fvc::div(tflux(), tvf())
291 );
292 tflux.clear();
293 tvf.clear();
294 return Div;
295}
296
297
298// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299
300} // End namespace fvc
301
302// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
303
304} // End namespace Foam
305
306// ************************************************************************* //
const Mesh & mesh() const noexcept
Return const reference to mesh.
Generic GeometricField class.
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
static tmp< convectionScheme< Type > > New(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &schemeData)
Return a pointer to a new convectionScheme created on freestore.
static tmp< divScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition divScheme.C:44
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) -2 >::type type
Definition products.H:155
A class for managing temporary objects.
Definition tmp.H:75
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
Definition tmpI.H:289
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
Mesh data needed to do the Finite Volume discretisation.
Definition volMesh.H:47
A class for handling words, derived from Foam::string.
Definition word.H:66
Calculate the divergence of the given field.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
Namespace of functions to calculate explicit derivatives.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition fvcDiv.C:42
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Definition fvcFlux.C:27
void surfaceIntegrate(Field< Type > &ivf, const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Namespace for OpenFOAM.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127