externalHeatFluxSource.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) 2019-2020 OpenCFD Ltd.
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::fa::externalHeatFluxSource
28 
29 Group
30  grpFaOptionsSources
31 
32 Description
33  Applies a heat flux condition for a specified \c faMesh region
34  to temperature on an external wall for compressible flows
35  in one of three modes:
36 
37  - fixed power: supply \c Q
38  - fixed heat flux: supply \c q
39  - fixed heat transfer coefficient: supply \c h and \c Ta
40 
41  where
42  \vartable
43  Q | Power [W]
44  q | Heat flux [W/m^2]
45  h | Heat transfer coefficient [W/m^2/K]
46  Ta | Ambient temperature [K]
47  \endvartable
48 
49  The ambient temperature \c Ta is specified
50  as a \c Foam::Function1 of time but uniform in space.
51 
52 Usage
53  Minimal example by using \c constant/faOptions:
54  \verbatim
55  externalHeatFluxSource1
56  {
57  // Mandatory entries (unmodifiable)
58  type externalHeatFluxSource;
59 
60  // Mandatory entries (runtime modifiable)
61  mode <mode>;
62 
63  // Optional entries (runtime modifiable)
64  T <Tname>;
65  emissivity 0;
66 
67  // Conditional mandatory entries (runtime modifiable)
68 
69  // when mode=power
70  Q 1.0;
71 
72  // when mode=flux
73  q 1.0;
74 
75  // when mode=coefficient
76  h 1.0;
77  Ta <Function1>;
78 
79  // Mandatory/Optional (inherited) entries
80  ...
81  }
82  \endverbatim
83 
84  where the entries mean:
85  \table
86  Property | Description | Type | Reqd | Dflt
87  type | Type name: externalHeatFluxSource | word | yes | -
88  mode | Mode of heat flux condition | word | yes | -
89  T | Name of operand temperature field | word | no | T
90  emissivity | Surface emissivity for radiative flux to ambient <!--
91  --> | scalar | no | 0
92  Q | Fixed heat power [W] | scalar | cndtnl | -
93  q | Fixed heat flux [W/m2] | scalar | cndtnl | -
94  h | Heat transfer coefficient [W/m^2/K] | scalar | cndtnl | -
95  Ta | Ambient temperature [K] | Function1 | cndtnl | -
96  \endtable
97 
98  The inherited entries are elaborated in:
99  - \link faOption.H \endlink
100  - \link faceSetOption.H \endlink
101 
102  Options for the \c mode entry:
103  \verbatim
104  power | Use fixed power (supply Q)
105  flux | Use fixed heat flux (supply q)
106  coefficient | Use fixes heat transfer coefficient (supply h and T)
107  \endverbatim
108 
109 See also
110  - Foam::Function1
111 
112 SourceFiles
113  externalHeatFluxSource.C
114 
115 \*---------------------------------------------------------------------------*/
116 
117 #ifndef fa_externalHeatFluxSource_H
118 #define fa_externalHeatFluxSource_H
119 
120 #include "faOption.H"
121 #include "Function1.H"
122 #include "areaFields.H"
123 #include "faceSetOption.H"
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 namespace Foam
128 {
129 namespace fa
130 {
131 
132 /*---------------------------------------------------------------------------*\
133  Class externalHeatFluxSource Declaration
134 \*---------------------------------------------------------------------------*/
135 
136 class externalHeatFluxSource
137 :
138  public fa::faceSetOption
139 {
140 public:
141 
142  // Public Enumeration
143 
144  //- Options for the heat transfer condition mode
145  enum operationMode
146  {
147  fixedPower,
148  fixedHeatFlux,
150  };
151 
152  //- Names for operationMode
153  static const Enum<operationMode> operationModeNames;
154 
155 
156 private:
157 
158  // Private Data
159 
160  //- Operation mode
161  operationMode mode_;
162 
163  //- Name of temperature field
164  word TName_;
165 
166  //- Heat power [W]
167  scalar Q_;
168 
169  //- Heat flux [W/m2]
170  scalar q_;
171 
172  //- Heat transfer coefficient [W/m2K]
173  scalar h_;
174 
175  //- Ambient temperature [K]
176  autoPtr<Function1<scalar>> Ta_;
177 
178  //- Optional surface emissivity for radiative transfer to ambient
179  scalar emissivity_;
180 
181 
182 public:
183 
184  //- Runtime type information
185  TypeName("externalHeatFluxSource");
186 
187 
188  // Constructors
189 
190  //- Construct from explicit source name and mesh
192  (
193  const word& sourceName,
194  const word& modelType,
195  const dictionary& dict,
196  const fvPatch& patch
197  );
198 
199  //- No copy construct
201 
202  //- No copy assignment
203  void operator=(const externalHeatFluxSource&) = delete;
204 
205 
206  //- Destructor
207  virtual ~externalHeatFluxSource() = default;
208 
209 
210  // Member Functions
211 
212  // Evaluation
213 
214  //- Add explicit contribution to compressible momentum equation
215  virtual void addSup
216  (
217  const areaScalarField& h,
220  const label fieldi
221  );
222 
223 
224  // IO
225 
226  //- Read source dictionary
227  virtual bool read(const dictionary& dict);
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace fa
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Foam::Enum< operationMode >
Foam::faMatrix
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatricesFwd.H:43
Foam::fa::externalHeatFluxSource::operationMode
operationMode
Options for the heat transfer condition mode.
Definition: externalHeatFluxSource.H:216
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fa::externalHeatFluxSource::fixedHeatTransferCoeff
Fixed heat transfer coefficient.
Definition: externalHeatFluxSource.H:220
Foam::fa::externalHeatFluxSource::fixedHeatFlux
Fixed heat flux [W/m2].
Definition: externalHeatFluxSource.H:219
Foam::fa::option::patch
const fvPatch & patch() const noexcept
Return const access to fvPatch.
Definition: faOptionI.H:42
Function1.H
Foam::fa::externalHeatFluxSource::~externalHeatFluxSource
virtual ~externalHeatFluxSource()=default
Destructor.
Foam::fa::faceSetOption
Intermediate abstract class for handling face-set options for the derived faOptions.
Definition: faceSetOption.H:134
Foam::fa::externalHeatFluxSource::TypeName
TypeName("externalHeatFluxSource")
Runtime type information.
rho
rho
Definition: readInitialConditions.H:88
Foam::fa::externalHeatFluxSource::addSup
virtual void addSup(const areaScalarField &h, const areaScalarField &rho, faMatrix< scalar > &eqn, const label fieldi)
Add explicit contribution to compressible momentum equation.
Definition: externalHeatFluxSource.C:91
Foam::fa::externalHeatFluxSource::operator=
void operator=(const externalHeatFluxSource &)=delete
No copy assignment.
Foam::constant::universal::h
const dimensionedScalar h
Planck constant.
Definition: setRegionSolidFields.H:33
Foam::fa::externalHeatFluxSource::operationModeNames
static const Enum< operationMode > operationModeNames
Names for operationMode.
Definition: externalHeatFluxSource.H:224
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
areaFields.H
dict
dictionary dict
Definition: searchingEngine.H:14
faOption.H
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
faceSetOption.H
Foam::fa::externalHeatFluxSource::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: externalHeatFluxSource.C:173
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::fa::externalHeatFluxSource::fixedPower
Fixed heat power [W].
Definition: externalHeatFluxSource.H:218
Foam::GeometricField< scalar, faPatchField, areaMesh >
Foam::fa::externalHeatFluxSource
Applies a heat flux condition for a specified faMesh region to temperature on an external wall for co...
Definition: externalHeatFluxSource.H:207
Foam::fa::externalHeatFluxSource::externalHeatFluxSource
externalHeatFluxSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvPatch &patch)
Construct from explicit source name and mesh.
Definition: externalHeatFluxSource.C:64