velocityRamping.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 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::velocityRamping
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  velocityRamping
35  {
36  type velocityRamping;
37  active on;
38  selectionMode all;
39  U U;
40  velocity (-2.572 0 0);
41  ramp
42  {
43  type halfCosineRamp;
44  start 0;
45  duration 10;
46  }
47  }
48  \endverbatim
49 
50 SourceFiles
51  velocityRamping.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef velocityRamping_H
56 #define velocityRamping_H
57 
58 #include "cellSetOption.H"
59 #include "Function1.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace fv
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class velocityRamping Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class velocityRamping
73 :
74  public cellSetOption
75 {
76 private:
77 
78  // Private data
79 
80  //- Velocity at the end of the ramp
81  vector velocity_;
82 
83  //- Ramp function
85 
86 
87  // Private Member Functions
88 
89  //- Source term to momentum equation
90  template<class AlphaRhoFieldType>
91  void add
92  (
93  const AlphaRhoFieldType& rho,
94  fvMatrix<vector>& eqn,
95  const label fieldi
96  );
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("velocityRamping");
103 
104 
105  // Constructors
106 
107  //- Construct from components
109  (
110  const word& name,
111  const word& modelType,
112  const dictionary& dict,
113  const fvMesh& mesh
114  );
115 
116 
117  //- Destructor
118  virtual ~velocityRamping()
119  {}
120 
121 
122  // Member Functions
123 
124  // Add explicit and implicit contributions
125 
126  //- Source term to momentum equation
127  virtual void addSup
128  (
129  fvMatrix<vector>& eqn,
130  const label fieldi
131  );
132 
133  //- Source term to compressible momentum equation
134  virtual void addSup
135  (
136  const volScalarField& rho,
137  fvMatrix<vector>& eqn,
138  const label fieldi
139  );
140 
141  //- Source term to phase momentum equation
142  virtual void addSup
143  (
144  const volScalarField& alpha,
145  const volScalarField& rho,
146  fvMatrix<vector>& eqn,
147  const label fieldi
148  );
149 
150 
151  // IO
152 
153  //- Read dictionary
154  virtual bool read(const dictionary& dict);
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace fv
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
166  #include "velocityRampingTemplates.C"
167 #endif
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
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:137
This fvOption applies an explicit acceleration force to components of the velocity field...
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
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("velocityRamping")
Runtime type information.
virtual bool read(const dictionary &dict)
Read dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Cell-set options abtract 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
velocityRamping(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
Namespace for OpenFOAM.
virtual ~velocityRamping()
Destructor.