boundConstraint.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fv::bound
26 
27 Description
28  Bound the specified scalar field where it is below the specified minimum.
29 
30  Where the field is unbounded it is set to the maximum of the average of
31  the neighbouring cell values and the specified minimum.
32 
33 Usage
34  Example usage:
35  \verbatim
36  limitp
37  {
38  type bound;
39 
40  field p;
41 
42  min 100;
43  }
44  \endverbatim
45 
46 SourceFiles
47  bound.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef boundConstraint_H
52 #define boundConstraint_H
53 
54 #include "fvConstraint.H"
55 #include "dimensionedScalar.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 namespace fv
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class bound Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class bound
69 :
70  public fvConstraint
71 {
72  // Private data
73 
74  //- Field name
75  word fieldName_;
76 
77  //- Minimum value
78  scalar min_;
79 
80 
81  // Private Member Functions
82 
83  //- Non-virtual read
84  void readCoeffs();
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("bound");
91 
92 
93  // Constructors
94 
95  //- Construct from components
96  bound
97  (
98  const word& name,
99  const word& modelType,
100  const fvMesh& mesh,
101  const dictionary& dict
102  );
103 
104  //- Disallow default bitwise copy construction
105  bound(const bound&) = delete;
106 
107 
108  //- Destructor
109  virtual ~bound()
110  {}
111 
112 
113  // Member Functions
114 
115  //- Return the list of fields constrained by the fvConstraint
116  virtual wordList constrainedFields() const;
117 
118  //- Constrain the pressure field
119  virtual bool constrain(volScalarField& p) const;
120 
121  //- Update for mesh motion
122  virtual bool movePoints();
123 
124  //- Update topology using the given map
125  virtual void topoChange(const polyTopoChangeMap&);
126 
127  //- Update from another mesh using the given map
128  virtual void mapMesh(const polyMeshMap&);
129 
130  //- Redistribute or update using the given distribution map
131  virtual void distribute(const polyDistributionMap&);
132 
133  //- Read dictionary
134  virtual bool read(const dictionary& dict);
135 
136 
137  // Member Operators
138 
139  //- Disallow default bitwise assignment
140  void operator=(const bound&) = delete;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace fv
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Finite volume options abstract base class.
Definition: fvConstraint.H:57
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvConstraintI.H:34
const word & name() const
Return const access to the source name.
Definition: fvConstraintI.H:28
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Bound the specified scalar field where it is below the specified minimum.
virtual bool movePoints()
Update for mesh motion.
virtual bool constrain(volScalarField &p) const
Constrain the pressure field.
void operator=(const bound &)=delete
Disallow default bitwise assignment.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
TypeName("bound")
Runtime type information.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
bound(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual wordList constrainedFields() const
Return the list of fields constrained by the fvConstraint.
virtual ~bound()
Destructor.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict
volScalarField & p