Newmark.C
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) 2015-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 \*---------------------------------------------------------------------------*/
25 
26 #include "Newmark.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace sixDoFSolvers
34 {
35  defineTypeNameAndDebug(Newmark, 0);
36  addToRunTimeSelectionTable(sixDoFSolver, Newmark, dictionary);
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const dictionary& dict,
47 )
48 :
49  sixDoFSolver(body),
50  gamma_(dict.lookupOrDefault<scalar>("gamma", 0.5)),
51  beta_
52  (
53  max
54  (
55  0.25*sqr(gamma_ + 0.5),
56  dict.lookupOrDefault<scalar>("beta", 0.25)
57  )
58  )
59 {}
60 
61 
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
63 
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 (
72  bool firstIter,
73  const vector& fGlobal,
74  const vector& tauGlobal,
75  scalar deltaT,
76  scalar deltaT0
77 )
78 {
79  // Update the linear acceleration and torque
80  updateAcceleration(fGlobal, tauGlobal);
81 
82  // Correct linear velocity
83  v() =
84  tConstraints()
85  & (v0() + aDamp()*deltaT*(gamma_*a() + (1 - gamma_)*a0()));
86 
87  // Correct angular momentum
88  pi() =
89  rConstraints()
90  & (pi0() + aDamp()*deltaT*(gamma_*tau() + (1 - gamma_)*tau0()));
91 
92  // Correct position
93  centreOfRotation() =
94  centreOfRotation0()
95  + (
96  tConstraints()
97  & (
98  deltaT*v0()
99  + aDamp()*sqr(deltaT)*(beta_*a() + (0.5 - beta_)*a0())
100  )
101  );
102 
103  // Correct orientation
104  vector piDeltaT =
105  rConstraints()
106  & (
107  deltaT*pi0()
108  + aDamp()*sqr(deltaT)*(beta_*tau() + (0.5 - beta_)*tau0())
109  );
110  Tuple2<tensor, vector> Qpi = rotate(Q0(), piDeltaT, 1);
111  Q() = Qpi.first();
112 }
113 
114 
115 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:66
const Type1 & first() const
Return first.
Definition: Tuple2.H:94
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual ~Newmark()
Destructor.
Definition: Newmark.C:64
defineTypeNameAndDebug(CrankNicolson, 0)
Macros for easy insertion into run-time selection tables.
Newmark(const dictionary &dict, sixDoFRigidBodyMotion &body)
Construct from a dictionary and the body.
Definition: Newmark.C:44
addToRunTimeSelectionTable(sixDoFSolver, CrankNicolson, dictionary)
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Drag coefficient.
Definition: Newmark.C:71
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const dimensionedScalar a0
Bohr radius: default SI units: [m].
Namespace for OpenFOAM.