volumeInjection.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) 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::volumeInjection
26 
27 Description
28  Volume injection model. This injects particles instantaneously within the
29  volume of a set of cells. Particles are positioned randomly.
30 
31 Usage
32  \table
33  Property | Description | Required? | Default
34  cellZone | The name of the cell zone | yes |
35  number | The number to inject | if numberDensity is \
36  not specified |
37  numberDensity | The number to inject per unit \
38  volume | if number is not \
39  specified |
40  time | The time at which to inject | no | 0
41  \endtable
42 
43  Example specification:
44  \verbatim
45  <LagrangianModelName>
46  {
47  type volumeInjection;
48  cellZone bed;
49  numberDensity 2 [mm^-3];
50  time 0.01;
51  }
52  \endverbatim
53 
54 See also
55  Foam::generatedCellZone
56 
57 SourceFiles
58  volumeInjection.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef volumeInjection_H
63 #define volumeInjection_H
64 
65 #include "LagrangianInjection.H"
66 #include "generatedCellZone.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 namespace Lagrangian
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class volumeInjection Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class volumeInjection
81 :
82  public LagrangianInjection
83 {
84 private:
85 
86  // Private Data
87 
88  //- The cellZone into which to inject
89  mutable generatedCellZone zone_;
90 
91  //- Do we have the number (true) or the number density (false)
92  bool haveNumber_;
93 
94  //- The number to inject or the number density with which to inject
95  scalar numberOrNumberDensity_;
96 
97  //- The time at which to inject
98  scalar time_;
99 
100  //- A global random number generator
101  mutable restartableRandomGenerator globalRndGen_;
102 
103  //- A local random number generator
104  mutable restartableRandomGenerator localRndGen_;
105 
106  //- The time index
107  mutable label timeIndex_;
108 
109 
110  // Private Member Functions
111 
112  //- Non-virtual read
113  void readCoeffs(const dictionary& modelDict);
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("volumeInjection");
120 
121 
122  // Constructors
123 
124  //- Construct from components
126  (
127  const word& name,
128  const LagrangianMesh& mesh,
129  const dictionary& modelDict,
130  const dictionary& stateDict
131  );
132 
133 
134  // Member Functions
135 
136  //- Correct the LagrangianModel
137  virtual void correct();
138 
139  //- Create new elements in the Lagrangian mesh
141  (
143  const LagrangianSubMesh&
144  ) const;
145 
146 
147  // Mesh changes
148 
149  //- Update topology using the given map
150  virtual void topoChange(const polyTopoChangeMap&);
151 
152  //- Update from another mesh using the given map
153  virtual void mapMesh(const polyMeshMap&);
154 
155  //- Redistribute or update using the given distribution map
156  virtual void distribute(const polyDistributionMap&);
157 
158 
159  // IO
160 
161  //- Read dictionary
162  virtual bool read(const dictionary& modelDict);
163 
164  //- Write state
165  virtual void writeState(Ostream& os) const;
166 
167  //- Write state
168  virtual void writeProcessorState(Ostream& os) const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Lagrangian
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Class containing Lagrangian geometry and topology.
const LagrangianMesh & mesh() const
The mesh.
const word & name() const
The source name.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
virtual void correct()
Correct the LagrangianModel.
virtual void writeState(Ostream &os) const
Write state.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
LagrangianSubMesh modify(LagrangianMesh &mesh, const LagrangianSubMesh &) const
Create new elements in the Lagrangian mesh.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
volumeInjection(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void writeProcessorState(Ostream &os) const
Write state.
virtual bool read(const dictionary &modelDict)
Read dictionary.
TypeName("volumeInjection")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
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.
static dictionary stateDict(const word &name, const objectRegistry &db)
Construct and return the state dictionary for reading.
Definition: stateModel.C:137
Volume injection model. This injects particles instantaneously within the volume of a set of cells....
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59