fixedTemperatureConstraint.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) 2012-2021 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::fixedTemperatureConstraint
26 
27 Description
28  Fixed temperature equation constraint
29 
30 Usage
31  \verbatim
32  fixedTemperature
33  {
34  type fixedTemperatureConstraint;
35 
36  selectionMode all;
37 
38  phase gas; // Optional phase name
39 
40  // Uniform temperature constraint
41  mode uniform;
42  temperature constant 500; // Uniform temperature
43 
44  // // Looked-up field temperature constraint
45  // T T; // Temperature field name
46  }
47  \endverbatim
48 
49 Note
50  The 'uniform' option allows the use of a time-varying uniform temperature
51  by means of the Function1 type.
52 
53 SourceFiles
54  fixedTemperatureConstraint.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef fixedTemperatureConstraint_H
59 #define fixedTemperatureConstraint_H
60 
61 #include "fvConstraint.H"
62 #include "fvCellSet.H"
63 #include "NamedEnum.H"
64 #include "Function1.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 namespace fv
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class fixedTemperatureConstraint Declaration
75 \*---------------------------------------------------------------------------*/
76 
78 :
79  public fvConstraint
80 {
81 public:
82 
83  //- Temperature mode
84  enum class temperatureMode
85  {
86  uniform,
87  lookup
88  };
89 
90  //- String representation of mode enums
92 
93 
94 private:
95 
96  // Private Data
97 
98  //- The set of cells the fvConstraint applies to
99  fvCellSet set_;
100 
101  //- Operation mode
102  temperatureMode mode_;
103 
104  //- Uniform temperature [K]
105  autoPtr<Function1<scalar>> TValue_;
106 
107  //- Temperature field name
108  word TName_;
109 
110  //- Optional phase name
111  word phaseName_;
112 
113 
114  // Private Member Functions
115 
116  //- Non-virtual read
117  void readCoeffs();
118 
119 
120 public:
121 
122  //- Runtime type information
123  TypeName("fixedTemperatureConstraint");
124 
125 
126  // Constructors
127 
128  //- Construct from components
130  (
131  const word& name,
132  const word& modelType,
133  const dictionary& dict,
134  const fvMesh& mesh
135  );
136 
137  //- Disallow default bitwise copy construction
139 
140 
141  //- Destructor
143  {}
144 
145 
146  // Member Functions
147 
148  //- Return the list of fields constrained by the fvConstraint
149  virtual wordList constrainedFields() const;
150 
151  //- Constrain energy equation to fix the temperature
152  virtual bool constrain
153  (
154  fvMatrix<scalar>& eqn,
155  const word& fieldName
156  ) const;
157 
158  //- Update for mesh changes
159  virtual void updateMesh(const mapPolyMesh&);
160 
161  //- Read dictionary
162  virtual bool read(const dictionary& dict);
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const fixedTemperatureConstraint&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace fv
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
dictionary dict
virtual bool read(const dictionary &dict)
Read dictionary.
TypeName("fixedTemperatureConstraint")
Runtime type information.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvConstraintI.H:34
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Cell-set fvConstraint abstract base class. Provides a base set of controls regarding the location whe...
static const NamedEnum< temperatureMode, 2 > modeNames_
String representation of mode enums.
fixedTemperatureConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual void updateMesh(const mapPolyMesh &)
Update for mesh changes.
Fixed temperature equation constraint.
virtual bool constrain(fvMatrix< scalar > &eqn, const word &fieldName) const
Constrain energy equation to fix the temperature.
void operator=(const fixedTemperatureConstraint &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
const word & name() const
Return const access to the source name.
Definition: fvConstraintI.H:28
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:72
virtual wordList constrainedFields() const
Return the list of fields constrained by the fvConstraint.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Finite volume options abstract base class.
Definition: fvConstraint.H:54
Namespace for OpenFOAM.