interfaceCompression.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::interfaceCompressionLimiter
28 
29 Description
30  Interface compression scheme currently based on the generic limited
31  scheme although it does not use the NVD/TVD functions.
32 
33 SourceFiles
34  interfaceCompression.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef interfaceCompression_H
39 #define interfaceCompression_H
40 
41 #include "vector.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class interfaceCompressionWeight Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 {
54 
55 public:
56 
58  {}
59 
60  scalar limiter
61  (
62  const scalar cdWeight,
63  const scalar faceFlux,
64  const scalar phiP,
65  const scalar phiN,
66  const vector&,
67  const scalar
68  ) const
69  {
70  // Quadratic compression scheme
71  //return min(max(4*min(phiP*(1 - phiP), phiN*(1 - phiN)), 0), 1);
72 
73  // Quartic compression scheme
74  return clamp
75  (
76  1 - max(sqr(1 - 4*phiP*(1 - phiP)), sqr(1 - 4*phiN*(1 - phiN))),
77  0, 1
78  );
79  }
80 };
81 
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 } // End namespace Foam
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 #endif
90 
91 // ************************************************************************* //
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
dimensionedSymmTensor sqr(const dimensionedVector &dv)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
scalar limiter(const scalar cdWeight, const scalar faceFlux, const scalar phiP, const scalar phiN, const vector &, const scalar) const
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Interface compression scheme currently based on the generic limited scheme although it does not use t...
Namespace for OpenFOAM.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
Definition: dimensionSet.C:271