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

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