thermalBaffle1DFvPatchScalarField.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 | Copyright (C) 2011-2017 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 Group
28  grpThermoBoundaryConditions
29 
30 Description
31  This BC solves a steady 1D thermal baffle.
32 
33  The solid properties are specify as dictionary. Optionaly radiative heat
34  flux (qr) can be incorporated into the balance. Some under-relaxation might
35  be needed on qr. Baffle and solid properties need to be specified on the
36  master side of the baffle.
37 
38 Usage
39  Example of the boundary condition specification using constant
40  solid thermo :
41 
42  \verbatim
43  <masterPatchName>
44  {
45  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
46  samplePatch <slavePatchName>;
47 
48  thickness uniform 0.005; // thickness [m]
49  Qs uniform 100; // heat flux [W/m2]
50 
51  qr none;
52  qrRelaxation 1;
53 
54  // Solid thermo
55  specie
56  {
57  molWeight 20;
58  }
59  transport
60  {
61  kappa 1;
62  }
63  thermodynamics
64  {
65  Hf 0;
66  Cp 10;
67  }
68  equationOfState
69  {
70  rho 10;
71  }
72 
73  value uniform 300;
74  }
75 
76  <slavePatchName>
77  {
78  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
79  samplePatch <masterPatchName>;
80 
81  qr none;
82  relaxation 1;
83  }
84  \endverbatim
85 
86 SourceFiles
87  thermalBaffle1DFvPatchScalarField.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef thermalBaffle1DFvPatchScalarField_H
92 #define thermalBaffle1DFvPatchScalarField_H
93 
94 #include "mixedFvPatchFields.H"
95 #include "autoPtr.H"
96 #include "mappedPatchBase.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 mappedPatchBase,
113  public mixedFvPatchScalarField
114 {
115  // Private data
116 
117  //- Name of the temperature field
118  word TName_;
119 
120  //- Baffle is activated
121  bool baffleActivated_;
122 
123  //- Baffle thickness [m]
124  mutable scalarField thickness_;
125 
126  //- Superficial heat source [W/m2]
127  mutable scalarField Qs_;
128 
129  //- Solid dictionary
130  dictionary solidDict_;
131 
132  //- Solid thermo
133  mutable autoPtr<solidType> solidPtr_;
134 
135  //- Cache qr for relaxation
136  scalarField qrPrevious_;
137 
138  //- Relaxation for qr
139  scalar qrRelaxation_;
140 
141  //- Name of the radiative heat flux in local region
142  const word qrName_;
143 
144 
145  // Private members
146 
147  //- Return const solid thermo
148  const solidType& solid() const;
149 
150  //- Return Qs from master
151  tmp<scalarField> Qs() const;
152 
153  //- Return thickness from master
154  tmp<scalarField> baffleThickness() const;
155 
156  //- Is Owner
157  bool owner() const;
158 
159 
160 public:
161 
162  //- Runtime type information
163  TypeName("compressible::thermalBaffle1D");
164 
165 
166  // Constructors
167 
168  //- Construct from patch and internal field
170  (
171  const fvPatch&,
173  );
174 
175  //- Construct from patch, internal field and dictionary
177  (
178  const fvPatch&,
180  const dictionary&
181  );
182 
183  //- Construct by mapping given
184  // thermalBaffle1DFvPatchScalarField onto a new patch
186  (
188  const fvPatch&,
190  const fvPatchFieldMapper&
191  );
192 
193  //- Construct as copy
195  (
197  );
198 
199  //- Construct and return a clone
200  virtual tmp<fvPatchScalarField> clone() const
201  {
203  (
205  );
206  }
207 
208  //- Construct as copy setting internal field reference
210  (
213  );
214 
215  //- Construct and return a clone setting internal field reference
217  (
219  ) const
220  {
222  (
223  new thermalBaffle1DFvPatchScalarField(*this, iF)
224  );
225  }
226 
227 
228  // Member functions
229 
230  // Mapping functions
231 
232  //- Map (and resize as needed) from self given a mapping object
233  virtual void autoMap
234  (
235  const fvPatchFieldMapper&
236  );
237 
238  //- Reverse map the given fvPatchField onto this fvPatchField
239  virtual void rmap
240  (
241  const fvPatchScalarField&,
242  const labelList&
243  );
244 
245 
246  //- Update the coefficients associated with the patch field
247  virtual void updateCoeffs();
248 
249  //- Write
250  virtual void write(Ostream&) const;
251 };
252 
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 } // End namespace compressible
257 } // End namespace Foam
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #ifdef NoRepository
263 #endif
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #endif
268 
269 // ************************************************************************* //
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:137
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:61
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.
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
bool compressible
Definition: pEqn.H:30