linearDamper.H
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) 2016-2024 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 Class
25  Foam::RBD::restraints::linearDamper
26 
27 Description
28  Linear damper restraint. Operates in the local frame of the body.
29 
30 SourceFiles
31  linearDamper.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef RBD_restraints_linearDamper_H
36 #define RBD_restraints_linearDamper_H
37 
38 #include "rigidBodyRestraint.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace RBD
45 {
46 namespace restraints
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class linearDamper Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class linearDamper
54 :
55  public restraint
56 {
57  // Private Data
58 
59  //- Damping coefficient [Ns/m]
60  scalar coeff_;
61 
62 
63 public:
64 
65  //- Runtime type information
66  TypeName("linearDamper");
67 
68 
69  // Constructors
70 
71  //- Construct from components
73  (
74  const word& name,
75  const dictionary& dict,
76  const rigidBodyModel& model
77  );
78 
79  //- Construct and return a clone
80  virtual autoPtr<restraint> clone() const
81  {
82  return autoPtr<restraint>
83  (
84  new linearDamper(*this)
85  );
86  }
87 
88 
89  //- Destructor
90  virtual ~linearDamper();
91 
92 
93  // Member Functions
94 
95  //- Accumulate the retraint internal joint forces into the tau field and
96  // external forces into the fx field
97  virtual void restrain
98  (
99  scalarField& tau,
101  const rigidBodyModelState& state
102  ) const;
103 
104  //- Update properties from given dictionary
105  virtual bool read(const dictionary& dict);
106 
107  //- Write
108  virtual void write(Ostream&) const;
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace restraints
115 } // End namespace RBD
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Base class for defining restraints for rigid-body dynamics.
const word & name() const
Return the name.
Linear damper restraint. Operates in the local frame of the body.
Definition: linearDamper.H:55
virtual void write(Ostream &) const
Write.
Definition: linearDamper.C:109
virtual ~linearDamper()
Destructor.
Definition: linearDamper.C:68
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
Definition: linearDamper.C:96
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Accumulate the retraint internal joint forces into the tau field and.
Definition: linearDamper.C:75
virtual autoPtr< restraint > clone() const
Construct and return a clone.
Definition: linearDamper.H:79
linearDamper(const word &name, const dictionary &dict, const rigidBodyModel &model)
Construct from components.
Definition: linearDamper.C:54
TypeName("linearDamper")
Runtime type information.
Holds the motion state of rigid-body model.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict