sphericalAngularDamper.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) 2013-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 "sphericalAngularDamper.H"
28 #include "sixDoFRigidBodyMotion.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace sixDoFRigidBodyMotionRestraints
35 {
36  defineTypeNameAndDebug(sphericalAngularDamper, 0);
37 
39  (
40  sixDoFRigidBodyMotionRestraint,
41  sphericalAngularDamper,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
52 (
53  const word& name,
54  const dictionary& sDoFRBMRDict
55 )
56 :
57  sixDoFRigidBodyMotionRestraint(name, sDoFRBMRDict),
58  coeff_()
59 {
60  read(sDoFRBMRDict);
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
72 
74 (
75  const sixDoFRigidBodyMotion& motion,
76  vector& restraintPosition,
77  vector& restraintForce,
78  vector& restraintMoment
79 ) const
80 {
81  restraintMoment = -coeff_*motion.omega();
82  restraintForce = vector::zero;
83 
84  if (motion.report())
85  {
86  Info<< " moment " << restraintMoment
87  << endl;
88  }
89 }
90 
91 
93 (
94  const dictionary& sDoFRBMRDict
95 )
96 {
98 
99  sDoFRBMRCoeffs_.lookup("coeff") >> coeff_;
100 
101  return true;
102 }
103 
104 
106 (
107  Ostream& os
108 ) const
109 {
110  os.writeKeyword("coeff") << coeff_ << token::END_STATEMENT << nl;
111 }
112 
113 
114 // ************************************************************************* //
Foam::sixDoFRigidBodyMotionRestraint::read
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
Definition: sixDoFRigidBodyMotionRestraint.C:59
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularDamper::read
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
Definition: sphericalAngularDamper.C:93
Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularDamper::write
virtual void write(Ostream &) const
Write.
Definition: sphericalAngularDamper.C:106
Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularDamper::~sphericalAngularDamper
virtual ~sphericalAngularDamper()
Destructor.
Definition: sphericalAngularDamper.C:67
Foam::Vector< scalar >::zero
static const Vector zero
Definition: Vector.H:80
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::read
bool read(const char *, int32_t &)
Definition: int32IO.C:87
sphericalAngularDamper.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
sixDoFRigidBodyMotion.H
Foam::sixDoFRigidBodyMotionRestraints::addToRunTimeSelectionTable
addToRunTimeSelectionTable(sixDoFRigidBodyMotionRestraint, linearAxialAngularSpring, dictionary)
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::sixDoFRigidBodyMotionRestraint
Base class for defining restraints for sixDoF motions.
Definition: sixDoFRigidBodyMotionRestraint.H:64
Foam::sixDoFRigidBodyMotionRestraints::defineTypeNameAndDebug
defineTypeNameAndDebug(linearAxialAngularSpring, 0)
Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularDamper::restrain
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const
Calculate the restraint position, force and moment.
Definition: sphericalAngularDamper.C:74
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::sixDoFRigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: sixDoFRigidBodyMotion.H:66
Foam::Vector< scalar >
Foam::Ostream::writeKeyword
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularDamper::sphericalAngularDamper
sphericalAngularDamper(const word &name, const dictionary &sDoFRBMRDict)
Construct from components.
Definition: sphericalAngularDamper.C:52
Foam::sixDoFRigidBodyMotion::report
bool report() const
Return the report Switch.
Definition: sixDoFRigidBodyMotionI.H:266
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::sixDoFRigidBodyMotion::omega
vector omega() const
Return the angular velocity in the global frame.
Definition: sixDoFRigidBodyMotionI.H:260
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47