totalNumberLagrangianScalarFieldSource.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::totalNumberLagrangianScalarFieldSource
26 
27 Description
28  This source condition sets the values of the number field to recover a
29  specified total volume or mass. It should be used in conjunction with an
30  instantaneous injection model.
31 
32  This condition requires a uniform size to be specified. All injected
33  parcels will have the same value of this size. The size can be \c number,
34  \c surfaceArea, \c volume or \c mass. This choice relates to the desired
35  discretisation of the Lagrangian material. Broadly, the uniform size chosen
36  should be that against which the dominant effect of the Lagrangian model
37  scales.
38 
39  So, if the particles are primarily evaporating droplets of fuel, then the
40  effect of each will be primarily a function of the mass of fuel that
41  evaporates into the system. The \c uniformSize should therefore be set to
42  \c mass.
43 
44  But, if the model is purely dynamic, and the dominant effect is viscous
45  drag, then each particle will exert a force in proportion with a reference
46  area. In this case \c surfaceArea would be a better choice.
47 
48  If a distribution of sizes is injected then the choice of uniform size
49  interacts with how the distribution is to be sampled. For that reason, it
50  is important to use a diameter source condition such as \c
51  distributionDiameter which accounts for this, rather than the general \c
52  distribution condition.
53 
54 Usage
55  \table
56  Property | Description | Required? | Default
57  uniformSize | The size kept uniform across all parcels | yes |
58  volume | The total volume to inject | if mass is not specified |
59  mass | The total mass to inject | if volume is not specified |
60  \endtable
61 
62  Example specification:
63  \verbatim
64  <LagrangianModelName>
65  {
66  type totalNumber;
67  uniformSize volume; // number, surfaceArea, mass
68  mass 1 [g];
69  }
70  \endverbatim
71 
72 SourceFiles
73  totalNumberLagrangianScalarFieldSource.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef totalNumberLagrangianScalarFieldSource_H
78 #define totalNumberLagrangianScalarFieldSource_H
79 
81 #include "Function1.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class totalNumberLagrangianScalarFieldSource Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class totalNumberLagrangianScalarFieldSource
93 :
94  public uniformSizeNumberLagrangianScalarFieldSource
95 {
96 private:
97 
98  // Private Data
99 
100  //- Do we have the volume (true) or the mass (false)
101  const bool haveVolume_;
102 
103  //- The volume or mass
104  const scalar volumeOrMass_;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("totalNumber");
111 
112 
113  // Constructors
114 
115  //- Construct from internal field and dictionary
117  (
118  const regIOobject&,
119  const dictionary& dict
120  );
121 
122  //- Copy constructor setting the internal field reference
124  (
126  const regIOobject&
127  );
128 
129  //- Construct and return a clone setting the internal field reference
131  (
132  const regIOobject& iIo
133  ) const
134  {
136  (
138  );
139  }
140 
141 
142  //- Destructor
144 
145 
146  // Member Functions
147 
148  //- Return the value for an instantaneous injection
150  (
151  const LagrangianInjection&,
152  const LagrangianSubMesh&
153  ) const;
154 
155  //- Write
156  virtual void write(Ostream&) const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
A class for managing temporary objects.
Definition: tmp.H:55
This source condition sets the values of the number field to recover a specified total volume or mass...
totalNumberLagrangianScalarFieldSource(const regIOobject &, const dictionary &dict)
Construct from internal field and dictionary.
virtual tmp< LagrangianSubScalarField > value(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
TypeName("totalNumber")
Runtime type information.
virtual autoPtr< LagrangianScalarFieldSource > clone(const regIOobject &iIo) const
Construct and return a clone setting the internal field reference.
Namespace for OpenFOAM.
dictionary dict