totalPressureVelocityLagrangianVectorFieldSource.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::totalPressureVelocityLagrangianVectorFieldSource
26 
27 Description
28  This source condition provides a velocity in a given direction with a
29  magnitude calculated from the difference between a specified upstream
30  pressure and the local interpolated pressure.
31 
32 Usage
33  \table
34  Property | Description | Required? | Default
35  direction | The velocity direction | yes |
36  p0 | The upstream total pressure | yes |
37  pc | The name of the carrier pressure field | no | p
38  \endtable
39 
40  Example specification:
41  \verbatim
42  <LagrangianModelName>
43  {
44  type totalPressureVelocity;
45  direction (1 0 0);
46  p0 1 [bar];
47  }
48  \endverbatim
49 
50 See also
51  Foam::Function1s
52 
53 SourceFiles
54  totalPressureVelocityLagrangianVectorFieldSource.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef totalPressureVelocityLagrangianVectorFieldSource_H
59 #define totalPressureVelocityLagrangianVectorFieldSource_H
60 
61 #include "LagrangianFieldSources.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class totalPressureVelocityLagrangianVectorFieldSource Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 class totalPressureVelocityLagrangianVectorFieldSource
75 :
76  public LagrangianVectorFieldSource,
77  private Function1LagrangianFieldSource<vector>,
78  private CloudLagrangianFieldSource<vector>
79 {
80 private:
81 
82  // Private Data
83 
84  //- Cached dictionary. This is needed as construction of the total
85  // pressure function is delayed until the dimensions of pressure are
86  // known. This will be thrown away once total pressure has been
87  // constructed.
88  mutable autoPtr<dictionary> dict_;
89 
90  //- Direction
91  const autoPtr<Function1<vector>> direction_;
92 
93  //- Total pressure
94  mutable autoPtr<Function1<scalar>> p0_;
95 
96  //- Name of the carrier density field
97  const word rhocName_;
98 
99  //- Name of the carrier pressure field
100  const word pcName_;
101 
102 
103  // Private Member Functions
104 
105  //- Use the base class' value method
107 
108 
109 public:
110 
111  //- Runtime type information
112  TypeName("totalPressureVelocity");
113 
114 
115  // Constructors
116 
117  //- Construct from internal field and dictionary
119  (
120  const regIOobject&,
121  const dictionary& dict
122  );
123 
124  //- Copy constructor setting the internal field reference
126  (
128  const regIOobject&
129  );
130 
131  //- Construct and return a clone setting the internal field reference
133  (
134  const regIOobject& iIo
135  ) const
136  {
138  (
140  );
141  }
142 
143 
144  //- Destructor
146 
147 
148  // Member Functions
149 
150  //- Return the value for an instantaneous injection
152  (
153  const LagrangianInjection&,
154  const LagrangianSubMesh&
155  ) const;
156 
157  //- Write
158  virtual void write(Ostream&) const;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
Mix-in for source conditions that provides functions for evaluating Function1s at variable times.
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 provides a velocity in a given direction with a magnitude calculated from the d...
virtual tmp< LagrangianSubVectorField > value(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
virtual autoPtr< LagrangianVectorFieldSource > clone(const regIOobject &iIo) const
Construct and return a clone setting the internal field reference.
TypeName("totalPressureVelocity")
Runtime type information.
totalPressureVelocityLagrangianVectorFieldSource(const regIOobject &, const dictionary &dict)
Construct from internal field and dictionary.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict