acceleration.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) 2018-2024 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::fv::acceleration
26 
27 Description
28  This fvModel applies an explicit acceleration force to components of the
29  velocity field.
30 
31 Usage
32  Example usage:
33  \verbatim
34  acceleration1
35  {
36  type acceleration;
37 
38  select all;
39 
40  U U;
41 
42  velocity scale;
43  value (-2.572 0 0);
44  scale
45  {
46  type halfCosineRamp;
47  start 0;
48  duration 10;
49  }
50  }
51  \endverbatim
52 
53 SourceFiles
54  acceleration.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef acceleration_H
59 #define acceleration_H
60 
61 #include "fvModel.H"
62 #include "fvCellSet.H"
63 #include "Function1.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace fv
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class acceleration Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class acceleration
77 :
78  public fvModel
79 {
80  // Private Data
81 
82  //- The set of cells the fvConstraint applies to
83  fvCellSet set_;
84 
85  //- Name of the velocity field
86  word UName_;
87 
88  //- Time-varying velocity
89  autoPtr<Function1<vector>> velocity_;
90 
91 
92  // Private Member Functions
93 
94  //- Non-virtual read
95  void readCoeffs();
96 
97  //- Source term to momentum equation
98  template<class AlphaRhoFieldType>
99  inline void add
100  (
101  const AlphaRhoFieldType& rho,
102  fvMatrix<vector>& eqn
103  ) const;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("acceleration");
110 
111 
112  // Constructors
113 
114  //- Construct from components
116  (
117  const word& name,
118  const word& modelType,
119  const fvMesh& mesh,
120  const dictionary& dict
121  );
122 
123 
124  //- Destructor
125  virtual ~acceleration()
126  {}
127 
128 
129  // Member Functions
130 
131  // Checks
132 
133  //- Return the list of fields for which the fvModel adds source term
134  // to the transport equation
135  virtual wordList addSupFields() const;
136 
137 
138  // Add explicit and implicit contributions
139 
140  //- Source term to momentum equation
141  virtual void addSup
142  (
143  const volVectorField& U,
144  fvMatrix<vector>& eqn
145  ) const;
146 
147  //- Source term to compressible momentum equation
148  virtual void addSup
149  (
150  const volScalarField& rho,
151  const volVectorField& U,
152  fvMatrix<vector>& eqn
153  ) const;
154 
155  //- Source term to phase momentum equation
156  virtual void addSup
157  (
158  const volScalarField& alpha,
159  const volScalarField& rho,
160  const volVectorField& U,
161  fvMatrix<vector>& eqn
162  ) const;
163 
164 
165  // Mesh changes
166 
167  //- Update for mesh motion
168  virtual bool movePoints();
169 
170  //- Update topology using the given map
171  virtual void topoChange(const polyTopoChangeMap&);
172 
173  //- Update from another mesh using the given map
174  virtual void mapMesh(const polyMeshMap&);
175 
176  //- Redistribute or update using the given distribution map
177  virtual void distribute(const polyDistributionMap&);
178 
179 
180  // IO
181 
182  //- Read dictionary
183  virtual bool read(const dictionary& dict);
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace fv
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
Generic GeometricField class.
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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
This fvModel applies an explicit acceleration force to components of the velocity field.
Definition: acceleration.H:78
virtual bool movePoints()
Update for mesh motion.
Definition: acceleration.C:153
virtual void addSup(const volVectorField &U, fvMatrix< vector > &eqn) const
Source term to momentum equation.
Definition: acceleration.C:121
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: acceleration.C:114
acceleration(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Definition: acceleration.C:96
virtual ~acceleration()
Destructor.
Definition: acceleration.H:124
TypeName("acceleration")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: acceleration.C:160
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: acceleration.C:172
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: acceleration.C:178
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: acceleration.C:166
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict