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

fvcGrad.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 "fvcGrad.H"
00027 #include "fvcSurfaceIntegrate.H"
00028 #include <finiteVolume/fvMesh.H>
00029 #include <finiteVolume/gaussGrad.H>
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00037 
00038 namespace fvc
00039 {
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 template<class Type>
00044 tmp
00045 <
00046     GeometricField
00047     <
00048         typename outerProduct<vector, Type>::type, fvPatchField, volMesh
00049     >
00050 >
00051 grad
00052 (
00053     const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
00054 )
00055 {
00056     return fv::gaussGrad<Type>::grad(ssf);
00057 }
00058 
00059 
00060 template<class Type>
00061 tmp
00062 <
00063     GeometricField
00064     <
00065         typename outerProduct<vector,Type>::type, fvPatchField, volMesh
00066     >
00067 >
00068 grad
00069 (
00070     const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& tssf
00071 )
00072 {
00073     typedef typename outerProduct<vector, Type>::type GradType;
00074     tmp<GeometricField<GradType, fvPatchField, volMesh> > Grad
00075     (
00076         fvc::grad(tssf())
00077     );
00078     tssf.clear();
00079     return Grad;
00080 }
00081 
00082 
00083 template<class Type>
00084 tmp
00085 <
00086     GeometricField
00087     <
00088         typename outerProduct<vector,Type>::type, fvPatchField, volMesh
00089     >
00090 >
00091 grad
00092 (
00093     const GeometricField<Type, fvPatchField, volMesh>& vf,
00094     const word& name
00095 )
00096 {
00097     return fv::gradScheme<Type>::New
00098     (
00099         vf.mesh(),
00100         vf.mesh().gradScheme(name)
00101     )().grad(vf);
00102 }
00103 
00104 
00105 template<class Type>
00106 tmp
00107 <
00108     GeometricField
00109     <
00110         typename outerProduct<vector,Type>::type, fvPatchField, volMesh
00111     >
00112 >
00113 grad
00114 (
00115     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
00116     const word& name
00117 )
00118 {
00119     tmp
00120     <
00121         GeometricField
00122         <
00123             typename outerProduct<vector, Type>::type, fvPatchField, volMesh
00124         >
00125     > tGrad
00126     (
00127         fvc::grad(tvf(), name)
00128     );
00129     tvf.clear();
00130     return tGrad;
00131 }
00132 
00133 
00134 template<class Type>
00135 tmp
00136 <
00137     GeometricField
00138     <
00139         typename outerProduct<vector,Type>::type, fvPatchField, volMesh
00140     >
00141 >
00142 grad
00143 (
00144     const GeometricField<Type, fvPatchField, volMesh>& vf
00145 )
00146 {
00147     return fvc::grad(vf, "grad(" + vf.name() + ')');
00148 }
00149 
00150 
00151 template<class Type>
00152 tmp
00153 <
00154     GeometricField
00155     <
00156         typename outerProduct<vector,Type>::type, fvPatchField, volMesh
00157     >
00158 >
00159 grad
00160 (
00161     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
00162 )
00163 {
00164     typedef typename outerProduct<vector, Type>::type GradType;
00165     tmp<GeometricField<GradType, fvPatchField, volMesh> > Grad
00166     (
00167         fvc::grad(tvf())
00168     );
00169     tvf.clear();
00170     return Grad;
00171 }
00172 
00173 
00174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00175 
00176 } // End namespace fvc
00177 
00178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00179 
00180 } // End namespace Foam
00181 
00182 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines