fixedTemperatureConstraint.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) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::fv::fixedTemperatureConstraint
29 
30 Group
31  grpFvOptionsConstraints
32 
33 Description
34  Constrain temperature equation (i.e. \c T) with
35  a given set of fixed values within a specified region.
36 
37  Constraints applied to:
38  \verbatim
39  T | Temperature [K]
40  \endverbatim
41 
42  Required fields:
43  \verbatim
44  T | Temperature [K]
45  e/h | Internal energy/Enthalphy [m2/s2]
46  \endverbatim
47 
48 Usage
49  Minimal example by using \c constant/fvOptions:
50  \verbatim
51  fixedTemperatureConstraint1
52  {
53  // Mandatory entries (unmodifiable)
54  type fixedTemperatureConstraint;
55  mode <mode>;
56 
57  // Conditional mandatory/optional entries (runtime modifiable)
58 
59  // when mode=uniform (mandatory)
60  temperature constant 500; // fixed temperature with time [K]
61 
62  // when mode=lookup (optional)
63  T <Tname>;
64 
65  // Mandatory/Optional (inherited) entries
66  ...
67  }
68  \endverbatim
69 
70  where the entries mean:
71  \table
72  Property | Description | Type | Reqd | Dflt
73  type | Type name: fixedTemperatureConstraint | word | yes | -
74  mode | Temperature mode - see below | word | yes | -
75  temperature | Function1 type temperature field | Function1 | cndtnl | -
76  T | Name of operand temperature field | word | cndtnl | T
77  \endtable
78 
79  Options for the \c mode entry:
80  \verbatim
81  uniform | Use Function1 type temperature field
82  lookup | Use temperature field given field name
83  \endverbatim
84 
85  The inherited entries are elaborated in:
86  - \link fvOption.H \endlink
87  - \link cellSetOption.H \endlink
88 
89 Note:
90  - The \c uniform option allows the use of a time-varying
91  uniform temperature by means of the \c Function1 type.
92 
93 See also
94  - Foam::fv::limitTemperature
95  - Foam::Function1
96 
97 SourceFiles
98  fixedTemperatureConstraint.C
99 
100 \*---------------------------------------------------------------------------*/
101 
102 #ifndef fixedTemperatureConstraint_H
103 #define fixedTemperatureConstraint_H
104 
105 #include "cellSetOption.H"
106 #include "Enum.H"
107 #include "Function1.H"
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 namespace Foam
112 {
113 namespace fv
114 {
115 
116 /*---------------------------------------------------------------------------*\
117  Class fixedTemperatureConstraint Declaration
118 \*---------------------------------------------------------------------------*/
119 
120 class fixedTemperatureConstraint
121 :
122  public fv::cellSetOption
123 {
124 public:
125 
126  //- Temperature mode
127  enum temperatureMode
128  {
129  tmUniform,
130  tmLookup
131  };
132 
133  //- String representation of temperatureMode enums
134  static const Enum<temperatureMode> temperatureModeNames_;
135 
136 
137 protected:
138 
139  // Protected Data
140 
141  //- Operation mode
143 
144  //- Uniform temperature [K]
145  autoPtr<Function1<scalar>> Tuniform_;
146 
147  //- Temperature field name
148  word TName_;
149 
150 
151 public:
152 
153  //- Runtime type information
154  TypeName("fixedTemperatureConstraint");
155 
156 
157  // Constructors
158 
159  //- Construct from components
161  (
162  const word& name,
163  const word& modelType,
164  const dictionary& dict,
165  const fvMesh& mesh
166  );
167 
168  //- No copy construct
170 
171  //- No copy assignment
172  void operator=(const fixedTemperatureConstraint&) = delete;
173 
174 
175  //- Destructor
176  virtual ~fixedTemperatureConstraint() = default;
177 
178 
179  // Member Functions
180 
181  //- Constrain energy equation to fix the temperature
182  virtual void constrain(fvMatrix<scalar>& eqn, const label fieldi);
183 
184 
185  // IO
186 
187  //- Read dictionary
188  virtual bool read(const dictionary& dict);
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace fv
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
Foam::fv::fixedTemperatureConstraint::tmLookup
Definition: fixedTemperatureConstraint.H:159
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::Enum< temperatureMode >
Foam::fv::fixedTemperatureConstraint::temperatureModeNames_
static const Enum< temperatureMode > temperatureModeNames_
String representation of temperatureMode enums.
Definition: fixedTemperatureConstraint.H:163
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Function1.H
cellSetOption.H
Foam::fv::fixedTemperatureConstraint::TypeName
TypeName("fixedTemperatureConstraint")
Runtime type information.
Foam::fv::fixedTemperatureConstraint::mode_
temperatureMode mode_
Operation mode.
Definition: fixedTemperatureConstraint.H:171
Foam::fv::fixedTemperatureConstraint::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: fixedTemperatureConstraint.C:147
Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
fixedTemperatureConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: fixedTemperatureConstraint.C:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::fixedTemperatureConstraint::tmUniform
Definition: fixedTemperatureConstraint.H:158
fv
labelList fv(nPoints)
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::fixedTemperatureConstraint
Constrain temperature equation (i.e. T) with a given set of fixed values within a specified region.
Definition: fixedTemperatureConstraint.H:149
Foam::fv::fixedTemperatureConstraint::TName_
word TName_
Temperature field name.
Definition: fixedTemperatureConstraint.H:177
Foam::fv::fixedTemperatureConstraint::operator=
void operator=(const fixedTemperatureConstraint &)=delete
No copy assignment.
Foam::fv::fixedTemperatureConstraint::Tuniform_
autoPtr< Function1< scalar > > Tuniform_
Uniform temperature [K].
Definition: fixedTemperatureConstraint.H:174
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::fixedTemperatureConstraint::~fixedTemperatureConstraint
virtual ~fixedTemperatureConstraint()=default
Destructor.
Foam::fv::fixedTemperatureConstraint::constrain
virtual void constrain(fvMatrix< scalar > &eqn, const label fieldi)
Constrain energy equation to fix the temperature.
Definition: fixedTemperatureConstraint.C:113
Foam::fv::fixedTemperatureConstraint::temperatureMode
temperatureMode
Temperature mode.
Definition: fixedTemperatureConstraint.H:156
Enum.H