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<eConstSolidThermoPhysics>;
43 
44  samplePatch <slavePatchName>;
45 
46  thickness uniform 0.005; // thickness [m]
47  Qs uniform 100; // 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 #include "mappedPatchBase.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 namespace compressible
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class thermalBaffle1DFvPatchScalarField Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 template<class solidType>
112 :
113  public mappedPatchBase,
114  public mixedFvPatchScalarField
115 {
116  // Private Data
117 
118  //- Name of the temperature field
119  word TName_;
120 
121  //- Baffle is activated
122  bool baffleActivated_;
123 
124  //- Baffle thickness [m]
125  mutable scalarField thickness_;
126 
127  //- Superficial heat source [W/m^2]
128  mutable scalarField Qs_;
129 
130  //- Solid dictionary
131  dictionary solidDict_;
132 
133  //- Solid thermo
134  mutable autoPtr<solidType> solidPtr_;
135 
136  //- Cache qr for relaxation
137  scalarField qrPrevious_;
138 
139  //- Relaxation for qr
140  scalar qrRelaxation_;
141 
142  //- Name of the radiative heat flux in local region
143  const word qrName_;
144 
145 
146  // Private members
147 
148  //- Return const solid thermo
149  const solidType& solid() const;
150 
151  //- Return Qs from master
152  tmp<scalarField> Qs() const;
153 
154  //- Return thickness from master
155  tmp<scalarField> baffleThickness() const;
156 
157  //- Is Owner
158  bool owner() const;
159 
160 
161 public:
162 
163  //- Runtime type information
164  TypeName("compressible::thermalBaffle1D");
165 
166 
167  // Constructors
168 
169  //- Construct from patch and internal field
171  (
172  const fvPatch&,
174  );
175 
176  //- Construct from patch, internal field and dictionary
178  (
179  const fvPatch&,
181  const dictionary&
182  );
183 
184  //- Construct by mapping given
185  // thermalBaffle1DFvPatchScalarField onto a new patch
187  (
189  const fvPatch&,
191  const fvPatchFieldMapper&
192  );
193 
194  //- Disallow copy without setting internal field reference
196  (
198  ) = delete;
199 
200  //- Copy constructor setting internal field reference
202  (
205  );
206 
207  //- Construct and return a clone setting internal field reference
209  (
211  ) const
212  {
214  (
215  new thermalBaffle1DFvPatchScalarField(*this, iF)
216  );
217  }
218 
219 
220  // Member Functions
221 
222  // Mapping functions
223 
224  //- Map (and resize as needed) from self given a mapping object
225  // Used to update fields following mesh topology change
226  virtual void autoMap(const fvPatchFieldMapper&);
227 
228  //- Reverse map the given fvPatchField onto this fvPatchField
229  // Used to reconstruct fields
230  virtual void rmap(const fvPatchScalarField&, const labelList&);
231 
232 
233  //- Update the coefficients associated with the patch field
234  virtual void updateCoeffs();
235 
236  //- Write
237  virtual void write(Ostream&) const;
238 };
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 } // End namespace compressible
244 } // End namespace Foam
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #ifdef NoRepository
250 #endif
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
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:62
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...
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.