LagrangianFieldSource.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::LagrangianFieldSource
26 
27 Description
28  Base class for Lagrangian source conditions
29 
30 SourceFiles
31  LagrangianFieldSource.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef LagrangianFieldSource_H
36 #define LagrangianFieldSource_H
37 
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of classes
46 template<class Type>
47 class LagrangianFieldSource;
48 
49 // Forward declaration of friend functions and operators
50 template<class Type>
52 
53 /*---------------------------------------------------------------------------*\
54  Class LagrangianFieldSource Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
61 {
62  // Private Data
63 
64  //- Optional list of libraries required for this field source value
65  fileNameList libs_;
66 
67  //- Reference to the internal field
68  const LagrangianInternalDynamicField<Type>& internalField_;
69 
70  //- Reference to the non-dynamic internal field
71  const LagrangianInternalField<Type>& internalNonDynamicField_;
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("LagrangianFieldSource");
78 
79 
80  //- Debug switch to disallow the use of genericLagrangianFieldSource
82 
83 
84  // Declare run-time constructor selection tables
85 
86  //- Select given internal field
88  (
89  autoPtr,
91  null,
92  (
93  const regIOobject& iIo
94  ),
95  (iIo)
96  );
97 
98  //- Select given internal field and dictionary
100  (
101  autoPtr,
103  dictionary,
104  (
105  const regIOobject& iIo,
106  const dictionary& dict
107  ),
108  (iIo, dict)
109  );
110 
111 
112  // Constructors
113 
114  //- Construct from internal field
116 
117  //- Construct from internal field and dictionary
119 
120  //- Disallow copy without setting the internal field reference
122 
123  //- Disallow clone without setting the internal field reference
125  {
127  return autoPtr<LagrangianFieldSource<Type>>(nullptr);
128  }
129 
130  //- Construct as copy setting the internal field reference
132  (
134  const regIOobject&
135  );
136 
137  //- Construct and return a clone setting the internal field reference
139  (
140  const regIOobject&
141  ) const = 0;
142 
143 
144  // Selectors
145 
146  //- Return a pointer to a new field source
148  (
149  const word& fieldSourceType,
150  const regIOobject&
151  );
152 
153  //- Return a pointer to a new field source created from a dictionary
155  (
156  const regIOobject&,
157  const dictionary&
158  );
159 
160 
161  //- Destructor
162  virtual ~LagrangianFieldSource();
163 
164 
165  // Member Functions
166 
167  // Access
168 
169  //- Return internal dimensions reference
170  virtual const dimensionSet& internalDimensions() const;
171 
172  //- Return internal field reference
174 
175 
176  // Evaluation
177 
178  //- Return the source value
180  (
181  const LagrangianSource&,
182  const LagrangianSubMesh&
183  ) const;
184 
185  //- Return the internal coefficient
187  (
188  const LagrangianSource&,
189  const LagrangianSubMesh&
190  ) const;
191 
192  //- Return the source coefficient
194  (
195  const LagrangianSource&,
196  const LagrangianSubMesh&
197  ) const;
198 
199  //- Return the value for a continuous source
201  (
202  const LagrangianSource&,
203  const LagrangianSubMesh&
204  ) const;
205 
206  //- Return the value for an instantaneous injection
208  (
209  const LagrangianInjection&,
210  const LagrangianSubMesh&
211  ) const;
212 
213  //- Return the value without a model
215  (
216  const LagrangianSubMesh&
217  ) const;
218 
219 
220  // I-O
221 
222  //- Write
223  virtual void write(Ostream&) const;
224 
225 
226  // Member Operators
227 
228  //- Ostream operator
229  friend Ostream& operator<< <Type>
230  (
231  Ostream&,
233  );
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "LagrangianFieldSource.C"
245 #endif
246 
247 
248 #define addToLagrangianFieldSourceRunTimeSelection( \
249  TypeFieldSource, typeTypeFieldSource) \
250  addToRunTimeSelectionTable \
251  ( \
252  TypeFieldSource, \
253  typeTypeFieldSource, \
254  dictionary \
255  )
256 
257 
258 #define addNullConstructableToLagrangianFieldSourceRunTimeSelection( \
259  TypeFieldSource, typeTypeFieldSource) \
260  addToRunTimeSelectionTable \
261  ( \
262  TypeFieldSource, \
263  typeTypeFieldSource, \
264  null \
265  ); \
266  addToLagrangianFieldSourceRunTimeSelection \
267  ( \
268  TypeFieldSource, \
269  typeTypeFieldSource \
270  )
271 
272 
273 #define makeLagrangianTypeFieldSource( \
274  TypeFieldSource, typeTypeFieldSource) \
275  defineTypeNameAndDebug(typeTypeFieldSource, 0); \
276  addToLagrangianFieldSourceRunTimeSelection \
277  ( \
278  TypeFieldSource, \
279  typeTypeFieldSource \
280  )
281 
282 
283 #define makeNullConstructableLagrangianTypeFieldSource( \
284  TypeFieldSource, typeTypeFieldSource) \
285  defineTypeNameAndDebug(typeTypeFieldSource, 0); \
286  addNullConstructableToLagrangianFieldSourceRunTimeSelection \
287  ( \
288  TypeFieldSource, \
289  typeTypeFieldSource \
290  )
291 
292 
293 #define makeTemplateLagrangianTypeFieldSource(fieldType, type) \
294  defineNamedTemplateTypeNameAndDebug \
295  ( \
296  CAT4(type, Lagrangian, CAPITALIZE(fieldType), FieldSource), \
297  0 \
298  ); \
299  addToLagrangianFieldSourceRunTimeSelection \
300  ( \
301  CAT3(Lagrangian, CAPITALIZE(fieldType), FieldSource), \
302  CAT4(type, Lagrangian, CAPITALIZE(fieldType), FieldSource) \
303  );
304 
305 
306 #define makeNullConstructableTemplateLagrangianTypeFieldSource(fieldType, type)\
307  defineNamedTemplateTypeNameAndDebug \
308  ( \
309  CAT4(type, Lagrangian, CAPITALIZE(fieldType), FieldSource), \
310  0 \
311  ); \
312  addNullConstructableToLagrangianFieldSourceRunTimeSelection \
313  ( \
314  CAT3(Lagrangian, CAPITALIZE(fieldType), FieldSource), \
315  CAT4(type, Lagrangian, CAPITALIZE(fieldType), FieldSource) \
316  );
317 
318 
319 #define makeLagrangianFieldSources(type) \
320  FOR_ALL_FIELD_TYPES \
321  ( \
322  makeTemplateLagrangianTypeFieldSource, \
323  type \
324  )
325 
326 
327 #define makeNullConstructableLagrangianFieldSources(type) \
328  FOR_ALL_FIELD_TYPES \
329  ( \
330  makeNullConstructableTemplateLagrangianTypeFieldSource, \
331  type \
332  )
333 
334 
335 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
336 
337 #endif
338 
339 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Base class for Lagrangian source conditions.
Base class for Lagrangian source conditions.
virtual const dimensionSet & internalDimensions() const
Return internal dimensions reference.
virtual void write(Ostream &) const
Write.
static autoPtr< LagrangianFieldSource< Type > > New(const word &fieldSourceType, const regIOobject &)
Return a pointer to a new field source.
tmp< LagrangianSubField< Type > > value(const LagrangianSource &, const LagrangianSubMesh &) const
Return the value for a continuous source.
TypeName("LagrangianFieldSource")
Runtime type information.
static int disallowGenericLagrangianFieldSource
Debug switch to disallow the use of genericLagrangianFieldSource.
tmp< LagrangianSubField< Type > > sourceCoeff(const LagrangianSource &, const LagrangianSubMesh &) const
Return the source coefficient.
virtual tmp< LagrangianSubField< Type > > sourceValue(const LagrangianSource &, const LagrangianSubMesh &) const
Return the source value.
virtual ~LagrangianFieldSource()
Destructor.
virtual tmp< LagrangianSubScalarField > internalCoeff(const LagrangianSource &, const LagrangianSubMesh &) const
Return the internal coefficient.
autoPtr< LagrangianFieldSource< Type > > clone() const
Disallow clone without setting the internal field reference.
LagrangianFieldSource(const regIOobject &)
Construct from internal field.
const LagrangianInternalDynamicField< Type > & internalField() const
Return internal field reference.
declareRunTimeSelectionTable(autoPtr, LagrangianFieldSource, null,(const regIOobject &iIo),(iIo))
Select given internal field.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Base class for Lagrangian sources. Minimal wrapper over LagrangianModel that provides an interface to...
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
Dimension set for the base types.
Definition: dimensionSet.H:125
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
A class for handling words, derived from string.
Definition: word.H:63
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
dictionary dict