![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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 Class 00026 gaussGrad 00027 00028 Description 00029 Basic second-order gradient scheme using face-interpolation 00030 and Gauss' theorem. 00031 00032 SourceFiles 00033 gaussGrad.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef gaussGrad_H 00038 #define gaussGrad_H 00039 00040 #include "gradScheme.H" 00041 #include "surfaceInterpolationScheme.H" 00042 #include "linear.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00050 00051 namespace fv 00052 { 00053 00054 /*---------------------------------------------------------------------------*\ 00055 Class gaussGrad Declaration 00056 \*---------------------------------------------------------------------------*/ 00057 00058 template<class Type> 00059 class gaussGrad 00060 : 00061 public fv::gradScheme<Type> 00062 { 00063 // Private data 00064 00065 tmp<surfaceInterpolationScheme<Type> > tinterpScheme_; 00066 00067 00068 // Private Member Functions 00069 00070 //- Disallow default bitwise copy construct 00071 gaussGrad(const gaussGrad&); 00072 00073 //- Disallow default bitwise assignment 00074 void operator=(const gaussGrad&); 00075 00076 00077 public: 00078 00079 //- Runtime type information 00080 TypeName("Gauss"); 00081 00082 00083 // Constructors 00084 00085 //- Construct from mesh 00086 gaussGrad(const fvMesh& mesh) 00087 : 00088 gradScheme<Type>(mesh), 00089 tinterpScheme_(new linear<Type>(mesh)) 00090 {} 00091 00092 //- Construct from Istream 00093 gaussGrad(const fvMesh& mesh, Istream& is) 00094 : 00095 gradScheme<Type>(mesh), 00096 tinterpScheme_(NULL) 00097 { 00098 if (is.eof()) 00099 { 00100 tinterpScheme_ = 00101 tmp<surfaceInterpolationScheme<Type> > 00102 ( 00103 new linear<Type>(mesh) 00104 ); 00105 } 00106 else 00107 { 00108 tinterpScheme_ = 00109 tmp<surfaceInterpolationScheme<Type> > 00110 ( 00111 surfaceInterpolationScheme<Type>::New(mesh, is) 00112 ); 00113 } 00114 } 00115 00116 00117 // Member Functions 00118 00119 //- Return the gradient of the given field 00120 // calculated using Gauss' theorem on the given surface field 00121 static 00122 tmp 00123 < 00124 GeometricField 00125 <typename outerProduct<vector, Type>::type, fvPatchField, volMesh> 00126 > grad 00127 ( 00128 const GeometricField<Type, fvPatchField, surfaceMesh>& 00129 ); 00130 00131 00132 //- Return the gradient of the given field calculated 00133 // using Gauss' theorem on the interpolated field 00134 tmp 00135 < 00136 GeometricField 00137 <typename outerProduct<vector, Type>::type, fvPatchField, volMesh> 00138 > grad 00139 ( 00140 const GeometricField<Type, fvPatchField, volMesh>& 00141 ) const; 00142 00143 00144 //- Correct the boundary values of the gradient using the patchField 00145 // snGrad functions 00146 static void correctBoundaryConditions 00147 ( 00148 const GeometricField<Type, fvPatchField, volMesh>&, 00149 GeometricField 00150 <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>& 00151 ); 00152 }; 00153 00154 00155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00156 00157 } // End namespace fv 00158 00159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00160 00161 } // End namespace Foam 00162 00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00164 00165 #ifdef NoRepository 00166 # include "gaussGrad.C" 00167 #endif 00168 00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00170 00171 #endif 00172 00173 // ************************************************************************* //