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 | Copyright (C) 2016 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::FixedValueConstraint
26 
27 Description
28  Constrain the field values within a specified region.
29 
30 Usage
31  For example to set the turbulence properties within a porous region:
32  \verbatim
33  porosityTurbulence
34  {
35  type scalarFixedValueConstraint;
36  active yes;
37 
38  scalarFixedValueConstraintCoeffs
39  {
40  selectionMode cellZone;
41  cellZone porosity;
42  fieldValues
43  {
44  k 1;
45  epsilon 150;
46  }
47  }
48  }
49  \endverbatim
50 
51 See also
52  Foam::fvOption
53 
54 SourceFiles
55  FixedValueConstraint.C
56  fixedValueConstraints.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef FixedValueConstraint_H
61 #define FixedValueConstraint_H
62 
63 #include "cellSetOption.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace fv
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class FixedValueConstraint Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class Type>
78 :
79  public cellSetOption
80 {
81  // Private member data
82 
83  //- Field values
84  List<Type> fieldValues_;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("FixedValueConstraint");
91 
92 
93  // Constructors
94 
95  //- Construct from components
97  (
98  const word& name,
99  const word& modelType,
100  const dictionary& dict,
101  const fvMesh& mesh
102  );
103 
104 
105  // Member Functions
106 
107  //- Read source dictionary
108  virtual bool read(const dictionary& dict);
109 
110  //- Set value on field
111  virtual void constrain(fvMatrix<Type>& eqn, const label fieldi);
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace fv
118 } // End namespace Foam
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #ifdef NoRepository
123  #include "FixedValueConstraint.C"
124 #endif
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Constrain the field values within a specified region.
FixedValueConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual void constrain(fvMatrix< Type > &eqn, const label fieldi)
Set value on field.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:71
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Cell-set options abtract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
virtual bool read(const dictionary &dict)
Read source dictionary.
Namespace for OpenFOAM.
TypeName("FixedValueConstraint")
Runtime type information.