heatSource.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) 2021 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::fv::heatSource
26 
27 Description
28  Model for applying a heat source. Requires either the power, Q, or the
29  power per unit volume, q, to be specified.
30 
31 Usage
32  Example usage:
33  \verbatim
34  heatSource
35  {
36  type heatSource;
37 
38  selectionMode cellSet;
39  cellSet heater;
40 
41  Q 1e6;
42  }
43  \endverbatim
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef heatSource_H
48 #define heatSource_H
49 
50 #include "fvModel.H"
51 #include "fvCellSet.H"
52 #include "Function1.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 namespace fv
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class heatSource Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class heatSource
66 :
67  public fvModel
68 {
69  // Private data
70 
71  //- The set of cells the model applies to
72  fvCellSet set_;
73 
74  //- The heat source
76 
77 
78  // Private member functions
79 
80  //- Non-virtual read
81  void readCoeffs();
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("heatSource");
88 
89 
90  // Constructors
91 
92  //- Construct from dictionary
94  (
95  const word& name,
96  const word& modelType,
97  const dictionary& dict,
98  const fvMesh& mesh
99  );
100 
101 
102  //- Destructor
103  virtual ~heatSource();
104 
105 
106  // Member Functions
107 
108  // Checks
109 
110  //- Return the list of fields for which the fvModel adds source term
111  // to the transport equation
112  virtual wordList addSupFields() const;
113 
114 
115  // Sources
116 
117  //- Source term to energy equation
118  virtual void addSup
119  (
120  fvMatrix<scalar>& eqn,
121  const word& fieldName
122  ) const;
123 
124  //- Source term to compressible energy equation
125  virtual void addSup
126  (
127  const volScalarField& rho,
128  fvMatrix<scalar>& eqn,
129  const word& fieldName
130  ) const;
131 
132 
133  // IO
134 
135  //- Read dictionary
136  virtual bool read(const dictionary& dict);
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace fv
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
virtual ~heatSource()
Destructor.
Definition: heatSource.C:109
dictionary dict
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: heatSource.C:115
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: heatSource.C:153
Cell-set fvConstraint abstract base class. Provides a base set of controls regarding the location whe...
Finite volume model abstract base class.
Definition: fvModel.H:55
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
Model for applying a heat source. Requires either the power, Q, or the power per unit volume...
Definition: heatSource.H:64
virtual void addSup(fvMatrix< scalar > &eqn, const word &fieldName) const
Source term to energy equation.
Definition: heatSource.C:125
TypeName("heatSource")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
heatSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
Definition: heatSource.C:92
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.