uniformFixedValueLagrangianFieldSource.C
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 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
33 (
34  const regIOobject& iIo,
35  const dictionary& dict
36 )
37 :
38  LagrangianFieldSource<Type>(iIo, dict),
39  Function1LagrangianFieldSource<Type>(*this),
40  uniformValue_
41  (
42  Function1<Type>::New
43  (
44  "uniformValue",
45  iIo.time().userUnits(),
46  this->internalDimensions(),
47  dict
48  )
49  )
50 {}
51 
52 
53 template<class Type>
56 (
58  const regIOobject& iIo
59 )
60 :
61  LagrangianFieldSource<Type>(field, iIo),
62  Function1LagrangianFieldSource<Type>(*this),
63  uniformValue_(field.uniformValue_, false)
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
68 
69 template<class Type>
72 {}
73 
74 
75 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
76 
77 template<class Type>
80 (
81  const LagrangianSource& source,
82  const LagrangianSubMesh& subMesh
83 ) const
84 {
85  return value(source, subMesh, uniformValue_());
86 }
87 
88 
89 template<class Type>
92 (
93  const LagrangianSource& source,
94  const LagrangianSubMesh& subMesh
95 ) const
96 {
97  return
99  (
100  this->internalField().name() + ":" + source.name() + "Coeff",
101  subMesh,
103  );
104 }
105 
106 
107 template<class Type>
110 (
111  const LagrangianInjection& injection,
112  const LagrangianSubMesh& subMesh
113 ) const
114 {
115  return value(injection, subMesh, uniformValue_());
116 }
117 
118 
119 template<class Type>
121 (
122  Ostream& os
123 ) const
124 {
126 
127  writeEntry(os, uniformValue_());
128 }
129 
130 
131 // ************************************************************************* //
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Mesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
Mix-in for source conditions that provides functions for evaluating Function1s at variable times.
Run-time selectable general function of one variable.
Definition: Function1.H:125
Base class for Lagrangian source conditions.
virtual void write(Ostream &) const
Write.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
const word & name() const
The source name.
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
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 provides a uniform fixed value.
uniformFixedValueLagrangianFieldSource(const regIOobject &, const dictionary &dict)
Construct from internal field and dictionary.
virtual tmp< LagrangianSubField< Type > > value(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
virtual tmp< LagrangianSubField< Type > > sourceValue(const LagrangianSource &, const LagrangianSubMesh &) const
Return the source value.
virtual tmp< LagrangianSubScalarField > internalCoeff(const LagrangianSource &, const LagrangianSubMesh &) const
Return the internal coefficient.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
static const zero Zero
Definition: zero.H:97
const dimensionSet dimless
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict