oscillatingLinearMotion.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::solidBodyMotionFunctions::oscillatingLinearMotion
29 
30 Description
31  SolidBodyMotionFvMesh 6DoF motion function. Oscillating displacement.
32 
33  The governing equation for the displacement is given by:
34  \f[
35  y = A*\sin(B*(t + C)) + D
36  \f]
37 
38  where:
39  \vartable
40  y | Displacement [m] (vector)
41  A | Amplitude [m] (vector)
42  B | Radial velocity [rad/s] (scalar)
43  C | Phase-shift to left [s] (scalar)
44  D | Vertical shift [m] (vector)
45  \endvartable
46 
47 Usage
48  Minimal example by using \c constant/fvOptions:
49  \verbatim
50  oscillation
51  {
52  // Mandatory entries
53  solidBodyMotionFunction oscillatingLinearMotion;
54 
55  oscillatingLinearMotionCoeffs
56  {
57  // Mandatory entries
58  amplitude <Function1<vector>>;
59  omega <Function1<scalar>>;
60 
61  // Optional entries
62  phaseShift <Function1<scalar>>;
63  verticalShift <Function1<vector>>;
64  }
65  }
66 
67  where the entries mean:
68  \table
69  Property | Description | Type | Reqd | Deflt
70  solidBodyMotionFunction | Type name: oscillatingLinearMotion <!--
71  --> | word | yes | -
72  amplitude | Amplitude | Function1<vector> | yes | -
73  omega | Radial velocity | Function1<scalar> | yes | -
74  phaseShift | Phase-shift to left | Function1<scalar> | no | -
75  verticalShift | Vertical shift | Function1<vector> | no | -
76  \endtable
77 
78 SourceFiles
79  oscillatingLinearMotion.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef Foam_solidBodyMotionFunctions_oscillatingLinearMotion_H
84 #define Foam_solidBodyMotionFunctions_oscillatingLinearMotion_H
85 
87 #include "primitiveFields.H"
88 #include "point.H"
89 #include "Function1.H"
90 #include "autoPtr.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 namespace solidBodyMotionFunctions
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class oscillatingLinearMotion Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class oscillatingLinearMotion
104 :
105  public solidBodyMotionFunction
106 {
107  // Private Data
108 
109  //- Radial velocity
110  autoPtr<Function1<scalar>> omegaPtr_;
111 
112  //- Phase shift
113  autoPtr<Function1<scalar>> phaseShiftPtr_;
114 
115  //- Amplitude
116  autoPtr<Function1<vector>> amplitudePtr_;
117 
118  //- Vertical shift
119  autoPtr<Function1<vector>> verticalShiftPtr_;
120 
121 
122  // Private Member Functions
123 
124  //- No copy construct
125  oscillatingLinearMotion(const oscillatingLinearMotion&) = delete;
126 
127  //- No copy assignment
128  void operator=(const oscillatingLinearMotion&) = delete;
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("oscillatingLinearMotion");
135 
136 
137  // Constructors
138 
139  //- Construct from components
140  oscillatingLinearMotion
141  (
142  const dictionary& SBMFCoeffs,
143  const Time& runTime
144  );
145 
146  //- Construct and return a clone
147  virtual autoPtr<solidBodyMotionFunction> clone() const
148  {
149  return autoPtr<solidBodyMotionFunction>
150  (
151  new oscillatingLinearMotion
152  (
153  SBMFCoeffs_,
154  time_
155  )
156  );
157  }
158 
159 
160  //- Destructor
161  virtual ~oscillatingLinearMotion() = default;
162 
163 
164  // Member Functions
165 
166  //- Return the solid-body motion transformation septernion
167  virtual septernion transformation() const;
168 
169  //- Update properties from given dictionary
170  virtual bool read(const dictionary& SBMFCoeffs);
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace solidBodyMotionFunctions
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
engineTime & runTime
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:127
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:69
Specialisations of Field<T> for scalar, vector and tensor.
Namespace for OpenFOAM.