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-2022 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  selectionMode 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 dictionary& dict,
121  const fvMesh& mesh
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 // ************************************************************************* //
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Cell-set fvConstraint abstract base class. Provides a base set of controls regarding the location whe...
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
Finite volume model abstract base class.
Definition: fvModel.H:57
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
virtual ~accelerationSource()
Destructor.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
accelerationSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
TypeName("accelerationSource")
Runtime type information.
virtual bool movePoints()
Update for mesh motion.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual bool read(const dictionary &dict)
Read dictionary.
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
This fvModel applies an explicit acceleration force to components of the velocity field...
Namespace for OpenFOAM.