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-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::fixedTemperatureConstraint
26 
27 Description
28  Fixed temperature equation constraint
29 
30 Usage
31  \verbatim
32  fixedTemperature
33  {
34  type fixedTemperatureConstraint;
35 
36  select 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
51  temperature 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  //- Fraction of the constraint to apply. Facilitates ramping, or
114  // pulsing, or deactivation after a time. Should take a value between
115  // 0 and 1. Defaults to 1 (i.e., apply all of the constraint).
116  autoPtr<Function1<scalar>> fraction_;
117 
118 
119  // Private Member Functions
120 
121  //- Non-virtual read
122  void readCoeffs();
123 
124 
125 public:
126 
127  //- Runtime type information
128  TypeName("fixedTemperatureConstraint");
129 
130 
131  // Constructors
132 
133  //- Construct from components
135  (
136  const word& name,
137  const word& modelType,
138  const fvMesh& mesh,
139  const dictionary& dict
140  );
141 
142  //- Disallow default bitwise copy construction
144 
145 
146  //- Destructor
148  {}
149 
150 
151  // Member Functions
152 
153  //- Return the list of fields constrained by the fvConstraint
154  virtual wordList constrainedFields() const;
155 
156  //- Constrain energy equation to fix the temperature
157  virtual bool constrain
158  (
159  fvMatrix<scalar>& eqn,
160  const word& fieldName
161  ) const;
162 
163  //- Update for mesh motion
164  virtual bool movePoints();
165 
166  //- Update topology using the given map
167  virtual void topoChange(const polyTopoChangeMap&);
168 
169  //- Update from another mesh using the given map
170  virtual void mapMesh(const polyMeshMap&);
171 
172  //- Redistribute or update using the given distribution map
173  virtual void distribute(const polyDistributionMap&);
174 
175  //- Read dictionary
176  virtual bool read(const dictionary& dict);
177 
178 
179  // Member Operators
180 
181  //- Disallow default bitwise assignment
182  void operator=(const fixedTemperatureConstraint&) = delete;
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace fv
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
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
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Fixed temperature equation constraint.
virtual bool movePoints()
Update for mesh motion.
fixedTemperatureConstraint(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
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("fixedTemperatureConstraint")
Runtime type information.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual bool constrain(fvMatrix< scalar > &eqn, const word &fieldName) const
Constrain energy equation to fix the temperature.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
void operator=(const fixedTemperatureConstraint &)=delete
Disallow default bitwise assignment.
static const NamedEnum< temperatureMode, 2 > modeNames_
String representation of mode enums.
virtual wordList constrainedFields() const
Return the list of fields constrained by the fvConstraint.
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