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-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::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  select 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 fvMesh& mesh,
98  const dictionary& dict
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  // Mesh changes
134 
135  //- Update for mesh motion
136  virtual bool movePoints();
137 
138  //- Update topology using the given map
139  virtual void topoChange(const polyTopoChangeMap&);
140 
141  //- Update from another mesh using the given map
142  virtual void mapMesh(const polyMeshMap&);
143 
144  //- Redistribute or update using the given distribution map
145  virtual void distribute(const polyDistributionMap&);
146 
147 
148  // IO
149 
150  //- Read dictionary
151  virtual bool read(const dictionary& dict);
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace fv
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
Model for applying a heat source. Requires either the power, Q, or the power per unit volume,...
Definition: heatSource.H:67
TypeName("heatSource")
Runtime type information.
virtual bool movePoints()
Update for mesh motion.
Definition: heatSource.C:153
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: heatSource.C:115
virtual ~heatSource()
Destructor.
Definition: heatSource.C:109
virtual void addSup(fvMatrix< scalar > &eqn, const word &fieldName) const
Source term to energy equation.
Definition: heatSource.C:125
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: heatSource.C:160
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: heatSource.C:172
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: heatSource.C:178
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: heatSource.C:166
heatSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: heatSource.C:92
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict