sixDoFRigidBodyMotionAxisConstraint.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) 2011-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 
28 #include "sixDoFRigidBodyMotion.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace sixDoFRigidBodyMotionConstraints
35 {
37 
39  (
41  axis,
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const word& name,
53  const dictionary& sDoFRBMCDict,
54  const sixDoFRigidBodyMotion& motion
55 )
56 :
57  sixDoFRigidBodyMotionConstraint(name, sDoFRBMCDict, motion),
58  axis_()
59 {
60  read(sDoFRBMCDict);
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
67 {}
68 
69 
70 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
71 
73 (
74  pointConstraint& pc
75 ) const
76 {}
77 
78 
80 (
81  pointConstraint& pc
82 ) const
83 {
85 }
86 
87 
89 (
90  const dictionary& sDoFRBMCDict
91 )
92 {
94 
95  sDoFRBMCCoeffs_.lookup("axis") >> axis_;
96 
97  scalar magFixedAxis(mag(axis_));
98 
99  if (magFixedAxis > VSMALL)
100  {
101  axis_ /= magFixedAxis;
102  }
103  else
104  {
106  << "axis has zero length"
107  << abort(FatalError);
108  }
109 
110  return true;
111 }
112 
113 
115 (
116  Ostream& os
117 ) const
118 {
119  os.writeKeyword("axis")
120  << axis_ << token::END_STATEMENT << nl;
121 }
122 
123 // ************************************************************************* //
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
Foam::sixDoFRigidBodyMotionConstraints::axis
Orientation constraint: may only rotate around a fixed axis.
Definition: sixDoFRigidBodyMotionAxisConstraint.H:52
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
Foam::pointConstraint
Accumulates point constraints through successive applications of the applyConstraint function.
Definition: pointConstraint.H:56
Foam::sixDoFRigidBodyMotionConstraint
Base class for defining constraints for sixDoF motions.
Definition: sixDoFRigidBodyMotionConstraint.H:65
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::sixDoFRigidBodyMotionConstraints::addToRunTimeSelectionTable
addToRunTimeSelectionTable(sixDoFRigidBodyMotionConstraint, axis, dictionary)
sixDoFRigidBodyMotion.H
Foam::sixDoFRigidBodyMotionConstraints::axis::read
virtual bool read(const dictionary &sDoFRBMCCoeff)
Update properties from given dictionary.
Definition: sixDoFRigidBodyMotionAxisConstraint.C:89
Foam::nl
static const char nl
Definition: Ostream.H:260
sixDoFRigidBodyMotionAxisConstraint.H
Foam::sixDoFRigidBodyMotionConstraints::axis::write
virtual void write(Ostream &) const
Write.
Definition: sixDoFRigidBodyMotionAxisConstraint.C:115
Foam::sixDoFRigidBodyMotionConstraints::axis::~axis
virtual ~axis()
Destructor.
Definition: sixDoFRigidBodyMotionAxisConstraint.C:66
Foam::pointConstraint::combine
void combine(const pointConstraint &)
Combine constraints.
Definition: pointConstraintI.H:77
Foam::FatalError
error FatalError
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::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::sixDoFRigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: sixDoFRigidBodyMotion.H:66
Foam::sixDoFRigidBodyMotionConstraints::axis::axis
axis(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion)
Construct from components.
Definition: sixDoFRigidBodyMotionAxisConstraint.C:51
Foam::sixDoFRigidBodyMotionConstraint::read
virtual bool read(const dictionary &sDoFRBMCDict)
Update properties from given dictionary.
Definition: sixDoFRigidBodyMotionConstraint.C:61
Foam::sixDoFRigidBodyMotionConstraints::defineTypeNameAndDebug
defineTypeNameAndDebug(axis, 0)
Foam::Ostream::writeKeyword
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
Foam::sixDoFRigidBodyMotionConstraints::axis::constrainRotation
virtual void constrainRotation(pointConstraint &) const
Apply and accumulate rotational constraints.
Definition: sixDoFRigidBodyMotionAxisConstraint.C:80
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::Tuple2< label, vector >
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::sixDoFRigidBodyMotionConstraints::axis::constrainTranslation
virtual void constrainTranslation(pointConstraint &) const
Apply and accumulate translational constraints.
Definition: sixDoFRigidBodyMotionAxisConstraint.C:73