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-2023 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  neighbourPatch <slavePatchName>;
45 
46  thickness uniform 0.005; // Thickness [m]
47  qs uniform 100; // Source 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  neighbourPatch <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 
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 mixedFvPatchScalarField
113 {
114  // Private Data
115 
116  //- Name of the temperature field
117  word TName_;
118 
119  //- Baffle is activated
120  bool baffleActivated_;
121 
122  //- Baffle thickness [m]
123  mutable scalarField thickness_;
124 
125  //- Source heat flux [W/m^2]
126  mutable scalarField qs_;
127 
128  //- Solid dictionary
129  dictionary solidDict_;
130 
131  //- Solid thermo
132  mutable autoPtr<solidType> solidPtr_;
133 
134  //- Cache qr for relaxation
135  scalarField qrPrevious_;
136 
137  //- Relaxation for qr
138  scalar qrRelaxation_;
139 
140  //- Name of the radiative heat flux in local region
141  const word qrName_;
142 
143 
144  // Private members
145 
146  //- Return const solid thermo
147  const solidType& solid() const;
148 
149  //- Return source heat flux from master
150  tmp<scalarField> qs() const;
151 
152  //- Return thickness from master
153  tmp<scalarField> baffleThickness() const;
154 
155  //- Is this patch the owner?
156  bool owner() const;
157 
158  //- Access the neighbour field
159  const thermalBaffle1DFvPatchScalarField& nbrField() const;
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("compressible::thermalBaffle1D");
166 
167 
168  // Constructors
169 
170  //- Construct from patch, internal field and dictionary
172  (
173  const fvPatch&,
175  const dictionary&
176  );
177 
178  //- Construct by mapping given thermalBaffle1DFvPatchScalarField
179  // onto a new patch
181  (
183  const fvPatch&,
185  const fieldMapper&
186  );
187 
188  //- Disallow copy without setting internal field reference
190  (
192  ) = delete;
193 
194  //- Copy constructor setting internal field reference
196  (
199  );
200 
201  //- Construct and return a clone setting internal field reference
203  (
205  ) const
206  {
208  (
209  new thermalBaffle1DFvPatchScalarField(*this, iF)
210  );
211  }
212 
213 
214  // Member Functions
215 
216  // Mapping functions
217 
218  //- Map the given fvPatchField onto this fvPatchField
219  virtual void map(const fvPatchScalarField&, const fieldMapper&);
220 
221  //- Reset the fvPatchField to the given fvPatchField
222  // Used for mesh to mesh mapping
223  virtual void reset(const fvPatchScalarField&);
224 
225 
226  //- Update the coefficients associated with the patch field
227  virtual void updateCoeffs();
228 
229  //- Write
230  virtual void write(Ostream&) const;
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace compressible
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #ifdef NoRepository
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
TypeName("compressible::thermalBaffle1D")
Runtime type information.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
thermalBaffle1DFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.