externalForce.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) 2019 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::RBD::restraints::externalForce
28
29Group
30 grpRigidBodyDynamicsRestraints
31
32Description
33 Time-dependent external force restraint using Function1.
34
35Usage
36 Example applying a constant force to the floatingObject:
37 \verbatim
38 restraints
39 {
40 force
41 {
42 type externalForce;
43 body floatingObject;
44 location (0 0 0);
45 force (100 0 0);
46 }
47 }
48 \endverbatim
49
50SourceFiles
51 externalForce.C
52
53\*---------------------------------------------------------------------------*/
54
55#ifndef RBD_restraints_externalForce_H
56#define RBD_restraints_externalForce_H
57
58#include "rigidBodyRestraint.H"
59#include "Function1.H"
60
61// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62
63namespace Foam
64{
65namespace RBD
66{
67namespace restraints
68{
69
70/*---------------------------------------------------------------------------*\
71 Class externalForce Declaration
72\*---------------------------------------------------------------------------*/
74class externalForce
75:
76 public restraint
77{
78 // Private data
79
80 //- External force (N)
81 autoPtr<Function1<vector>> externalForce_;
82
83 //- Point of application of the force
84 vector location_;
85
86
87public:
88
89 //- Runtime type information
90 TypeName("externalForce");
91
92
93 // Constructors
94
95 //- Construct from components
97 (
98 const word& name,
99 const dictionary& dict,
100 const rigidBodyModel& model
101 );
102
103 //- Construct and return a clone
104 virtual autoPtr<restraint> clone() const
105 {
106 return autoPtr<restraint>
107 (
108 new externalForce(*this)
109 );
110 }
111
112
113 //- Destructor
114 virtual ~externalForce();
115
116
117 // Member Functions
118
119 //- Accumulate the retraint internal joint forces into the tau field and
120 // external forces into the fx field
121 virtual void restrain
122 (
123 scalarField& tau,
125 const rigidBodyModelState& state
126 ) const;
127
128 //- Update properties from given dictionary
129 virtual bool read(const dictionary& dict);
130
131 //- Write
132 virtual void write(Ostream&) const;
133};
134
135
136// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137
138} // End namespace restraints
139} // End namespace RBD
140} // End namespace Foam
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144#endif
145
146// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Base class for defining restraints for rigid-body dynamics.
const word & name() const
Return the name.
Time-dependent external force restraint using Function1.
Definition: externalForce.H:76
TypeName("externalForce")
Runtime type information.
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Accumulate the retraint internal joint forces into the tau field and.
Definition: externalForce.C:81
virtual autoPtr< restraint > clone() const
Construct and return a clone.
virtual ~externalForce()
Destructor.
Definition: externalForce.C:74
Holds the motion state of rigid-body model.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73