1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original authors
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Ordinary differential equation for three degrees of freedom solid
40 \*---------------------------------------------------------------------------*/
42 #ifndef translationODE_H
43 #define translationODE_H
46 #include "IOdictionary.H"
47 #include "dimensionedTypes.H"
48 #include "dimensionedDiagTensor.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class translationODE Declaration
57 \*---------------------------------------------------------------------------*/
69 dimensionedScalar mass_;
74 //- Spring equilibrium position for translation
75 const dimensionedVector xEquilibrium_;
77 //- Linear spring coeffs
78 const dimensionedDiagTensor linSpringCoeffs_;
80 //- Linear damping coeffs
81 const dimensionedDiagTensor linDampingCoeffs_;
84 // Body position and rotation variables
86 //- Displacement relative to spring equilibrium
87 dimensionedVector Xrel_;
89 //- Velocity of mass centroid
92 //- Velocity of mass centroid at previous time-step
93 dimensionedVector Uold_;
98 //- Force driving the motion
99 dimensionedVector force_;
106 // Private Member Functions
108 //- Disallow default bitwise copy construct
109 translationODE(const translationODE&);
111 //- Disallow default bitwise assignment
112 void operator=(const translationODE&);
115 //- Set ODE coefficients from position and rotation
116 inline void setCoeffs();
119 // Variables in relative coordinate system (solved for)
121 //- Return acceleration in relative coordinate system
122 // given current values of relative displacement and velocity
125 const dimensionedVector& xR,
126 const dimensionedVector& uR
132 // //- Runtime type information
133 // TypeName("translationODE");
138 //- Construct from dictionary
139 translationODE(const IOobject& io);
144 virtual ~translationODE();
150 inline const dimensionedScalar& mass() const;
153 // Variables in relative coordinate system (solved for)
155 //- Return displacement in relative coordinate system
156 inline const dimensionedVector& Xrel() const;
159 // Displacement and rotation in the absolute coordinate system
161 //- Return position of origin in absolute coordinate system
162 inline dimensionedVector X() const;
164 //- Return velocity of origin
165 inline const dimensionedVector& U() const;
167 //- Return velocity of origin for the previous time-step
168 inline const dimensionedVector& Uold() const;
170 //- Return acceleration of origin
171 inline dimensionedVector A() const;
174 // Average motion per time-step
176 //- Return average velocity of origin
177 inline dimensionedVector Uaverage() const;
183 inline const dimensionedVector& force() const;
185 //- Return access to force
186 inline dimensionedVector& force();
191 //- Return number of equations
192 virtual label nEqns() const
197 //- Return reference to interpolation coefficients
198 virtual scalarField& coeffs()
203 //- Return reference to interpolation coefficients
204 virtual const scalarField& coeffs() const
209 //- Return derivatives
210 virtual void derivatives
213 const scalarField& y,
218 virtual void jacobian
221 const scalarField& y,
223 scalarSquareMatrix& dfdy
226 //- Update ODE after the solution, advancing by delta
227 virtual void update(const scalar delta);
230 //- WriteData member function required by regIOobject
231 bool writeData(Ostream&) const;
236 friend Ostream& operator<<(Ostream&, const translationODE&);
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 } // End namespace Foam
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 #include "translationODEI.H"
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 // ************************************************************************* //