Newmark.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2015 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  + sqr(deltaT)*beta_*a() + sqr(deltaT)*(0.5 - beta_)*a0()
100  )
101  );
102 
103  // Correct orientation
104  vector piDeltaT =
105  rConstraints()
106  & (
107  deltaT*pi0()
108  + sqr(deltaT)*beta_*tau() + sqr(deltaT)*(0.5 - beta_)*tau0()
109  );
110  Tuple2<tensor, vector> Qpi = rotate(Q0(), piDeltaT, 1);
111  Q() = Qpi.first();
112 }
113 
114 
115 // ************************************************************************* //
Foam::sixDoFSolver
Definition: sixDoFSolver.H:49
Foam::sixDoFSolvers::Newmark::~Newmark
virtual ~Newmark()
Destructor.
Definition: Newmark.C:64
Foam::Tuple2::first
const Type1 & first() const
Return first.
Definition: Tuple2.H:94
Newmark.H
Foam::sixDoFSolvers::defineTypeNameAndDebug
defineTypeNameAndDebug(CrankNicolson, 0)
Foam::sixDoFSolvers::addToRunTimeSelectionTable
addToRunTimeSelectionTable(sixDoFSolver, CrankNicolson, dictionary)
Foam::Q
This function object calculates and outputs the second invariant of the velocity gradient tensor [1/s...
Definition: Q.H:119
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::sixDoFSolvers::Newmark::Newmark
Newmark(const dictionary &dict, sixDoFRigidBodyMotion &body)
Construct from a dictionary and the body.
Definition: Newmark.C:44
Foam::constant::atomic::a0
const dimensionedScalar a0
Bohr radius: default SI units: [m].
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::sixDoFRigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: sixDoFRigidBodyMotion.H:66
Foam::Vector< scalar >
Foam::sixDoFSolvers::Newmark::solve
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Drag coefficient.
Definition: Newmark.C:71
Foam::constant::mathematical::pi
const scalar pi(M_PI)
Foam::Tuple2
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:47