thermalBaffle1DFvPatchScalarField.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) 2011-2022 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::compressible::thermalBaffle1DFvPatchScalarField
26 
27 Description
28  This BC solves a steady 1D thermal baffle.
29 
30  The solid properties are specify as dictionary. Optionally radiative heat
31  flux (qr) can be incorporated into the balance. Some under-relaxation might
32  be needed on qr. Baffle and solid properties need to be specified on the
33  master side of the baffle.
34 
35 Usage
36  Example of the boundary condition specification using constant
37  solid thermo :
38 
39  \verbatim
40  <masterPatchName>
41  {
42  type compressible::thermalBaffle1D<eConstSolidThermoPhysics>;
43 
44  samplePatch <slavePatchName>;
45 
46  thickness uniform 0.005; // Thickness [m]
47  qs uniform 100; // Source heat flux [W/m^2]
48 
49  qr none;
50  qrRelaxation 1;
51 
52  // Solid thermo
53  specie
54  {
55  molWeight 20;
56  }
57  transport
58  {
59  kappa 1;
60  }
61  thermodynamics
62  {
63  Hf 0;
64  Cv 10;
65  }
66  equationOfState
67  {
68  rho 10;
69  }
70 
71  value uniform 300;
72  }
73 
74  <slavePatchName>
75  {
76  type compressible::thermalBaffle1D<eConstSolidThermoPhysics>;
77 
78  samplePatch <masterPatchName>;
79 
80  qr none;
81  relaxation 1;
82 
83  value uniform 300;
84  }
85  \endverbatim
86 
87 SourceFiles
88  thermalBaffle1DFvPatchScalarField.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef thermalBaffle1DFvPatchScalarField_H
93 #define thermalBaffle1DFvPatchScalarField_H
94 
95 #include "mixedFvPatchFields.H"
96 #include "autoPtr.H"
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 namespace Foam
101 {
102 namespace compressible
103 {
104 
105 /*---------------------------------------------------------------------------*\
106  Class thermalBaffle1DFvPatchScalarField Declaration
107 \*---------------------------------------------------------------------------*/
108 
109 template<class solidType>
111 :
112  public mixedFvPatchScalarField
113 {
114  // Private Data
115 
116  //- Name of the temperature field
117  word TName_;
118 
119  //- Baffle is activated
120  bool baffleActivated_;
121 
122  //- Baffle thickness [m]
123  mutable scalarField thickness_;
124 
125  //- Source heat flux [W/m^2]
126  mutable scalarField qs_;
127 
128  //- Solid dictionary
129  dictionary solidDict_;
130 
131  //- Solid thermo
132  mutable autoPtr<solidType> solidPtr_;
133 
134  //- Cache qr for relaxation
135  scalarField qrPrevious_;
136 
137  //- Relaxation for qr
138  scalar qrRelaxation_;
139 
140  //- Name of the radiative heat flux in local region
141  const word qrName_;
142 
143 
144  // Private members
145 
146  //- Return const solid thermo
147  const solidType& solid() const;
148 
149  //- Return source heat flux from master
150  tmp<scalarField> qs() const;
151 
152  //- Return thickness from master
153  tmp<scalarField> baffleThickness() const;
154 
155  //- Is this patch the owner?
156  bool owner() const;
157 
158  //- Access the neighbour field
159  const thermalBaffle1DFvPatchScalarField& nbrField() const;
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("compressible::thermalBaffle1D");
166 
167 
168  // Constructors
169 
170  //- Construct from patch and internal field
172  (
173  const fvPatch&,
175  );
176 
177  //- Construct from patch, internal field and dictionary
179  (
180  const fvPatch&,
182  const dictionary&
183  );
184 
185  //- Construct by mapping given
186  // thermalBaffle1DFvPatchScalarField onto a new patch
188  (
190  const fvPatch&,
192  const fvPatchFieldMapper&
193  );
194 
195  //- Disallow copy without setting internal field reference
197  (
199  ) = delete;
200 
201  //- Copy constructor setting internal field reference
203  (
206  );
207 
208  //- Construct and return a clone setting internal field reference
210  (
212  ) const
213  {
215  (
216  new thermalBaffle1DFvPatchScalarField(*this, iF)
217  );
218  }
219 
220 
221  // Member Functions
222 
223  // Mapping functions
224 
225  //- Map (and resize as needed) from self given a mapping object
226  // Used to update fields following mesh topology change
227  virtual void autoMap(const fvPatchFieldMapper&);
228 
229  //- Reverse map the given fvPatchField onto this fvPatchField
230  // Used to reconstruct fields
231  virtual void rmap(const fvPatchScalarField&, const labelList&);
232 
233  //- Reset the fvPatchField to the given fvPatchField
234  // Used for mesh to mesh mapping
235  virtual void reset(const fvPatchScalarField&);
236 
237 
238  //- Update the coefficients associated with the patch field
239  virtual void updateCoeffs();
240 
241  //- Write
242  virtual void write(Ostream&) const;
243 };
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace compressible
249 } // End namespace Foam
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #ifdef NoRepository
255 #endif
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 #endif
260 
261 // ************************************************************************* //
thermalBaffle1DFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
TypeName("compressible::thermalBaffle1D")
Runtime type information.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.