OpenFOAM: API Guide
v2112
The open source CFD toolbox
linearSpring.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 | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2016 OpenFOAM Foundation
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
Class
27
Foam::RBD::restraints::linearSpring
28
29
Group
30
grpRigidBodyDynamicsRestraints
31
32
Description
33
Linear spring restraint.
34
35
SourceFiles
36
linearSpring.C
37
38
\*---------------------------------------------------------------------------*/
39
40
#ifndef RBD_restraints_linearSpring_H
41
#define RBD_restraints_linearSpring_H
42
43
#include "
rigidBodyRestraint.H
"
44
45
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47
namespace
Foam
48
{
49
namespace
RBD
50
{
51
namespace
restraints
52
{
53
54
/*---------------------------------------------------------------------------*\
55
Class linearSpring Declaration
56
\*---------------------------------------------------------------------------*/
57
58
class
linearSpring
59
:
60
public
restraint
61
{
62
// Private data
63
64
//- Anchor point, where the spring is attached to an immovable
65
// object
66
point
anchor_;
67
68
//- Reference point of attachment to the solid body
69
point
refAttachmentPt_;
70
71
//- Spring stiffness coefficient [N/m]
72
scalar stiffness_;
73
74
//- Damping coefficient [Ns/m]
75
scalar damping_;
76
77
//- Rest length - length of spring when no forces are applied to it
78
scalar restLength_;
79
80
81
public
:
82
83
//- Runtime type information
84
TypeName
(
"linearSpring"
);
85
86
87
// Constructors
88
89
//- Construct from components
90
linearSpring
91
(
92
const
word
&
name
,
93
const
dictionary
&
dict
,
94
const
rigidBodyModel
& model
95
);
96
97
//- Construct and return a clone
98
virtual
autoPtr<restraint>
clone
()
const
99
{
100
return
autoPtr<restraint>
101
(
102
new
linearSpring
(*
this
)
103
);
104
}
105
106
107
//- Destructor
108
virtual
~linearSpring
();
109
110
111
// Member Functions
112
113
//- Accumulate the restraint internal joint forces into the tau field and
114
// external forces into the fx field
115
virtual
void
restrain
116
(
117
scalarField
& tau,
118
Field<spatialVector>
& fx,
119
const
rigidBodyModelState
& state
120
)
const
;
121
122
//- Update properties from given dictionary
123
virtual
bool
read
(
const
dictionary
&
dict
);
124
125
//- Write
126
virtual
void
write
(
Ostream
&)
const
;
127
};
128
129
130
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132
}
// End namespace restraints
133
}
// End namespace RBD
134
}
// End namespace Foam
135
136
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137
138
#endif
139
140
// ************************************************************************* //
Foam::Field< scalar >
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition:
Ostream.H:62
Foam::RBD::restraint
Base class for defining restraints for rigid-body dynamics.
Definition:
rigidBodyRestraint.H:69
Foam::RBD::restraint::name
const word & name() const
Return the name.
Definition:
rigidBodyRestraint.H:152
Foam::RBD::restraints::linearSpring
Linear spring restraint.
Definition:
linearSpring.H:60
Foam::RBD::restraints::linearSpring::read
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
Definition:
linearSpring.C:117
Foam::RBD::restraints::linearSpring::restrain
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Accumulate the restraint internal joint forces into the tau field and.
Definition:
linearSpring.C:77
Foam::RBD::restraints::linearSpring::clone
virtual autoPtr< restraint > clone() const
Construct and return a clone.
Definition:
linearSpring.H:97
Foam::RBD::restraints::linearSpring::TypeName
TypeName("linearSpring")
Runtime type information.
Foam::RBD::restraints::linearSpring::~linearSpring
virtual ~linearSpring()
Destructor.
Definition:
linearSpring.C:70
Foam::RBD::rigidBodyModelState
Holds the motion state of rigid-body model.
Definition:
rigidBodyModelState.H:68
Foam::RBD::rigidBodyModel
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
Definition:
rigidBodyModel.H:84
Foam::Vector< scalar >
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition:
autoPtr.H:66
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition:
dictionary.H:126
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:68
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:34
write
runTime write()
rigidBodyRestraint.H
dict
dictionary dict
Definition:
searchingEngine.H:14
TypeName
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition:
typeInfo.H:73
src
rigidBodyDynamics
restraints
linearSpring
linearSpring.H
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.