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