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

fvmLaplacian.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 "volFields.H"
00028 #include "surfaceFields.H"
00029 #include "fvMatrix.H"
00030 #include "laplacianScheme.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00038 
00039 namespace fvm
00040 {
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 template<class Type>
00045 tmp<fvMatrix<Type> >
00046 laplacian
00047 (
00048     GeometricField<Type, fvPatchField, volMesh>& vf,
00049     const word& name
00050 )
00051 {
00052     surfaceScalarField Gamma
00053     (
00054         IOobject
00055         (
00056             "1",
00057             vf.time().constant(),
00058             vf.mesh(),
00059             IOobject::NO_READ
00060         ),
00061         vf.mesh(),
00062         dimensionedScalar("1", dimless, 1.0)
00063     );
00064 
00065     return fvm::laplacian(Gamma, vf, name);
00066 }
00067 
00068 
00069 template<class Type>
00070 tmp<fvMatrix<Type> >
00071 laplacian
00072 (
00073     GeometricField<Type, fvPatchField, volMesh>& vf
00074 )
00075 {
00076     surfaceScalarField Gamma
00077     (
00078         IOobject
00079         (
00080             "1",
00081             vf.time().constant(),
00082             vf.mesh(),
00083             IOobject::NO_READ
00084         ),
00085         vf.mesh(),
00086         dimensionedScalar("1", dimless, 1.0)
00087     );
00088 
00089     return fvm::laplacian
00090     (
00091         Gamma,
00092         vf,
00093         "laplacian(" + vf.name() + ')'
00094     );
00095 }
00096 
00097 
00098 template<class Type>
00099 tmp<fvMatrix<Type> >
00100 laplacian
00101 (
00102     const zeroField&,
00103     GeometricField<Type, fvPatchField, volMesh>& vf,
00104     const word& name
00105 )
00106 {
00107     return tmp<fvMatrix<Type> >
00108     (
00109         new fvMatrix<Type>(vf, dimensionSet(0, 0, -2, 0, 0))
00110     );
00111 }
00112 
00113 
00114 template<class Type>
00115 tmp<fvMatrix<Type> >
00116 laplacian
00117 (
00118     const zeroField&,
00119     GeometricField<Type, fvPatchField, volMesh>& vf
00120 )
00121 {
00122     return tmp<fvMatrix<Type> >
00123     (
00124         new fvMatrix<Type>(vf, dimensionSet(0, 0, -2, 0, 0))
00125     );
00126 }
00127 
00128 
00129 template<class Type>
00130 tmp<fvMatrix<Type> >
00131 laplacian
00132 (
00133     const oneField&,
00134     GeometricField<Type, fvPatchField, volMesh>& vf,
00135     const word& name
00136 )
00137 {
00138     return fvm::laplacian(vf, name);
00139 }
00140 
00141 
00142 template<class Type>
00143 tmp<fvMatrix<Type> >
00144 laplacian
00145 (
00146     const oneField&,
00147     GeometricField<Type, fvPatchField, volMesh>& vf
00148 )
00149 {
00150     return fvm::laplacian(vf);
00151 }
00152 
00153 
00154 template<class Type, class GType>
00155 tmp<fvMatrix<Type> >
00156 laplacian
00157 (
00158     const dimensioned<GType>& gamma,
00159     GeometricField<Type, fvPatchField, volMesh>& vf,
00160     const word& name
00161 )
00162 {
00163     GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
00164     (
00165         IOobject
00166         (
00167             gamma.name(),
00168             vf.instance(),
00169             vf.mesh(),
00170             IOobject::NO_READ
00171         ),
00172         vf.mesh(),
00173         gamma
00174     );
00175 
00176     return fvm::laplacian(Gamma, vf, name);
00177 }
00178 
00179 
00180 template<class Type, class GType>
00181 tmp<fvMatrix<Type> >
00182 laplacian
00183 (
00184     const dimensioned<GType>& gamma,
00185     GeometricField<Type, fvPatchField, volMesh>& vf
00186 )
00187 {
00188     GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
00189     (
00190         IOobject
00191         (
00192             gamma.name(),
00193             vf.instance(),
00194             vf.mesh(),
00195             IOobject::NO_READ
00196         ),
00197         vf.mesh(),
00198         gamma
00199     );
00200 
00201     return fvm::laplacian(Gamma, vf);
00202 }
00203 
00204 
00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00206 
00207 template<class Type, class GType>
00208 tmp<fvMatrix<Type> >
00209 laplacian
00210 (
00211     const GeometricField<GType, fvPatchField, volMesh>& gamma,
00212     GeometricField<Type, fvPatchField, volMesh>& vf,
00213     const word& name
00214 )
00215 {
00216     return fv::laplacianScheme<Type, GType>::New
00217     (
00218         vf.mesh(),
00219         vf.mesh().laplacianScheme(name)
00220     )().fvmLaplacian(gamma, vf);
00221 }
00222 
00223 
00224 template<class Type, class GType>
00225 tmp<fvMatrix<Type> >
00226 laplacian
00227 (
00228     const tmp<GeometricField<GType, fvPatchField, volMesh> >& tgamma,
00229     GeometricField<Type, fvPatchField, volMesh>& vf,
00230     const word& name
00231 )
00232 {
00233     tmp<fvMatrix<Type> > Laplacian(fvm::laplacian(tgamma(), vf, name));
00234     tgamma.clear();
00235     return Laplacian;
00236 }
00237 
00238 
00239 template<class Type, class GType>
00240 tmp<fvMatrix<Type> >
00241 laplacian
00242 (
00243     const GeometricField<GType, fvPatchField, volMesh>& gamma,
00244     GeometricField<Type, fvPatchField, volMesh>& vf
00245 )
00246 {
00247     return fvm::laplacian
00248     (
00249         gamma,
00250         vf,
00251         "laplacian(" + gamma.name() + ',' + vf.name() + ')'
00252     );
00253 }
00254 
00255 
00256 template<class Type, class GType>
00257 tmp<fvMatrix<Type> >
00258 laplacian
00259 (
00260     const tmp<GeometricField<GType, fvPatchField, volMesh> >& tgamma,
00261     GeometricField<Type, fvPatchField, volMesh>& vf
00262 )
00263 {
00264     tmp<fvMatrix<Type> > Laplacian(fvm::laplacian(tgamma(), vf));
00265     tgamma.clear();
00266     return Laplacian;
00267 }
00268 
00269 
00270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00271 
00272 template<class Type, class GType>
00273 tmp<fvMatrix<Type> >
00274 laplacian
00275 (
00276     const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
00277     GeometricField<Type, fvPatchField, volMesh>& vf,
00278     const word& name
00279 )
00280 {
00281     return fv::laplacianScheme<Type, GType>::New
00282     (
00283         vf.mesh(),
00284         vf.mesh().laplacianScheme(name)
00285     )().fvmLaplacian(gamma, vf);
00286 }
00287 
00288 
00289 template<class Type, class GType>
00290 tmp<fvMatrix<Type> >
00291 laplacian
00292 (
00293     const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >& tgamma,
00294     GeometricField<Type, fvPatchField, volMesh>& vf,
00295     const word& name
00296 )
00297 {
00298     tmp<fvMatrix<Type> > tLaplacian = fvm::laplacian(tgamma(), vf, name);
00299     tgamma.clear();
00300     return tLaplacian;
00301 }
00302 
00303 
00304 template<class Type, class GType>
00305 tmp<fvMatrix<Type> >
00306 laplacian
00307 (
00308     const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
00309     GeometricField<Type, fvPatchField, volMesh>& vf
00310 )
00311 {
00312     return fvm::laplacian
00313     (
00314         gamma,
00315         vf,
00316         "laplacian(" + gamma.name() + ',' + vf.name() + ')'
00317     );
00318 }
00319 
00320 
00321 template<class Type, class GType>
00322 tmp<fvMatrix<Type> >
00323 laplacian
00324 (
00325     const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >& tGamma,
00326     GeometricField<Type, fvPatchField, volMesh>& vf
00327 )
00328 {
00329     tmp<fvMatrix<Type> > tfvm(fvm::laplacian(tGamma(), vf));
00330     tGamma.clear();
00331     return tfvm;
00332 }
00333 
00334 
00335 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00336 
00337 } // End namespace fvm
00338 
00339 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00340 
00341 } // End namespace Foam
00342 
00343 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd