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

fvmSup.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 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 template<class Type>
00034 Foam::tmp<Foam::fvMatrix<Type> >
00035 Foam::fvm::Su
00036 (
00037     const DimensionedField<Type, volMesh>& su,
00038     GeometricField<Type, fvPatchField, volMesh>& vf
00039 )
00040 {
00041     const fvMesh& mesh = vf.mesh();
00042 
00043     tmp<fvMatrix<Type> > tfvm
00044     (
00045         new fvMatrix<Type>
00046         (
00047             vf,
00048             dimVol*su.dimensions()
00049         )
00050     );
00051     fvMatrix<Type>& fvm = tfvm();
00052 
00053     fvm.source() -= mesh.V()*su.field();
00054 
00055     return tfvm;
00056 }
00057 
00058 template<class Type>
00059 Foam::tmp<Foam::fvMatrix<Type> >
00060 Foam::fvm::Su
00061 (
00062     const tmp<DimensionedField<Type, volMesh> >& tsu,
00063     GeometricField<Type, fvPatchField, volMesh>& vf
00064 )
00065 {
00066     tmp<fvMatrix<Type> > tfvm = fvm::Su(tsu(), vf);
00067     tsu.clear();
00068     return tfvm;
00069 }
00070 
00071 template<class Type>
00072 Foam::tmp<Foam::fvMatrix<Type> >
00073 Foam::fvm::Su
00074 (
00075     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu,
00076     GeometricField<Type, fvPatchField, volMesh>& vf
00077 )
00078 {
00079     tmp<fvMatrix<Type> > tfvm = fvm::Su(tsu(), vf);
00080     tsu.clear();
00081     return tfvm;
00082 }
00083 
00084 template<class Type>
00085 Foam::zeroField
00086 Foam::fvm::Su
00087 (
00088     const zeroField&,
00089     GeometricField<Type, fvPatchField, volMesh>& vf
00090 )
00091 {
00092     return zeroField();
00093 }
00094 
00095 
00096 template<class Type>
00097 Foam::tmp<Foam::fvMatrix<Type> >
00098 Foam::fvm::Sp
00099 (
00100     const DimensionedField<scalar, volMesh>& sp,
00101     GeometricField<Type, fvPatchField, volMesh>& vf
00102 )
00103 {
00104     const fvMesh& mesh = vf.mesh();
00105 
00106     tmp<fvMatrix<Type> > tfvm
00107     (
00108         new fvMatrix<Type>
00109         (
00110             vf,
00111             dimVol*sp.dimensions()*vf.dimensions()
00112         )
00113     );
00114     fvMatrix<Type>& fvm = tfvm();
00115 
00116     fvm.diag() += mesh.V()*sp.field();
00117 
00118     return tfvm;
00119 }
00120 
00121 template<class Type>
00122 Foam::tmp<Foam::fvMatrix<Type> >
00123 Foam::fvm::Sp
00124 (
00125     const tmp<DimensionedField<scalar, volMesh> >& tsp,
00126     GeometricField<Type, fvPatchField, volMesh>& vf
00127 )
00128 {
00129     tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf);
00130     tsp.clear();
00131     return tfvm;
00132 }
00133 
00134 template<class Type>
00135 Foam::tmp<Foam::fvMatrix<Type> >
00136 Foam::fvm::Sp
00137 (
00138     const tmp<volScalarField>& tsp,
00139     GeometricField<Type, fvPatchField, volMesh>& vf
00140 )
00141 {
00142     tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf);
00143     tsp.clear();
00144     return tfvm;
00145 }
00146 
00147 
00148 template<class Type>
00149 Foam::tmp<Foam::fvMatrix<Type> >
00150 Foam::fvm::Sp
00151 (
00152     const dimensionedScalar& sp,
00153     GeometricField<Type, fvPatchField, volMesh>& vf
00154 )
00155 {
00156     const fvMesh& mesh = vf.mesh();
00157 
00158     tmp<fvMatrix<Type> > tfvm
00159     (
00160         new fvMatrix<Type>
00161         (
00162             vf,
00163             dimVol*sp.dimensions()*vf.dimensions()
00164         )
00165     );
00166     fvMatrix<Type>& fvm = tfvm();
00167 
00168     fvm.diag() += mesh.V()*sp.value();
00169 
00170     return tfvm;
00171 }
00172 
00173 template<class Type>
00174 Foam::zeroField
00175 Foam::fvm::Sp
00176 (
00177     const zeroField&,
00178     GeometricField<Type, fvPatchField, volMesh>&
00179 )
00180 {
00181     return zeroField();
00182 }
00183 
00184 
00185 template<class Type>
00186 Foam::tmp<Foam::fvMatrix<Type> >
00187 Foam::fvm::SuSp
00188 (
00189     const DimensionedField<scalar, volMesh>& susp,
00190     GeometricField<Type, fvPatchField, volMesh>& vf
00191 )
00192 {
00193     const fvMesh& mesh = vf.mesh();
00194 
00195     tmp<fvMatrix<Type> > tfvm
00196     (
00197         new fvMatrix<Type>
00198         (
00199             vf,
00200             dimVol*susp.dimensions()*vf.dimensions()
00201         )
00202     );
00203     fvMatrix<Type>& fvm = tfvm();
00204 
00205     fvm.diag() += mesh.V()*max(susp.field(), scalar(0));
00206 
00207     fvm.source() -= mesh.V()*min(susp.field(), scalar(0))
00208         *vf.internalField();
00209 
00210     return tfvm;
00211 }
00212 
00213 template<class Type>
00214 Foam::tmp<Foam::fvMatrix<Type> >
00215 Foam::fvm::SuSp
00216 (
00217     const tmp<DimensionedField<scalar, volMesh> >& tsusp,
00218     GeometricField<Type, fvPatchField, volMesh>& vf
00219 )
00220 {
00221     tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf);
00222     tsusp.clear();
00223     return tfvm;
00224 }
00225 
00226 template<class Type>
00227 Foam::tmp<Foam::fvMatrix<Type> >
00228 Foam::fvm::SuSp
00229 (
00230     const tmp<volScalarField>& tsusp,
00231     GeometricField<Type, fvPatchField, volMesh>& vf
00232 )
00233 {
00234     tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf);
00235     tsusp.clear();
00236     return tfvm;
00237 }
00238 
00239 template<class Type>
00240 Foam::zeroField
00241 Foam::fvm::SuSp
00242 (
00243     const zeroField&,
00244     GeometricField<Type, fvPatchField, volMesh>& vf
00245 )
00246 {
00247     return zeroField();
00248 }
00249 
00250 
00251 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd