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

SLTSDdtScheme.H

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 Class
00026     Foam::fv::SLTSDdtScheme
00027 
00028 Description
00029     Stabilised local time-step first-order Euler implicit/explicit ddt.
00030     The time-step is adjusted locally so that an advective equations remains
00031     diagonally dominant.
00032 
00033     This scheme should only be used for steady-state computations
00034     using transient codes where local time-stepping is preferably to
00035     under-relaxation for transport consistency reasons.
00036 
00037     See also CoEulerDdtScheme.
00038 
00039 SourceFiles
00040     SLTSDdtScheme.C
00041 
00042 \*---------------------------------------------------------------------------*/
00043 
00044 #ifndef SLTSDdtScheme_H
00045 #define SLTSDdtScheme_H
00046 
00047 #include "ddtScheme.H"
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00055 
00056 namespace fv
00057 {
00058 
00059 /*---------------------------------------------------------------------------*\
00060                        Class SLTSDdtScheme Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class Type>
00064 class SLTSDdtScheme
00065 :
00066     public fv::ddtScheme<Type>
00067 {
00068     // Private Data
00069 
00070         //- Name of the flux field used to calculate the local time-step
00071         word phiName_;
00072 
00073         //- Name of the density field used to obtain the volumetric flux
00074         //  from the mass flux if required
00075         word rhoName_;
00076 
00077         //- Under-relaxation factor
00078         scalar alpha_;
00079 
00080 
00081     // Private Member Functions
00082 
00083         //- Disallow default bitwise copy construct
00084         SLTSDdtScheme(const SLTSDdtScheme&);
00085 
00086         //- Disallow default bitwise assignment
00087         void operator=(const SLTSDdtScheme&);
00088 
00089         //- Calculate a relaxed diagonal from the given flux field
00090         void relaxedDiag(scalarField& rD, const surfaceScalarField& phi) const;
00091 
00092         //- Return the reciprocal of the stabilised local time-step
00093         tmp<volScalarField> SLrDeltaT() const;
00094 
00095 
00096 public:
00097 
00098     //- Runtime type information
00099     TypeName("SLTS");
00100 
00101 
00102     // Constructors
00103 
00104         //- Construct from mesh and Istream
00105         SLTSDdtScheme(const fvMesh& mesh, Istream& is)
00106         :
00107             ddtScheme<Type>(mesh, is),
00108             phiName_(is),
00109             rhoName_(is),
00110             alpha_(readScalar(is))
00111         {}
00112 
00113 
00114     // Member Functions
00115 
00116         //- Return mesh reference
00117         const fvMesh& mesh() const
00118         {
00119             return fv::ddtScheme<Type>::mesh();
00120         }
00121 
00122         tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
00123         (
00124             const dimensioned<Type>&
00125         );
00126 
00127         tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
00128         (
00129             const GeometricField<Type, fvPatchField, volMesh>&
00130         );
00131 
00132         tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
00133         (
00134             const dimensionedScalar&,
00135             const GeometricField<Type, fvPatchField, volMesh>&
00136         );
00137 
00138         tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
00139         (
00140             const volScalarField&,
00141             const GeometricField<Type, fvPatchField, volMesh>&
00142         );
00143 
00144         tmp<fvMatrix<Type> > fvmDdt
00145         (
00146             GeometricField<Type, fvPatchField, volMesh>&
00147         );
00148 
00149         tmp<fvMatrix<Type> > fvmDdt
00150         (
00151             const dimensionedScalar&,
00152             GeometricField<Type, fvPatchField, volMesh>&
00153         );
00154 
00155         tmp<fvMatrix<Type> > fvmDdt
00156         (
00157             const volScalarField&,
00158             GeometricField<Type, fvPatchField, volMesh>&
00159         );
00160 
00161         typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;
00162 
00163         tmp<fluxFieldType> fvcDdtPhiCorr
00164         (
00165             const volScalarField& rA,
00166             const GeometricField<Type, fvPatchField, volMesh>& U,
00167             const fluxFieldType& phi
00168         );
00169 
00170         tmp<fluxFieldType> fvcDdtPhiCorr
00171         (
00172             const volScalarField& rA,
00173             const volScalarField& rho,
00174             const GeometricField<Type, fvPatchField, volMesh>& U,
00175             const fluxFieldType& phi
00176         );
00177 
00178         tmp<surfaceScalarField> meshPhi
00179         (
00180             const GeometricField<Type, fvPatchField, volMesh>&
00181         );
00182 };
00183 
00184 
00185 template<>
00186 tmp<surfaceScalarField> SLTSDdtScheme<scalar>::fvcDdtPhiCorr
00187 (
00188     const volScalarField& rA,
00189     const volScalarField& U,
00190     const surfaceScalarField& phi
00191 );
00192 
00193 
00194 template<>
00195 tmp<surfaceScalarField> SLTSDdtScheme<scalar>::fvcDdtPhiCorr
00196 (
00197     const volScalarField& rA,
00198     const volScalarField& rho,
00199     const volScalarField& U,
00200     const surfaceScalarField& phi
00201 );
00202 
00203 
00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00205 
00206 } // End namespace fv
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 } // End namespace Foam
00211 
00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00213 
00214 #ifdef NoRepository
00215 #   include "SLTSDdtScheme.C"
00216 #endif
00217 
00218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00219 
00220 #endif
00221 
00222 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd