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-2024 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 (
46  const VolField<Type>& vf
47 )
48 {
49  return vf.mesh().V()*vf.primitiveField();
50 }
51 
52 
53 template<class Type>
56 (
57  const tmp<VolField<Type>>& tvf
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.primitiveField();
70 }
71 
72 
73 template<class Type>
76 {
77  tmp<Field<Type>> tdidf = tdf().mesh().V()*tdf().primitiveField();
78  tdf.clear();
79  return tdidf;
80 }
81 
82 
83 template<class Type>
86 (
87  const VolField<Type>& vf
88 )
89 {
90  return dimensioned<Type>
91  (
92  "domainIntegrate(" + vf.name() + ')',
93  dimVolume*vf.dimensions(),
95  );
96 }
97 
98 
99 template<class Type>
101 (
102  const tmp<VolField<Type>>& tvf
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  dimVolume*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 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
const Field< Type > & primitiveField() const
Return a const-reference to the primitive field.
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
const word & name() const
Return name.
Definition: IOobject.H:310
Generic dimensioned Type class.
A class for managing temporary objects.
Definition: tmp.H:55
void clear() const
If object pointer points to valid object:
Definition: tmpI.H:237
Volume integrate volField creating a volField.
dimensioned< Type > domainIntegrate(const VolField< Type > &vf)
tmp< Field< Type > > volumeIntegrate(const VolField< Type > &vf)
Namespace for OpenFOAM.
Type gSum(const FieldField< Field, Type > &f)
const dimensionSet dimVolume