distributionLagrangianScalarFieldSource.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-2026 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::distributionLagrangianScalarFieldSource
26 
27 Description
28  This source condition provides values of a property randomly sampled from a
29  given distribution.
30 
31 Usage
32  \table
33  Property | Description | Required? | Default
34  distribution | The distribution | yes |
35  \endtable
36 
37  Example specification:
38  \verbatim
39  <LagrangianModelName>
40  {
41  type distribution;
42  distribution
43  {
44  type normal;
45  Q 0;
46  min 200 [kg/m^3];
47  max 1800 [kg/m^3];
48  mu 1000 [kg/m^3];
49  sigma 400 [];
50  }
51  }
52  \endverbatim
53 
54 See also
55  Foam::distributions
56 
57 SourceFiles
58  distributionLagrangianScalarFieldSource.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef distributionLagrangianScalarFieldSource_H
63 #define distributionLagrangianScalarFieldSource_H
64 
65 #include "LagrangianFieldSources.H"
66 #include "distribution.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class distributionLagrangianScalarFieldSource Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class distributionLagrangianScalarFieldSource
78 :
79  public LagrangianScalarFieldSource
80 {
81 private:
82 
83  // Private Data
84 
85  //- The distribution
86  const autoPtr<distribution> distribution_;
87 
88  //- The time index
89  mutable label timeIndex_;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("distribution");
96 
97 
98  // Constructors
99 
100  //- Construct from internal field and dictionary
102  (
103  const regIOobject&,
105  );
106 
107  //- Copy constructor setting the internal field reference
109  (
111  const regIOobject&
112  );
113 
114  //- Construct and return a clone setting the internal field reference
116  (
117  const regIOobject& iIo
118  ) const
119  {
121  (
123  );
124  }
125 
126 
127  //- Destructor
129 
130 
131  // Member Functions
132 
133  //- Return the value for an instantaneous injection
135  (
136  const LagrangianInjection&,
137  const LagrangianSubMesh&
138  ) const;
139 
140  //- Write
141  virtual void write(Ostream&) const;
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
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
This source condition provides values of a property randomly sampled from a given distribution.
virtual tmp< LagrangianSubScalarField > value(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
TypeName("distribution")
Runtime type information.
virtual autoPtr< LagrangianScalarFieldSource > clone(const regIOobject &iIo) const
Construct and return a clone setting the internal field reference.
distributionLagrangianScalarFieldSource(const regIOobject &, const dictionary &dict)
Construct from internal field and dictionary.
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
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
dictionary dict