FreeFOAM The Cross-Platform CFD Toolkit
sixDoFRigidBodyMotionConstraint.H
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) 1991-2010 OpenCFD Ltd.
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 Namespace
25  Foam::sixDoFRigidBodyMotionConstraints
26 
27 Description
28  Namespace for six DoF motion constraints
29 
30 
31 Class
32  Foam::sixDoFRigidBodyMotionConstraint
33 
34 Description
35  Base class for defining constraints for sixDoF motions
36 
37 SourceFiles
38  sixDoFRigidBodyMotionConstraint.C
39  newDynamicFvMesh.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef sixDoFRigidBodyMotionConstraint_H
44 #define sixDoFRigidBodyMotionConstraint_H
45 
46 #include <OpenFOAM/Time.H>
47 #include <OpenFOAM/dictionary.H>
48 #include <OpenFOAM/autoPtr.H>
49 #include <OpenFOAM/vector.H>
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class sixDoFRigidBodyMotion;
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class sixDoFRigidBodyMotionConstraint Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67 
68 protected:
69 
70  // Protected data
71 
72  //- Constraint model specific coefficient dictionary
74 
75  //- Solution tolerance. Meaning depends on model, usually an
76  // absolute distance or angle.
77  scalar tolerance_;
78 
79  //- Relaxation factor for solution, default to one
80  scalar relaxationFactor_;
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("sixDoFRigidBodyMotionConstraint");
87 
88 
89  // Declare run-time constructor selection table
90 
92  (
93  autoPtr,
95  dictionary,
96  (const dictionary& sDoFRBMCDict),
97  (sDoFRBMCDict)
98  );
99 
100 
101  // Constructors
102 
103  //- Construct from the sDoFRBMCDict dictionary and Time
105  (
106  const dictionary& sDoFRBMCDict
107  );
108 
109  //- Construct and return a clone
111 
112 
113  // Selectors
114 
115  //- Select constructed from the sDoFRBMCDict dictionary and Time
117  (
118  const dictionary& sDoFRBMCDict
119  );
120 
121 
122  // Destructor
123 
125 
126 
127  // Member Functions
128 
129  //- Calculate the constraint position, force and moment.
130  // Global reference frame vectors. Returns boolean stating
131  // whether the constraint been converged to tolerance.
132  virtual bool constrain
133  (
134  const sixDoFRigidBodyMotion& motion,
135  const vector& existingConstraintForce,
136  const vector& existingConstraintMoment,
137  scalar deltaT,
138  vector& constraintPosition,
139  vector& constraintForceIncrement,
140  vector& constraintMomentIncrement
141  ) const = 0;
142 
143  //- Update properties from given dictionary
144  virtual bool read(const dictionary& sDoFRBMCDict);
145 
146  // Access
147 
148  // Return access to sDoFRBMCCoeffs
149  inline const dictionary& coeffDict() const
150  {
151  return sDoFRBMCCoeffs_;
152  }
153 
154  //- Return access to the tolerance
155  inline scalar tolerance() const
156  {
157  return tolerance_;
158  }
159 
160  //- Return access to the relaxationFactor
161  inline scalar relaxationFactor() const
162  {
163  return relaxationFactor_;
164  }
165 
166  //- Write
167  virtual void write(Ostream&) const;
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************ vim: set sw=4 sts=4 et: ************************ //