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-2015 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::thermalBaffle1DFvPatchScalarField
26 
27 Group
28  grpThermoBoundaryConditions
29 
30 Description
31 
32  This BC solves a steady 1D thermal baffle. The solid properties are
33  specify as dictionary. Optionaly radiative heat flux (Qr) can be
34  incorporated into the balance. Some under-relaxation might be needed on
35  Qr.
36  Baffle and solid properties need to be specified on the master side
37  of the baffle.
38 
39  \heading Patch usage
40  Example of the boundary condition specification using constant
41  solid thermo :
42 
43  \verbatim
44  myPatch_master
45  {
46  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
47  samplePatch myPatch_slave;
48 
49  thickness uniform 0.005; // thickness [m]
50  Qs uniform 100; // heat flux [W/m2]
51 
52  Qr none;
53  relaxation 1;
54 
55  // Solid thermo
56  specie
57  {
58  nMoles 1;
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  myPatch_slave
79  {
80  type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
81  samplePatch myPatch_master_master;
82 
83  Qr none;
84  relaxation 1;
85  }
86  \endverbatim
87 
88 
89 
90 SourceFiles
91  thermalBaffle1DFvPatchScalarField.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef thermalBaffle1DFvPatchScalarField_H
96 #define thermalBaffle1DFvPatchScalarField_H
97 
98 #include "mixedFvPatchFields.H"
99 #include "autoPtr.H"
100 #include "mappedPatchBase.H"
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 namespace Foam
105 {
106 namespace compressible
107 {
108 
109 /*---------------------------------------------------------------------------*\
110  Class thermalBaffle1DFvPatchScalarField Declaration
111 \*---------------------------------------------------------------------------*/
112 
113 template<class solidType>
115 :
116  public mappedPatchBase,
117  public mixedFvPatchScalarField
118 {
119  // Private data
120 
121  //- Name of the temperature field
122  word TName_;
123 
124  //- Baffle is activated
125  bool baffleActivated_;
126 
127  //- Baffle thickness [m]
128  mutable scalarField thickness_;
129 
130  //- Superficial heat source [W/m2]
131  mutable scalarField Qs_;
132 
133  //- Solid dictionary
134  dictionary solidDict_;
135 
136  //- Solid thermo
137  mutable autoPtr<solidType> solidPtr_;
138 
139  //- Cache Qr for relaxation
140  scalarField QrPrevious_;
141 
142  //- Relaxation for Qr
143  scalar QrRelaxation_;
144 
145  //- Name of the radiative heat flux in local region
146  const word QrName_;
147 
148 
149  // Private members
150 
151  //- Return const solid thermo
152  const solidType& solid() const;
153 
154  //- Return Qs from master
155  tmp<scalarField> Qs() const;
156 
157  //- Return thickness from master
158  tmp<scalarField> baffleThickness() const;
159 
160  //- Is Owner
161  bool owner() const;
162 
163 
164 public:
165 
166  //- Runtime type information
167  TypeName("compressible::thermalBaffle1D");
168 
169 
170  // Constructors
171 
172  //- Construct from patch and internal field
174  (
175  const fvPatch&,
177  );
178 
179  //- Construct from patch, internal field and dictionary
181  (
182  const fvPatch&,
184  const dictionary&
185  );
186 
187  //- Construct by mapping given
188  // thermalBaffle1DFvPatchScalarField onto a new patch
190  (
192  const fvPatch&,
194  const fvPatchFieldMapper&
195  );
196 
197  //- Construct as copy
199  (
201  );
202 
203  //- Construct and return a clone
204  virtual tmp<fvPatchScalarField> clone() const
205  {
207  (
209  );
210  }
211 
212  //- Construct as copy setting internal field reference
214  (
217  );
218 
219  //- Construct and return a clone setting internal field reference
221  (
223  ) const
224  {
226  (
227  new thermalBaffle1DFvPatchScalarField(*this, iF)
228  );
229  }
230 
231 
232  // Member functions
233 
234  // Mapping functions
235 
236  //- Map (and resize as needed) from self given a mapping object
237  virtual void autoMap
238  (
239  const fvPatchFieldMapper&
240  );
241 
242  //- Reverse map the given fvPatchField onto this fvPatchField
243  virtual void rmap
244  (
245  const fvPatchScalarField&,
246  const labelList&
247  );
248 
249 
250  //- Update the coefficients associated with the patch field
251  virtual void updateCoeffs();
252 
253  //- Write
254  virtual void write(Ostream&) const;
255 };
256 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 } // End namespace compressible
261 } // End namespace Foam
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #ifdef NoRepository
267 #endif
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #endif
272 
273 // ************************************************************************* //
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
TypeName("compressible::thermalBaffle1D")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
thermalBaffle1DFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
bool compressible
Definition: pEqn.H:40
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A class for managing temporary objects.
Definition: PtrList.H:118