FixedValueConstraint.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) 2016-2017 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::fv::FixedValueConstraint
29
30Group
31 grpFvOptionsConstraints
32
33Description
34 Constrain values of given fields of \c Type with
35 a given maximum value within a specified region,
36 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
37
38Usage
39 Minimal example by using \c constant/fvOptions:
40 \verbatim
41 <Type>FixedValueConstraint1
42 {
43 // Mandatory entries (unmodifiable)
44 type <Type>FixedValueConstraint;
45
46 // Mandatory entries (runtime modifiable)
47 fieldValues
48 {
49 <fieldName1> <value1>;
50 <fieldName2> <value2>;
51 ...
52 <fieldNameN> <valueN>;
53 }
54
55 // Mandatory/Optional (inherited) entries
56 ...
57 }
58 \endverbatim
59
60 where the entries mean:
61 \table
62 Property | Description | Type | Reqd | Dflt
63 type | Type name: <Type>FixedValueConstraint | word | yes | -
64 fieldValues | Dictionary containing pairs of names and maximum <!--
65 --> values of operand fields of <Type> | dictionary | yes | -
66 \endtable
67
68 The inherited entries are elaborated in:
69 - \link fvOption.H \endlink
70 - \link cellSetOption.H \endlink
71
72
73 For example to set the turbulence properties within a porous region:
74 \verbatim
75 porosityTurbulence
76 {
77 type scalarFixedValueConstraint;
78 active yes;
79
80 selectionMode cellZone;
81 cellZone porosity;
82 fieldValues
83 {
84 k 1;
85 epsilon 150;
86 }
87 }
88 \endverbatim
89
90See also
91 - Foam::fv::fixedTemperatureConstraint
92 - Foam::fv::velocityDampingConstraint
93
94SourceFiles
95 FixedValueConstraint.C
96 fixedValueConstraints.C
97
98\*---------------------------------------------------------------------------*/
99
100#ifndef FixedValueConstraint_H
101#define FixedValueConstraint_H
102
103#include "cellSetOption.H"
104
105// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106
107namespace Foam
108{
109namespace fv
110{
111
112/*---------------------------------------------------------------------------*\
113 Class FixedValueConstraint Declaration
114\*---------------------------------------------------------------------------*/
115
116template<class Type>
117class FixedValueConstraint
118:
119 public fv::cellSetOption
120{
121 // Private Data
122
123 //- Field values
124 List<Type> fieldValues_;
125
126
127public:
128
129 //- Runtime type information
130 TypeName("FixedValueConstraint");
131
132
133 // Constructors
134
135 //- Construct from components
137 (
138 const word& name,
139 const word& modelType,
140 const dictionary& dict,
141 const fvMesh& mesh
142 );
143
144 //- No copy construct
146
147 //- No copy assignment
148 void operator=(const FixedValueConstraint&) = delete;
150
151 //- Destructor
152 virtual ~FixedValueConstraint() = default;
153
154
155 // Member Functions
156
157 //- Read source dictionary
158 virtual bool read(const dictionary& dict);
159
160 //- Set value on field
161 virtual void constrain(fvMatrix<Type>& eqn, const label fieldi);
162};
163
165// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166
167} // End namespace fv
168} // End namespace Foam
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172#ifdef NoRepository
173 #include "FixedValueConstraint.C"
174#endif
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178#endif
179
180// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Constrain values of given fields of Type with a given maximum value within a specified region,...
FixedValueConstraint(const FixedValueConstraint &)=delete
No copy construct.
virtual ~FixedValueConstraint()=default
Destructor.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void constrain(fvMatrix< Type > &eqn, const label fieldi)
Set value on field.
TypeName("FixedValueConstraint")
Runtime type information.
void operator=(const FixedValueConstraint &)=delete
No copy assignment.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73