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 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 
53 See also
54  Foam::distributions
55 
56 SourceFiles
57  distributionLagrangianScalarFieldSource.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef distributionLagrangianScalarFieldSource_H
62 #define distributionLagrangianScalarFieldSource_H
63 
64 #include "LagrangianFieldSources.H"
65 #include "distribution.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class distributionLagrangianScalarFieldSource Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class distributionLagrangianScalarFieldSource
77 :
78  public LagrangianScalarFieldSource
79 {
80 private:
81 
82  // Private Data
83 
84  //- The distribution
85  const autoPtr<distribution> distribution_;
86 
87  //- The time index
88  mutable label timeIndex_;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("distribution");
95 
96 
97  // Constructors
98 
99  //- Construct from internal field and dictionary
100  distributionLagrangianScalarFieldSource
101  (
102  const regIOobject&,
103  const dictionary& dict
104  );
105 
106  //- Copy constructor setting the internal field reference
107  distributionLagrangianScalarFieldSource
108  (
109  const distributionLagrangianScalarFieldSource&,
110  const regIOobject&
111  );
112 
113  //- Construct and return a clone setting the internal field reference
114  virtual autoPtr<LagrangianScalarFieldSource> clone
115  (
116  const regIOobject& iIo
117  ) const
118  {
119  return autoPtr<LagrangianScalarFieldSource>
120  (
121  new distributionLagrangianScalarFieldSource(*this, iIo)
122  );
123  }
124 
125 
126  //- Destructor
127  virtual ~distributionLagrangianScalarFieldSource();
128 
129 
130  // Member Functions
131 
132  //- Return the value for an instantaneous injection
133  virtual tmp<LagrangianSubScalarField> value
134  (
135  const LagrangianInjection&,
136  const LagrangianSubMesh&
137  ) const;
138 
139  //- Write
140  virtual void write(Ostream&) const;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
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
T clone(const T &t)
Definition: List.H:55
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:74