All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
omega1.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-2024 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  Convenience class to handle the input of time-varying rotational speed.
29  Reads an \c omega Function1 entry with default units of [rad/s]. For
30  backwards compatibility this will also alternatively read an \c rpm entry
31  with default units of [rpm].
32 
33 Usage
34  For specifying a constant rotational speed of an MRF zone:
35  \verbatim
36  MRF
37  {
38  cellZone rotor;
39 
40  origin (0 0 0);
41  axis (0 0 1);
42 
43  omega 6.28319; // <-- Basic specification in [rad/s]
44 
45  // omega 60 [rpm]; // <-- Equivalent specification with unit
46  // conversion from [rpm]
47 
48  // rpm 60; // <-- Equivalent backwards compatible
49  // specification for rpm. May be
50  // removed in future.
51  }
52  \endverbatim
53  or for a tabulated ramped rotational speed of a solid body:
54  \verbatim
55  mover
56  {
57  type motionSolver;
58 
59  libs ("libfvMotionSolvers.so");
60 
61  motionSolver solidBody;
62 
63  cellZone innerCylinder;
64 
65  solidBodyMotionFunction rotatingMotion;
66 
67  origin (0 0 0);
68  axis (0 1 0);
69 
70  omega table // <-- Basic specification in [rad/s]
71  (
72  (0 0)
73  (0.01 628.319)
74  (0.022 628.319)
75  (0.03 418.879)
76  (100 418.879)
77  );
78 
79  // omega // <-- Equivalent specification with
80  // { // unit conversion from [rpm].
81  // type table; // Note that the dictionary form
82  // units ([s] [rpm]); // is needed for the units entry.
83  // values
84  // (
85  // (0 0)
86  // (0.01 6000)
87  // (0.022 6000)
88  // (0.03 4000)
89  // (100 4000)
90  // );
91  // }
92 
93  // rpm table // <-- Equivalent backwards compatible
94  // ( // specification for rpm. May be
95  // (0 0) // removed in future.
96  // (0.01 6000)
97  // (0.022 6000)
98  // (0.03 4000)
99  // (100 4000)
100  // );
101  }
102  \endverbatim
103 
104 See also
105  Foam::Function1s
106 
107 SourceFiles
108  omega1.C
109  omega1I.H
110 
111 \*---------------------------------------------------------------------------*/
112 
113 #ifndef omega1_H
114 #define omega1_H
115 
116 #include "Function1.H"
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 namespace Foam
121 {
122 
123 class Time;
124 
125 namespace Function1s
126 {
127 
128 /*---------------------------------------------------------------------------*\
129  Class omega Declaration
130 \*---------------------------------------------------------------------------*/
131 
132 class omega
133 {
134  // Private Data
135 
136  //- Reference to the time units
137  const unitConversion& tUnits_;
138 
139  //- The omega function
140  const autoPtr<Function1<scalar>> omega_;
141 
142 
143  // Private Member Functions
144 
145  //- Read and construct the omega function
147  (
148  const Time& time,
149  const dictionary& dict
150  );
151 
152 
153 public:
154 
155  // Constructors
156 
157  //- Construct from dictionary
158  omega(const Time& time, const dictionary& dict);
159 
160  //- Copy constructor
161  omega(const omega&);
162 
163  //- Construct and return a clone
164  autoPtr<omega> clone() const
165  {
166  return autoPtr<omega>(new omega(*this));
167  }
168 
169 
170  // Member Functions
171 
172  //- Return value for time t
173  inline scalar value(const scalar t) const;
174 
175  //- Return the integral between times t1 and t2
176  inline scalar integral
177  (
178  const scalar t1,
179  const scalar t2
180  ) const;
181 
182  //- Write data to dictionary stream
183  void write(Ostream& os) const;
184 
185 
186  // Member Operators
187 
188  //- Disallow default bitwise assignment
189  void operator=(const omega&) = delete;
190 };
191 
192 
193 void writeEntry(Ostream& os, const omega& a);
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Function1s
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #include "omega1I.H"
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Convenience class to handle the input of time-varying rotational speed. Reads an omega Function1 entr...
Definition: omega1.H:132
autoPtr< omega > clone() const
Construct and return a clone.
Definition: omega1.H:163
scalar value(const scalar t) const
Return value for time t.
Definition: omega1I.H:30
scalar integral(const scalar t1, const scalar t2) const
Return the integral between times t1 and t2.
Definition: omega1I.H:37
void operator=(const omega &)=delete
Disallow default bitwise assignment.
omega(const Time &time, const dictionary &dict)
Construct from dictionary.
Definition: omega1.C:67
void write(Ostream &os) const
Write data to dictionary stream.
Definition: omega1.C:83
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
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:162
Unit conversion structure. Contains the associated dimensions and the multiplier with which to conver...
void writeEntry(Ostream &os, const omega &a)
Definition: omega1.C:97
Namespace for OpenFOAM.
dictionary dict