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-2025 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  cellZone heater;
39 
40  Q 1e6;
41  }
42  \endverbatim
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef heatSource_H
47 #define heatSource_H
48 
49 #include "fvModel.H"
50 #include "fvCellZone.H"
51 #include "Function1.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 namespace fv
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class heatSource Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class heatSource
65 :
66  public fvModel
67 {
68  // Private data
69 
70  //- The cellZone the model applies to
71  fvCellZone zone_;
72 
73  //- The heat source
75 
76 
77  // Private member functions
78 
79  //- Non-virtual read
80  void readCoeffs(const dictionary& dict);
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("heatSource");
87 
88 
89  // Constructors
90 
91  //- Construct from dictionary
93  (
94  const word& name,
95  const word& modelType,
96  const fvMesh& mesh,
97  const dictionary& dict
98  );
99 
100 
101  //- Destructor
102  virtual ~heatSource();
103 
104 
105  // Member Functions
106 
107  // Checks
108 
109  //- Return the list of fields for which the fvModel adds source term
110  // to the transport equation
111  virtual wordList addSupFields() const;
112 
113 
114  // Sources
115 
116  //- Source term to energy equation
117  virtual void addSup
118  (
119  const volScalarField& he,
120  fvMatrix<scalar>& eqn
121  ) const;
122 
123  //- Source term to compressible energy equation
124  virtual void addSup
125  (
126  const volScalarField& rho,
127  const volScalarField& he,
128  fvMatrix<scalar>& eqn
129  ) const;
130 
131 
132  // Mesh changes
133 
134  //- Update for mesh motion
135  virtual bool movePoints();
136 
137  //- Update topology using the given map
138  virtual void topoChange(const polyTopoChangeMap&);
139 
140  //- Update from another mesh using the given map
141  virtual void mapMesh(const polyMeshMap&);
142 
143  //- Redistribute or update using the given distribution map
144  virtual void distribute(const polyDistributionMap&);
145 
146 
147  // IO
148 
149  //- Read dictionary
150  virtual bool read(const dictionary& dict);
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace fv
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
cellZone selection or generation class with caching of zone volume
Definition: fvCellZone.H:94
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:96
Finite volume model abstract base class.
Definition: fvModel.H:60
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:69
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Model for applying a heat source. Requires either the power, Q, or the power per unit volume,...
Definition: heatSource.H:66
TypeName("heatSource")
Runtime type information.
virtual bool movePoints()
Update for mesh motion.
Definition: heatSource.C:168
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: heatSource.C:130
virtual ~heatSource()
Destructor.
Definition: heatSource.C:124
virtual void addSup(const volScalarField &he, fvMatrix< scalar > &eqn) const
Source term to energy equation.
Definition: heatSource.C:140
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: heatSource.C:175
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: heatSource.C:187
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: heatSource.C:193
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: heatSource.C:181
heatSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: heatSource.C:107
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.
thermo he()
labelList fv(nPoints)
dictionary dict