accelerationSource.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-2023 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::accelerationSource
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  accelerationSource1
35  {
36  type accelerationSource;
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  accelerationSource.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef accelerationSource_H
59 #define accelerationSource_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 accelerationSource Declaration
74 \*---------------------------------------------------------------------------*/
75 
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  void add
100  (
101  const AlphaRhoFieldType& rho,
102  fvMatrix<vector>& eqn,
103  const word& fieldName
104  ) const;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("accelerationSource");
111 
112 
113  // Constructors
114 
115  //- Construct from components
117  (
118  const word& name,
119  const word& modelType,
120  const fvMesh& mesh,
121  const dictionary& dict
122  );
123 
124 
125  //- Destructor
126  virtual ~accelerationSource()
127  {}
128 
129 
130  // Member Functions
131 
132  // Checks
133 
134  //- Return the list of fields for which the fvModel adds source term
135  // to the transport equation
136  virtual wordList addSupFields() const;
137 
138 
139  // Add explicit and implicit contributions
140 
141  //- Source term to momentum equation
142  virtual void addSup
143  (
144  fvMatrix<vector>& eqn,
145  const word& fieldName
146  ) const;
147 
148  //- Source term to compressible momentum equation
149  virtual void addSup
150  (
151  const volScalarField& rho,
152  fvMatrix<vector>& eqn,
153  const word& fieldName
154  ) const;
155 
156  //- Source term to phase momentum equation
157  virtual void addSup
158  (
159  const volScalarField& alpha,
160  const volScalarField& rho,
161  fvMatrix<vector>& eqn,
162  const word& fieldName
163  ) const;
164 
165 
166  // Mesh changes
167 
168  //- Update for mesh motion
169  virtual bool movePoints();
170 
171  //- Update topology using the given map
172  virtual void topoChange(const polyTopoChangeMap&);
173 
174  //- Update from another mesh using the given map
175  virtual void mapMesh(const polyMeshMap&);
176 
177  //- Redistribute or update using the given distribution map
178  virtual void distribute(const polyDistributionMap&);
179 
180 
181  // IO
182 
183  //- Read dictionary
184  virtual bool read(const dictionary& dict);
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace fv
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #ifdef NoRepository
197 #endif
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
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:160
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:101
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
This fvModel applies an explicit acceleration force to components of the velocity field.
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
accelerationSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
TypeName("accelerationSource")
Runtime type information.
virtual ~accelerationSource()
Destructor.
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
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