massSource.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::massSource
26 
27 Description
28  This fvModel applies a mass source to the continuity equation and to all
29  field equations. It can be applied to compressible solvers, such as fluid,
30  isothermalFluid, compressibleVoF and multiphaseEuler. For incompressible
31  solvers, use the volumeSource model instead.
32 
33  This model requires a corresponding field source to be specified for all
34  solved-for fields.
35 
36 Usage
37  Example usage for a constant mass flow rate applied to a cell set:
38  \verbatim
39  massSource
40  {
41  type massSource;
42 
43  cellZone massSource;
44 
45  massFlowRate 1e-4;
46  }
47  \endverbatim
48 
49  Example usage for a pulsing flow rate applied at a point:
50  \verbatim
51  massSource
52  {
53  type massSource;
54 
55  cellZone
56  {
57  type containsPoints;
58  points ((2.75 0.5 0));
59  }
60 
61  massFlowRate
62  {
63  type scale;
64  scale squarePulse;
65  start 0.2;
66  duration 2;
67  value 1e-4;
68  }
69  }
70  \endverbatim
71 
72 SourceFiles
73  massSource.C
74 
75 See also
76  Foam::fv::volumeSource
77 
78 \*---------------------------------------------------------------------------*/
79 
80 #ifndef massSource_H
81 #define massSource_H
82 
83 #include "massSourceBase.H"
84 #include "fvCellZone.H"
85 #include "Function1.H"
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 namespace fv
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class massSource Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class massSource
99 :
100  public massSourceBase
101 {
102 private:
103 
104  // Private Data
105 
106  //- The set of cells the source applies to
107  autoPtr<fvCellZone> setPtr_;
108 
109  //- Mass flow rate
110  autoPtr<Function1<scalar>> massFlowRate_;
111 
112 
113  // Private Member Functions
114 
115  //- Non-virtual read
116  void readCoeffs(const dictionary& dict);
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("massSource");
123 
124 
125  // Constructors
126 
127  //- Construct from explicit source name and mesh
128  massSource
129  (
130  const word& name,
131  const word& modelType,
132  const fvMesh& mesh,
133  const dictionary& dict
134  );
135 
136 
137  // Member Functions
138 
139  // Access
140 
141  //- Return the cellZone that the source applies to
142  virtual const cellZone& zone() const;
143 
144  //- Return the volume of cells that the source applies to
145  virtual scalar V() const;
146 
147 
148  // Sources
149 
150  //- Return the source value
151  virtual dimensionedScalar S() const;
152 
153 
154  // Mesh changes
155 
156  //- Update for mesh motion
157  virtual bool movePoints();
158 
159  //- Update topology using the given map
160  virtual void topoChange(const polyTopoChangeMap&);
161 
162  //- Update from another mesh using the given map
163  virtual void mapMesh(const polyMeshMap&);
164 
165  //- Redistribute or update using the given distribution map
166  virtual void distribute(const polyDistributionMap&);
167 
168 
169  //- Read source dictionary
170  virtual bool read(const dictionary& dict);
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace fv
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Named list of cell indices representing a sub-set of the mesh.
Definition: cellZone.H:61
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
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
Base class for mass source models.
This fvModel applies a mass source to the continuity equation and to all field equations....
Definition: massSource.H:100
virtual bool movePoints()
Update for mesh motion.
Definition: massSource.C:104
virtual const cellZone & zone() const
Return the cellZone that the source applies to.
Definition: massSource.C:81
virtual scalar V() const
Return the volume of cells that the source applies to.
Definition: massSource.C:87
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: massSource.C:111
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: massSource.C:123
TypeName("massSource")
Runtime type information.
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: massSource.C:129
massSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: massSource.C:64
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: massSource.C:117
virtual dimensionedScalar S() const
Return the source value.
Definition: massSource.C:93
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