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-2019 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 fvOption applies an explicit acceleration force to components of the
29  velocity field.
30 
31 Usage
32  Example usage:
33  \verbatim
34  accelerationSource
35  {
36  type accelerationSource;
37  active on;
38  selectionMode all;
39  U U;
40  velocity scale;
41  value (-2.572 0 0);
42  scale
43  {
44  type halfCosineRamp;
45  start 0;
46  duration 10;
47  }
48  }
49  \endverbatim
50 
51 SourceFiles
52  accelerationSource.C
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef accelerationSource_H
57 #define accelerationSource_H
58 
59 #include "cellSetOption.H"
60 #include "Function1.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 namespace fv
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class accelerationSource Declaration
71 \*---------------------------------------------------------------------------*/
72 
74 :
75  public cellSetOption
76 {
77  // Private Data
78 
79  //- Time-varying velocity
80  autoPtr<Function1<vector>> velocity_;
81 
82 
83  // Private Member Functions
84 
85  //- Source term to momentum equation
86  template<class AlphaRhoFieldType>
87  void add
88  (
89  const AlphaRhoFieldType& rho,
90  fvMatrix<vector>& eqn,
91  const label fieldi
92  );
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("accelerationSource");
99 
100 
101  // Constructors
102 
103  //- Construct from components
105  (
106  const word& name,
107  const word& modelType,
108  const dictionary& dict,
109  const fvMesh& mesh
110  );
111 
112 
113  //- Destructor
114  virtual ~accelerationSource()
115  {}
116 
117 
118  // Member Functions
119 
120  // Add explicit and implicit contributions
121 
122  //- Source term to momentum equation
123  virtual void addSup
124  (
125  fvMatrix<vector>& eqn,
126  const label fieldi
127  );
128 
129  //- Source term to compressible momentum equation
130  virtual void addSup
131  (
132  const volScalarField& rho,
133  fvMatrix<vector>& eqn,
134  const label fieldi
135  );
136 
137  //- Source term to phase momentum equation
138  virtual void addSup
139  (
140  const volScalarField& alpha,
141  const volScalarField& rho,
142  fvMatrix<vector>& eqn,
143  const label fieldi
144  );
145 
146 
147  // IO
148 
149  //- Read dictionary
150  virtual bool read(const dictionary& dict);
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace fv
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #ifdef NoRepository
163 #endif
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
virtual ~accelerationSource()
Destructor.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
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)
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
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
TypeName("accelerationSource")
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Cell-set options abstract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:69
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
virtual bool read(const dictionary &dict)
Read dictionary.
This fvOption applies an explicit acceleration force to components of the velocity field...
Namespace for OpenFOAM.