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-2020 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<hConstSolidThermoPhysics>;
43  samplePatch <slavePatchName>;
44 
45  thickness uniform 0.005; // thickness [m]
46  Qs uniform 100; // heat flux [W/m^2]
47 
48  qr none;
49  qrRelaxation 1;
50 
51  // Solid thermo
52  specie
53  {
54  molWeight 20;
55  }
56  transport
57  {
58  kappa 1;
59  }
60  thermodynamics
61  {
62  Hf 0;
63  Cp 10;
64  }
65  equationOfState
66  {
67  rho 10;
68  }
69 
70  value uniform 300;
71  }
72 
73  <slavePatchName>
74  {
75  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
76  samplePatch <masterPatchName>;
77 
78  qr none;
79  relaxation 1;
80  }
81  \endverbatim
82 
83 SourceFiles
84  thermalBaffle1DFvPatchScalarField.C
85 
86 \*---------------------------------------------------------------------------*/
87 
88 #ifndef thermalBaffle1DFvPatchScalarField_H
89 #define thermalBaffle1DFvPatchScalarField_H
90 
91 #include "mixedFvPatchFields.H"
92 #include "autoPtr.H"
93 #include "mappedPatchBase.H"
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 namespace Foam
98 {
99 namespace compressible
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class thermalBaffle1DFvPatchScalarField Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 template<class solidType>
108 :
109  public mappedPatchBase,
110  public mixedFvPatchScalarField
111 {
112  // Private Data
113 
114  //- Name of the temperature field
115  word TName_;
116 
117  //- Baffle is activated
118  bool baffleActivated_;
119 
120  //- Baffle thickness [m]
121  mutable scalarField thickness_;
122 
123  //- Superficial heat source [W/m^2]
124  mutable scalarField Qs_;
125 
126  //- Solid dictionary
127  dictionary solidDict_;
128 
129  //- Solid thermo
130  mutable autoPtr<solidType> solidPtr_;
131 
132  //- Cache qr for relaxation
133  scalarField qrPrevious_;
134 
135  //- Relaxation for qr
136  scalar qrRelaxation_;
137 
138  //- Name of the radiative heat flux in local region
139  const word qrName_;
140 
141 
142  // Private members
143 
144  //- Return const solid thermo
145  const solidType& solid() const;
146 
147  //- Return Qs from master
148  tmp<scalarField> Qs() const;
149 
150  //- Return thickness from master
151  tmp<scalarField> baffleThickness() const;
152 
153  //- Is Owner
154  bool owner() const;
155 
156 
157 public:
158 
159  //- Runtime type information
160  TypeName("compressible::thermalBaffle1D");
161 
162 
163  // Constructors
164 
165  //- Construct from patch and internal field
167  (
168  const fvPatch&,
170  );
171 
172  //- Construct from patch, internal field and dictionary
174  (
175  const fvPatch&,
177  const dictionary&
178  );
179 
180  //- Construct by mapping given
181  // thermalBaffle1DFvPatchScalarField onto a new patch
183  (
185  const fvPatch&,
187  const fvPatchFieldMapper&
188  );
189 
190  //- Copy constructor
192  (
194  );
195 
196  //- Construct and return a clone
197  virtual tmp<fvPatchScalarField> clone() const
198  {
200  (
202  );
203  }
204 
205  //- Copy constructor setting internal field reference
207  (
210  );
211 
212  //- Construct and return a clone setting internal field reference
214  (
216  ) const
217  {
219  (
220  new thermalBaffle1DFvPatchScalarField(*this, iF)
221  );
222  }
223 
224 
225  // Member Functions
226 
227  // Mapping functions
228 
229  //- Map (and resize as needed) from self given a mapping object
230  // Used to update fields following mesh topology change
231  virtual void autoMap(const fvPatchFieldMapper&);
232 
233  //- Reverse map the given fvPatchField onto this fvPatchField
234  // Used to reconstruct fields
235  virtual void rmap(const fvPatchScalarField&, const labelList&);
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:158
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:54
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.