omega.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) 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::Function1s::omega
26 
27 Description
28  User convenience class to handle the input of time-varying rotational speed
29  in rad/s if \c omega is specified or rpm if \c rpm is specified.
30 
31 Usage
32  For specifying the rotational speed in rpm of an MRF zone:
33  \verbatim
34  MRF
35  {
36  cellZone rotor;
37 
38  origin (0 0 0);
39  axis (0 0 1);
40 
41  rpm 60;
42  }
43  \endverbatim
44  or the equivalent specified in rad/s:
45  \verbatim
46  MRF
47  {
48  cellZone rotor;
49 
50  origin (0 0 0);
51  axis (0 0 1);
52 
53  omega 6.28319;
54  }
55  \endverbatim
56  or for a tabulated ramped rotational speed of a solid body:
57  \verbatim
58  mover
59  {
60  type motionSolver;
61 
62  libs ("libfvMeshMovers.so" "libfvMotionSolvers.so");
63 
64  motionSolver solidBody;
65 
66  cellZone innerCylinder;
67 
68  solidBodyMotionFunction rotatingMotion;
69 
70  origin (0 0 0);
71  axis (0 1 0);
72 
73  rpm table
74  (
75  (0 0)
76  (0.01 6000)
77  (0.022 6000)
78  (0.03 4000)
79  (100 4000)
80  );
81  }
82  \endverbatim
83 
84 See also
85  Foam::Function1s
86 
87 SourceFiles
88  omega.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef omega_H
93 #define omega_H
94 
95 #include "Function1.H"
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 namespace Foam
100 {
101 namespace Function1s
102 {
103 
104 /*---------------------------------------------------------------------------*\
105  Class omega Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 class omega
109 {
110  // Private Data
111 
112  //- True if the input specification is rpm rather than omega
113  bool rpm_;
114 
115  //- 1 for omega, pi/30 for rpm
116  scalar omegaFactor_;
117 
118  //- The omega function
120 
121 
122 public:
123 
124  // Constructors
125 
126  //- Construct null
127  omega();
128 
129  //- Construct from dictionary
130  omega(const dictionary& dict);
131 
132  //- Copy constructor
133  omega(const omega&);
134 
135 
136  // Member Functions
137 
138  //- Update omega function from given dictionary
139  bool read(const dictionary& dict);
140 
141  //- Return value for time t
142  inline scalar value(const scalar t) const;
143 
144  //- Return the integral between times t1 and t2
145  inline scalar integral
146  (
147  const scalar t1,
148  const scalar t2
149  ) const;
150 
151  //- Write data to dictionary stream
152  void write(Ostream& os) const;
153 
154 
155  // Member Operators
156 
157  //- Disallow default bitwise assignment
158  void operator=(const omega&) = delete;
159 };
160 
161 
162 void writeEntry(Ostream& os, const omega& a);
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Function1s
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #include "omegaI.H"
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
User convenience class to handle the input of time-varying rotational speed in rad/s if omega is spec...
Definition: omega.H:108
scalar value(const scalar t) const
Return value for time t.
Definition: omegaI.H:28
scalar integral(const scalar t1, const scalar t2) const
Return the integral between times t1 and t2.
Definition: omegaI.H:35
void operator=(const omega &)=delete
Disallow default bitwise assignment.
bool read(const dictionary &dict)
Update omega function from given dictionary.
Definition: omega.C:61
void write(Ostream &os) const
Write data to dictionary stream.
Definition: omega.C:77
omega()
Construct null.
Definition: omega.C:31
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
void writeEntry(Ostream &os, const omega &a)
Definition: omega.C:85
Namespace for OpenFOAM.
dictionary dict