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-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::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"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class totalPressureVelocityLagrangianVectorFieldSource Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class totalPressureVelocityLagrangianVectorFieldSource
76 :
77  public LagrangianVectorFieldSource,
78  private cloudLagrangianFieldSource,
79  private Function1LagrangianFieldSource,
80  private totalPressureVelocityMagnitudeLagrangianScalarFieldSource
81 {
82 private:
83 
84  // Private Data
85 
86  //- Direction
87  const autoPtr<Function1<vector>> direction_;
88 
89 
90  // Private Member Functions
91 
92  //- Use the base class' value method
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("totalPressureVelocity");
100 
101 
102  // Constructors
103 
104  //- Construct from internal field and dictionary
106  (
107  const regIOobject&,
108  const dictionary& dict
109  );
110 
111  //- Copy constructor setting the internal field reference
113  (
115  const regIOobject&
116  );
117 
118  //- Construct and return a clone setting the internal field reference
120  (
121  const regIOobject& iIo
122  ) const
123  {
125  (
127  );
128  }
129 
130 
131  //- Destructor
133 
134 
135  // Member Functions
136 
137  //- Use the base class' value method
138  using LagrangianVectorFieldSource::value;
139 
140  //- Return the value for an instantaneous injection
142  (
143  const LagrangianInjection&,
144  const LagrangianSubMesh&
145  ) const;
146 
147  //- Write
148  virtual void write(Ostream&) const;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
tmp< LagrangianSubField< Type > > value(const LagrangianSubMesh &subMesh, const Function1< Type > &function) const
Return the source value.
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.
Namespace for OpenFOAM.
dictionary dict