initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / finiteVolume / fvc / fvcDiv.C
blob655520e4c1287e627a1d1297a8c8cb6e0857a063
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "fvcDiv.H"
28 #include "fvMesh.H"
29 #include "fvcSurfaceIntegrate.H"
30 #include "divScheme.H"
31 #include "convectionScheme.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 namespace fvc
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 template<class Type>
46 tmp<GeometricField<Type, fvPatchField, volMesh> >
47 div
49     const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
52     return tmp<GeometricField<Type, fvPatchField, volMesh> >
53     (
54         new GeometricField<Type, fvPatchField, volMesh>
55         (
56             "div("+ssf.name()+')',
57             fvc::surfaceIntegrate(ssf)
58         )
59     );
63 template<class Type>
64 tmp<GeometricField<Type, fvPatchField, volMesh> >
65 div
67     const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& tssf
70     tmp<GeometricField<Type, fvPatchField, volMesh> > Div(fvc::div(tssf()));
71     tssf.clear();
72     return Div;
76 template<class Type>
77 tmp
79     GeometricField
80     <
81         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
82     >
84 div
86     const GeometricField<Type, fvPatchField, volMesh>& vf,
87     const word& name
90     return fv::divScheme<Type>::New
91     (
92         vf.mesh(), vf.mesh().divScheme(name)
93     )().fvcDiv(vf);
97 template<class Type>
98 tmp
100     GeometricField
101     <
102         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
103     >
107     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvvf,
108     const word& name
111     typedef typename innerProduct<vector, Type>::type DivType;
112     tmp<GeometricField<DivType, fvPatchField, volMesh> > Div
113     (
114         fvc::div(tvvf(), name)
115     );
116     tvvf.clear();
117     return Div;
120 template<class Type>
123     GeometricField
124     <
125         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
126     >
130     const GeometricField<Type, fvPatchField, volMesh>& vf
133     return fvc::div(vf, "div("+vf.name()+')');
137 template<class Type>
140     GeometricField
141     <
142         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
143     >
147     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvvf
150     typedef typename innerProduct<vector, Type>::type DivType;
151     tmp<GeometricField<DivType, fvPatchField, volMesh> > Div(fvc::div(tvvf()));
152     tvvf.clear();
153     return Div;
157 template<class Type>
158 tmp<GeometricField<Type, fvPatchField, volMesh> >
161     const surfaceScalarField& flux,
162     const GeometricField<Type, fvPatchField, volMesh>& vf,
163     const word& name
166     return fv::convectionScheme<Type>::New
167     (
168         vf.mesh(),
169         flux,
170         vf.mesh().divScheme(name)
171     )().fvcDiv(flux, vf);
175 template<class Type>
176 tmp<GeometricField<Type, fvPatchField, volMesh> >
179     const tmp<surfaceScalarField>& tflux,
180     const GeometricField<Type, fvPatchField, volMesh>& vf,
181     const word& name
184     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
185     (
186         fvc::div(tflux(), vf, name)
187     );
188     tflux.clear();
189     return Div;
193 template<class Type>
194 tmp<GeometricField<Type, fvPatchField, volMesh> >
197     const surfaceScalarField& flux,
198     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
199     const word& name
202     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
203     (
204         fvc::div(flux, tvf(), name)
205     );
206     tvf.clear();
207     return Div;
211 template<class Type>
212 tmp<GeometricField<Type, fvPatchField, volMesh> >
215     const tmp<surfaceScalarField>& tflux,
216     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
217     const word& name
220     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
221     (
222         fvc::div(tflux(), tvf(), name)
223     );
224     tflux.clear();
225     tvf.clear();
226     return Div;
230 template<class Type>
231 tmp<GeometricField<Type, fvPatchField, volMesh> >
234     const surfaceScalarField& flux,
235     const GeometricField<Type, fvPatchField, volMesh>& vf
238     return fvc::div
239     (
240         flux, vf, "div("+flux.name()+','+vf.name()+')'
241     );
245 template<class Type>
246 tmp<GeometricField<Type, fvPatchField, volMesh> >
249     const tmp<surfaceScalarField>& tflux,
250     const GeometricField<Type, fvPatchField, volMesh>& vf
253     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
254     (
255         fvc::div(tflux(), vf)
256     );
257     tflux.clear();
258     return Div;
262 template<class Type>
263 tmp<GeometricField<Type, fvPatchField, volMesh> >
266     const surfaceScalarField& flux,
267     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
270     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
271     (
272         fvc::div(flux, tvf())
273     );
274     tvf.clear();
275     return Div;
279 template<class Type>
280 tmp<GeometricField<Type, fvPatchField, volMesh> >
283     const tmp<surfaceScalarField>& tflux,
284     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
287     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
288     (
289         fvc::div(tflux(), tvf())
290     );
291     tflux.clear();
292     tvf.clear();
293     return Div;
297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299 } // End namespace fvc
301 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
303 } // End namespace Foam
305 // ************************************************************************* //