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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::compressible::thermalBaffle1DFvPatchScalarField
28 
29 Group
30  grpThermoBoundaryConditions
31 
32 Description
33  This BC solves a steady 1D thermal baffle.
34 
35  The solid properties are specify as dictionary. Optionally radiative heat
36  flux (qr) can be incorporated into the balance. Some under-relaxation might
37  be needed on qr. Baffle and solid properties need to be specified on the
38  master side of the baffle.
39 
40 Usage
41  Example of the boundary condition specification using constant
42  solid thermo :
43 
44  \verbatim
45  <masterPatchName>
46  {
47  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
48  samplePatch <slavePatchName>;
49 
50  thickness uniform 0.005; // thickness [m]
51  qs uniform 100; // heat flux [W/m2]
52 
53  qr none;
54  relaxation 1;
55 
56  // Solid thermo
57  specie
58  {
59  molWeight 20;
60  }
61  transport
62  {
63  kappa 1;
64  }
65  thermodynamics
66  {
67  Hf 0;
68  Cp 10;
69  }
70  equationOfState
71  {
72  rho 10;
73  }
74 
75  value uniform 300;
76  }
77 
78  <slavePatchName>
79  {
80  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
81  samplePatch <masterPatchName>;
82 
83  qr none;
84  relaxation 1;
85  }
86  \endverbatim
87 
88 SourceFiles
89  thermalBaffle1DFvPatchScalarField.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef thermalBaffle1DFvPatchScalarField_H
94 #define thermalBaffle1DFvPatchScalarField_H
95 
96 #include "mixedFvPatchFields.H"
97 #include "autoPtr.H"
98 #include "mappedPatchBase.H"
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 namespace Foam
103 {
104 namespace compressible
105 {
106 
107 /*---------------------------------------------------------------------------*\
108  Class thermalBaffle1DFvPatchScalarField Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 template<class solidType>
113 :
114  public mappedPatchBase,
115  public mixedFvPatchScalarField
116 {
117  // Private data
118 
119  //- Name of the temperature field
120  word TName_;
121 
122  //- Baffle is activated
123  bool baffleActivated_;
124 
125  //- Baffle thickness [m]
126  mutable scalarField thickness_;
127 
128  //- Superficial heat source [W/m2]
129  mutable scalarField qs_;
130 
131  //- Solid dictionary
132  dictionary solidDict_;
133 
134  //- Solid thermo
135  mutable autoPtr<solidType> solidPtr_;
136 
137  //- Cache qr for relaxation
138  scalarField qrPrevious_;
139 
140  //- Relaxation for qr
141  scalar qrRelaxation_;
142 
143  //- Name of the radiative heat flux in local region
144  const word qrName_;
145 
146 
147  // Private members
148 
149  //- Return const solid thermo
150  const solidType& solid() const;
151 
152  //- Return qs from master
153  tmp<scalarField> qs() const;
154 
155  //- Return thickness from master
156  tmp<scalarField> baffleThickness() const;
157 
158  //- Is Owner
159  bool owner() 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  //- Construct as copy
197  (
199  );
200 
201  //- Construct and return a clone
202  virtual tmp<fvPatchScalarField> clone() const
203  {
205  (
207  );
208  }
209 
210  //- Construct as copy setting internal field reference
212  (
215  );
216 
217  //- Construct and return a clone setting internal field reference
219  (
221  ) const
222  {
224  (
225  new thermalBaffle1DFvPatchScalarField(*this, iF)
226  );
227  }
228 
229 
230  // Member functions
231 
232  // Mapping functions
233 
234  //- Map (and resize as needed) from self given a mapping object
235  virtual void autoMap
236  (
237  const fvPatchFieldMapper&
238  );
239 
240  //- Reverse map the given fvPatchField onto this fvPatchField
241  virtual void rmap
242  (
243  const fvPatchScalarField&,
244  const labelList&
245  );
246 
247 
248  //- Update the coefficients associated with the patch field
249  virtual void updateCoeffs();
250 
251  //- Write
252  virtual void write(Ostream&) const;
253 };
254 
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 } // End namespace compressible
259 } // End namespace Foam
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #ifdef NoRepository
265 #endif
266 
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 
269 #endif
270 
271 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::compressible::thermalBaffle1DFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: thermalBaffle1DFvPatchScalarField.C:430
Foam::compressible::thermalBaffle1DFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: thermalBaffle1DFvPatchScalarField.C:337
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::compressible::thermalBaffle1DFvPatchScalarField::TypeName
TypeName("compressible::thermalBaffle1D")
Runtime type information.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::compressible::thermalBaffle1DFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: thermalBaffle1DFvPatchScalarField.H:201
Foam::compressible::thermalBaffle1DFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: thermalBaffle1DFvPatchScalarField.C:300
Foam::mappedPatchBase
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
Definition: mappedPatchBase.H:112
Foam::Field< scalar >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
compressible
bool compressible
Definition: pEqn.H:2
Foam::compressible::thermalBaffle1DFvPatchScalarField
This BC solves a steady 1D thermal baffle.
Definition: thermalBaffle1DFvPatchScalarField.H:111
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
mixedFvPatchFields.H
Foam::autoPtr< solidType >
Foam::List< label >
Foam::compressible::thermalBaffle1DFvPatchScalarField::thermalBaffle1DFvPatchScalarField
thermalBaffle1DFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: thermalBaffle1DFvPatchScalarField.C:46
thermalBaffle1DFvPatchScalarField.C
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::compressible::thermalBaffle1DFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: thermalBaffle1DFvPatchScalarField.C:318
mappedPatchBase.H
autoPtr.H