OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "fvcDiv.H"
00028 #include "fvMesh.H"
00029 #include "fvcSurfaceIntegrate.H"
00030 #include "divScheme.H"
00031 #include "convectionScheme.H"
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00039 
00040 namespace fvc
00041 {
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 template<class Type>
00046 tmp<GeometricField<Type, fvPatchField, volMesh> >
00047 div
00048 (
00049     const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
00050 )
00051 {
00052     return tmp<GeometricField<Type, fvPatchField, volMesh> >
00053     (
00054         new GeometricField<Type, fvPatchField, volMesh>
00055         (
00056             "div("+ssf.name()+')',
00057             fvc::surfaceIntegrate(ssf)
00058         )
00059     );
00060 }
00061 
00062 
00063 template<class Type>
00064 tmp<GeometricField<Type, fvPatchField, volMesh> >
00065 div
00066 (
00067     const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& tssf
00068 )
00069 {
00070     tmp<GeometricField<Type, fvPatchField, volMesh> > Div(fvc::div(tssf()));
00071     tssf.clear();
00072     return Div;
00073 }
00074 
00075 
00076 template<class Type>
00077 tmp
00078 <
00079     GeometricField
00080     <
00081         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00082     >
00083 >
00084 div
00085 (
00086     const GeometricField<Type, fvPatchField, volMesh>& vf,
00087     const word& name
00088 )
00089 {
00090     return fv::divScheme<Type>::New
00091     (
00092         vf.mesh(), vf.mesh().divScheme(name)
00093     )().fvcDiv(vf);
00094 }
00095 
00096 
00097 template<class Type>
00098 tmp
00099 <
00100     GeometricField
00101     <
00102         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00103     >
00104 >
00105 div
00106 (
00107     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvvf,
00108     const word& name
00109 )
00110 {
00111     typedef typename innerProduct<vector, Type>::type DivType;
00112     tmp<GeometricField<DivType, fvPatchField, volMesh> > Div
00113     (
00114         fvc::div(tvvf(), name)
00115     );
00116     tvvf.clear();
00117     return Div;
00118 }
00119 
00120 template<class Type>
00121 tmp
00122 <
00123     GeometricField
00124     <
00125         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00126     >
00127 >
00128 div
00129 (
00130     const GeometricField<Type, fvPatchField, volMesh>& vf
00131 )
00132 {
00133     return fvc::div(vf, "div("+vf.name()+')');
00134 }
00135 
00136 
00137 template<class Type>
00138 tmp
00139 <
00140     GeometricField
00141     <
00142         typename innerProduct<vector, Type>::type, fvPatchField, volMesh
00143     >
00144 >
00145 div
00146 (
00147     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvvf
00148 )
00149 {
00150     typedef typename innerProduct<vector, Type>::type DivType;
00151     tmp<GeometricField<DivType, fvPatchField, volMesh> > Div(fvc::div(tvvf()));
00152     tvvf.clear();
00153     return Div;
00154 }
00155 
00156 
00157 template<class Type>
00158 tmp<GeometricField<Type, fvPatchField, volMesh> >
00159 div
00160 (
00161     const surfaceScalarField& flux,
00162     const GeometricField<Type, fvPatchField, volMesh>& vf,
00163     const word& name
00164 )
00165 {
00166     return fv::convectionScheme<Type>::New
00167     (
00168         vf.mesh(),
00169         flux,
00170         vf.mesh().divScheme(name)
00171     )().fvcDiv(flux, vf);
00172 }
00173 
00174 
00175 template<class Type>
00176 tmp<GeometricField<Type, fvPatchField, volMesh> >
00177 div
00178 (
00179     const tmp<surfaceScalarField>& tflux,
00180     const GeometricField<Type, fvPatchField, volMesh>& vf,
00181     const word& name
00182 )
00183 {
00184     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00185     (
00186         fvc::div(tflux(), vf, name)
00187     );
00188     tflux.clear();
00189     return Div;
00190 }
00191 
00192 
00193 template<class Type>
00194 tmp<GeometricField<Type, fvPatchField, volMesh> >
00195 div
00196 (
00197     const surfaceScalarField& flux,
00198     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00199     const word& name
00200 )
00201 {
00202     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00203     (
00204         fvc::div(flux, tvf(), name)
00205     );
00206     tvf.clear();
00207     return Div;
00208 }
00209 
00210 
00211 template<class Type>
00212 tmp<GeometricField<Type, fvPatchField, volMesh> >
00213 div
00214 (
00215     const tmp<surfaceScalarField>& tflux,
00216     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00217     const word& name
00218 )
00219 {
00220     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00221     (
00222         fvc::div(tflux(), tvf(), name)
00223     );
00224     tflux.clear();
00225     tvf.clear();
00226     return Div;
00227 }
00228 
00229 
00230 template<class Type>
00231 tmp<GeometricField<Type, fvPatchField, volMesh> >
00232 div
00233 (
00234     const surfaceScalarField& flux,
00235     const GeometricField<Type, fvPatchField, volMesh>& vf
00236 )
00237 {
00238     return fvc::div
00239     (
00240         flux, vf, "div("+flux.name()+','+vf.name()+')'
00241     );
00242 }
00243 
00244 
00245 template<class Type>
00246 tmp<GeometricField<Type, fvPatchField, volMesh> >
00247 div
00248 (
00249     const tmp<surfaceScalarField>& tflux,
00250     const GeometricField<Type, fvPatchField, volMesh>& vf
00251 )
00252 {
00253     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00254     (
00255         fvc::div(tflux(), vf)
00256     );
00257     tflux.clear();
00258     return Div;
00259 }
00260 
00261 
00262 template<class Type>
00263 tmp<GeometricField<Type, fvPatchField, volMesh> >
00264 div
00265 (
00266     const surfaceScalarField& flux,
00267     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
00268 )
00269 {
00270     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00271     (
00272         fvc::div(flux, tvf())
00273     );
00274     tvf.clear();
00275     return Div;
00276 }
00277 
00278 
00279 template<class Type>
00280 tmp<GeometricField<Type, fvPatchField, volMesh> >
00281 div
00282 (
00283     const tmp<surfaceScalarField>& tflux,
00284     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
00285 )
00286 {
00287     tmp<GeometricField<Type, fvPatchField, volMesh> > Div
00288     (
00289         fvc::div(tflux(), tvf())
00290     );
00291     tflux.clear();
00292     tvf.clear();
00293     return Div;
00294 }
00295 
00296 
00297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00298 
00299 } // End namespace fvc
00300 
00301 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00302 
00303 } // End namespace Foam
00304 
00305 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd