fvcVolumeIntegrate.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fvcVolumeIntegrate.H"
27 #include "fvMesh.H"
28 #include "Field.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace fvc
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 template<class Type>
43 tmp<Field<Type>>
45 (
47 )
48 {
49  return vf.mesh().V()*vf.primitiveField();
50 }
51 
52 
53 template<class Type>
56 (
58 )
59 {
60  tmp<Field<Type>> tvivf = tvf().mesh().V()*tvf().primitiveField();
61  tvf.clear();
62  return tvivf;
63 }
64 
65 
66 template<class Type>
68 {
69  return df.mesh().V()*df.field();
70 }
71 
72 
73 template<class Type>
76 {
77  tmp<Field<Type>> tdidf = tdf().mesh().V()*tdf().field();
78  tdf.clear();
79  return tdidf;
80 }
81 
82 
83 template<class Type>
86 (
88 )
89 {
90  return dimensioned<Type>
91  (
92  "domainIntegrate(" + vf.name() + ')',
93  dimVol*vf.dimensions(),
95  );
96 }
97 
98 
99 template<class Type>
101 (
103 )
104 {
105  dimensioned<Type> integral = domainIntegrate(tvf());
106  tvf.clear();
107  return integral;
108 }
109 
110 
111 template<class Type>
113 (
115 )
116 {
117  return dimensioned<Type>
118  (
119  "domainIntegrate(" + df.name() + ')',
120  dimVol*df.dimensions(),
122  );
123 }
124 
125 
126 template<class Type>
128 (
130 )
131 {
132  dimensioned<Type> integral = domainIntegrate(tdf());
133  tdf.clear();
134  return integral;
135 }
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace fvc
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // ************************************************************************* //
const word & name() const
Return name.
Definition: IOobject.H:303
void clear() const
If object pointer points to valid object:
Definition: tmpI.H:237
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Generic GeometricField class.
Generic dimensioned Type class.
const dimensionSet & dimensions() const
Return dimensions.
Type gSum(const FieldField< Field, Type > &f)
const dimensionSet dimVol
Volume integrate volField creating a volField.
const Mesh & mesh() const
Return mesh.
const Field< Type > & field() const
tmp< Field< Type > > volumeIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.