FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

fvcDiv.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "fvcDiv.H"
00027 #include <finiteVolume/fvMesh.H>
00028 #include "fvcSurfaceIntegrate.H"
00029 #include <finiteVolume/divScheme.H>
00030 #include <finiteVolume/convectionScheme.H>
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00038 
00039 namespace fvc
00040 {
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 template<class Type>
00045 tmp<GeometricField<Type, fvPatchField, volMesh> >
00046 div
00047 (
00048     const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
00049 )
00050 {
00051     return tmp<GeometricField<Type, fvPatchField, volMesh> >
00052     (
00053         new GeometricField<Type, fvPatchField, volMesh>
00054         (
00055             "div("+ssf.name()+')',
00056             fvc::surfaceIntegrate(ssf)
00057         )
00058     );
00059 }
00060 
00061 
00062 template<class Type>
00063 tmp<GeometricField<Type, fvPatchField, volMesh> >
00064 div
00065 (
00066     const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& tssf
00067 )
00068 {
00069     tmp<GeometricField<Type, fvPatchField, volMesh> > Div(fvc::div(tssf()));
00070     tssf.clear();
00071     return Div;
00072 }
00073 
00074 
00075 template<class Type>
00076 tmp
00077 <
00078     GeometricField
00079     <
00080         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00081     >
00082 >
00083 div
00084 (
00085     const GeometricField<Type, fvPatchField, volMesh>& vf,
00086     const word& name
00087 )
00088 {
00089     return fv::divScheme<Type>::New
00090     (
00091         vf.mesh(), vf.mesh().divScheme(name)
00092     )().fvcDiv(vf);
00093 }
00094 
00095 
00096 template<class Type>
00097 tmp
00098 <
00099     GeometricField
00100     <
00101         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00102     >
00103 >
00104 div
00105 (
00106     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvvf,
00107     const word& name
00108 )
00109 {
00110     typedef typename innerProduct<vector, Type>::type DivType;
00111     tmp<GeometricField<DivType, fvPatchField, volMesh> > Div
00112     (
00113         fvc::div(tvvf(), name)
00114     );
00115     tvvf.clear();
00116     return Div;
00117 }
00118 
00119 template<class Type>
00120 tmp
00121 <
00122     GeometricField
00123     <
00124         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00125     >
00126 >
00127 div
00128 (
00129     const GeometricField<Type, fvPatchField, volMesh>& vf
00130 )
00131 {
00132     return fvc::div(vf, "div("+vf.name()+')');
00133 }
00134 
00135 
00136 template<class Type>
00137 tmp
00138 <
00139     GeometricField
00140     <
00141         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00142     >
00143 >
00144 div
00145 (
00146     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvvf
00147 )
00148 {
00149     typedef typename innerProduct<vector, Type>::type DivType;
00150     tmp<GeometricField<DivType, fvPatchField, volMesh> > Div(fvc::div(tvvf()));
00151     tvvf.clear();
00152     return Div;
00153 }
00154 
00155 
00156 template<class Type>
00157 tmp<GeometricField<Type, fvPatchField, volMesh> >
00158 div
00159 (
00160     const surfaceScalarField& flux,
00161     const GeometricField<Type, fvPatchField, volMesh>& vf,
00162     const word& name
00163 )
00164 {
00165     return fv::convectionScheme<Type>::New
00166     (
00167         vf.mesh(),
00168         flux,
00169         vf.mesh().divScheme(name)
00170     )().fvcDiv(flux, vf);
00171 }
00172 
00173 
00174 template<class Type>
00175 tmp<GeometricField<Type, fvPatchField, volMesh> >
00176 div
00177 (
00178     const tmp<surfaceScalarField>& tflux,
00179     const GeometricField<Type, fvPatchField, volMesh>& vf,
00180     const word& name
00181 )
00182 {
00183     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00184     (
00185         fvc::div(tflux(), vf, name)
00186     );
00187     tflux.clear();
00188     return Div;
00189 }
00190 
00191 
00192 template<class Type>
00193 tmp<GeometricField<Type, fvPatchField, volMesh> >
00194 div
00195 (
00196     const surfaceScalarField& flux,
00197     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00198     const word& name
00199 )
00200 {
00201     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00202     (
00203         fvc::div(flux, tvf(), name)
00204     );
00205     tvf.clear();
00206     return Div;
00207 }
00208 
00209 
00210 template<class Type>
00211 tmp<GeometricField<Type, fvPatchField, volMesh> >
00212 div
00213 (
00214     const tmp<surfaceScalarField>& tflux,
00215     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00216     const word& name
00217 )
00218 {
00219     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00220     (
00221         fvc::div(tflux(), tvf(), name)
00222     );
00223     tflux.clear();
00224     tvf.clear();
00225     return Div;
00226 }
00227 
00228 
00229 template<class Type>
00230 tmp<GeometricField<Type, fvPatchField, volMesh> >
00231 div
00232 (
00233     const surfaceScalarField& flux,
00234     const GeometricField<Type, fvPatchField, volMesh>& vf
00235 )
00236 {
00237     return fvc::div
00238     (
00239         flux, vf, "div("+flux.name()+','+vf.name()+')'
00240     );
00241 }
00242 
00243 
00244 template<class Type>
00245 tmp<GeometricField<Type, fvPatchField, volMesh> >
00246 div
00247 (
00248     const tmp<surfaceScalarField>& tflux,
00249     const GeometricField<Type, fvPatchField, volMesh>& vf
00250 )
00251 {
00252     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00253     (
00254         fvc::div(tflux(), vf)
00255     );
00256     tflux.clear();
00257     return Div;
00258 }
00259 
00260 
00261 template<class Type>
00262 tmp<GeometricField<Type, fvPatchField, volMesh> >
00263 div
00264 (
00265     const surfaceScalarField& flux,
00266     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
00267 )
00268 {
00269     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00270     (
00271         fvc::div(flux, tvf())
00272     );
00273     tvf.clear();
00274     return Div;
00275 }
00276 
00277 
00278 template<class Type>
00279 tmp<GeometricField<Type, fvPatchField, volMesh> >
00280 div
00281 (
00282     const tmp<surfaceScalarField>& tflux,
00283     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
00284 )
00285 {
00286     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00287     (
00288         fvc::div(tflux(), tvf())
00289     );
00290     tflux.clear();
00291     tvf.clear();
00292     return Div;
00293 }
00294 
00295 
00296 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00297 
00298 } // End namespace fvc
00299 
00300 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00301 
00302 } // End namespace Foam
00303 
00304 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines