initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / finiteVolume / gradSchemes / limitedGradSchemes / faceMDLimitedGrad / faceMDLimitedGrad.H
blobf9c826452ae890b0c5d266c8651346f427e407f5
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::fv::faceMDLimitedGrad
28 Description
29     faceMDLimitedGrad gradient scheme applied to a runTime selected
30     base gradient scheme.
32     The scalar limiter based on limiting the extrapolated face values
33     between the face-neighbour cell values and is applied to the gradient
34     in each face direction separately.
36 SourceFiles
37     faceMDLimitedGrad.C
39 \*---------------------------------------------------------------------------*/
41 #ifndef faceMDLimitedGrad_H
42 #define faceMDLimitedGrad_H
44 #include "gradScheme.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace fv
56 /*---------------------------------------------------------------------------*\
57                        Class faceMDLimitedGrad Declaration
58 \*---------------------------------------------------------------------------*/
60 template<class Type>
61 class faceMDLimitedGrad
63     public fv::gradScheme<Type>
65     // Private Data
67         tmp<fv::gradScheme<Type> > basicGradScheme_;
69         //- Limiter coefficient
70         const scalar k_;
73     // Private Member Functions
75         inline void limitFace
76         (
77             scalar& limiter,
78             const scalar maxDelta,
79             const scalar minDelta,
80             const scalar extrapolate
81         ) const;
84         //- Disallow default bitwise copy construct
85         faceMDLimitedGrad(const faceMDLimitedGrad&);
87         //- Disallow default bitwise assignment
88         void operator=(const faceMDLimitedGrad&);
91 public:
93     //- RunTime type information
94     TypeName("faceMDLimited");
97     // Constructors
99         //- Construct from mesh and schemeData
100         faceMDLimitedGrad(const fvMesh& mesh, Istream& schemeData)
101         :
102             gradScheme<Type>(mesh),
103             basicGradScheme_(fv::gradScheme<Type>::New(mesh, schemeData)),
104             k_(readScalar(schemeData))
105         {
106             if (k_ < 0 || k_ > 1)
107             {
108                 FatalIOErrorIn
109                 (
110                     "faceMDLimitedGrad(const fvMesh&, Istream& schemeData)",
111                     schemeData
112                 )   << "coefficient = " << k_
113                     << " should be >= 0 and <= 1"
114                     << exit(FatalIOError);
115             }
116         }
119     // Member Functions
121         tmp
122         <
123             GeometricField
124             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
125         > grad
126         (
127             const GeometricField<Type, fvPatchField, volMesh>&
128         ) const;
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 } // End namespace fv
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 } // End namespace Foam
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 #endif
144 // ************************************************************************* //