lumpedMassTemperatureFvPatchScalarField.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) 2024 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::lumpedMassTemperatureFvPatchScalarField
26 
27 Description
28  This boundary condition is applied to a patch which bounds a solid body,
29  wholly or partially. It represents the body as a lumped mass, i.e. by a
30  single temperature \c T which is fixed across the patch. The body has a
31  volume \c V which is either specified by the user, or is calculated when
32  the patch describes a closed volume (including in 2D meshes). Starting from
33  an initial, specified \c T, the change in temperature is calculated over
34  time according to an applied power source \c Q and the heat transferred
35  across the boundary \f$Q_{b}\f$ (positive into the lumped mass):
36 
37  \f[
38  dT/dt = frac{Q + Q_{b}}{\rho C_{v} V}
39  \f]
40 
41  where
42  \vartable
43  Q | specified power source [W]
44  Q_{b} | total calculated heat transferred across the boundary [W]
45  \rho | density [kg/m^3]
46  C_{v} | specific heat capacity [J/(kg K)]
47  V | volume of the lumped mass [m^3}
48  \endtable
49 
50 Usage
51  \table
52  Property | Description | Req'd? | Default
53  rho | density | yes |
54  Cv | specific heat capacity | yes |
55  T | temperature | yes |
56  Q | power source | no | 0
57  volume | volume of the lumped mass | no | calculated
58  \endtable
59 
60  Example of the boundary condition specification:
61  \verbatim
62  <patchName>
63  {
64  type lumpedMassTemperature;
65  rho 1000;
66  Cv 1300;
67  T 500;
68  Q constant 0.5;
69  value uniform $T; // placeholder
70  }
71  \endverbatim
72 
73 SourceFiles
74  lumpedMassTemperatureFvPatchScalarField.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef lumpedMassTemperatureFvPatchScalarField_H
79 #define lumpedMassTemperatureFvPatchScalarField_H
80 
83 #include "Function1.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class lumpedMassTemperatureFvPatchScalarField Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class lumpedMassTemperatureFvPatchScalarField
95 :
96  public fixedValueFvPatchScalarField
97 {
98  // Private Data
99 
100  //- Density
101  const scalar rho_;
102 
103  //- Specific heat capacity
104  const scalar Cv_;
105 
106  //- Temperature of the thermal mass
107  UniformDimensionedField<scalar> T_;
108 
109  //- Heat source (optional)
110  autoPtr<Function1<scalar>> Q_;
111 
112  //- Volume of the lumped mass, defaults when enclosed by the patch
113  scalar V_;
114 
115 
116  // Private Member Functions
117 
118  //- Does the patch form a closed volume, including in a 2D case?
119  bool closed() const;
120 
121  //- Return volume formed by the enclosed patch
122  scalar V() const;
123 
124 
125 public:
126 
127  //- Runtime type information
128  TypeName("lumpedMassTemperature");
129 
130 
131  // Constructors
132 
133  //- Construct from patch, internal field and dictionary
135  (
136  const fvPatch&,
137  const DimensionedField<scalar, volMesh>&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given fixedValueTypeFvPatchField
142  // onto a new patch
144  (
146  const fvPatch&,
148  const fieldMapper&
149  );
150 
151  //- Disallow copy without setting internal field reference
153  (
155  ) = delete;
156 
157  //- Copy constructor setting internal field reference
159  (
162  );
163 
164  //- Construct and return a clone setting internal field reference
166  (
168  ) const
169  {
171  (
173  (
174  *this,
175  iF
176  )
177  );
178  }
179 
180 
181  // Member Functions
182 
183  // Mapping functions
184 
185  //- Map the given fvPatchField onto this fvPatchField
186  virtual void map(const fvPatchScalarField&, const fieldMapper&);
187 
188  //- Reset the fvPatchField to the given fvPatchField
189  // Used for mesh to mesh mapping
190  virtual void reset(const fvPatchScalarField&);
191 
192 
193  // Evaluation functions
194 
195  //- Update the coefficients associated with the patch field
196  virtual void updateCoeffs();
197 
198 
199  //- Write
200  virtual void write(Ostream&) const;
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 
211 #endif
212 
213 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition is applied to a patch which bounds a solid body, wholly or partially....
lumpedMassTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
TypeName("lumpedMassTemperature")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.