Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenFOAM-plus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Development
OpenFOAM-plus
Commits
736c47d4
Commit
736c47d4
authored
9 years ago
by
Henry Weller
Browse files
Options
Downloads
Patches
Plain Diff
applications/test/rigidBodyDynamics/pendulum: Add a test for merging bodies
parent
94e9b05e
No related branches found
No related tags found
1 merge request
!33
Merge foundation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/test/rigidBodyDynamics/pendulum/pendulum.C
+30
-7
30 additions, 7 deletions
applications/test/rigidBodyDynamics/pendulum/pendulum.C
with
30 additions
and
7 deletions
applications/test/rigidBodyDynamics/pendulum/pendulum.C
+
30
−
7
View file @
736c47d4
...
...
@@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/
#include
"rigidBodyModel.H"
#include
"masslessBody.H"
#include
"joints.H"
using
namespace
Foam
;
...
...
@@ -40,18 +41,40 @@ using namespace RBD;
int
main
(
int
argc
,
char
*
argv
[])
{
bool
testMerge
=
false
;
// Create a model for the pendulum
rigidBodyModel
pendulum
;
// Join a weight to the origin with a centre of mass -1m below the origin
// by a hinge which rotates about the z-axis
pendulum
.
join
(
0
,
Xt
(
vector
(
0
,
0
,
0
)),
joint
::
New
(
new
joints
::
Rz
(
pendulum
)),
rigidBody
::
New
(
"hinge"
,
1
,
vector
(
0
,
-
1
,
0
),
0
.
02
*
I
)
);
if
(
testMerge
)
{
label
hingeID
=
pendulum
.
join
(
0
,
Xt
(
Zero
),
joint
::
New
(
new
joints
::
Rz
(
pendulum
)),
autoPtr
<
rigidBody
>
(
new
masslessBody
(
"hinge"
))
);
pendulum
.
merge
(
hingeID
,
Xt
(
vector
(
0
,
-
1
,
0
)),
rigidBody
::
New
(
"weight"
,
1
,
Zero
,
0
.
02
*
I
)
);
}
else
{
pendulum
.
join
(
0
,
Xt
(
Zero
),
joint
::
New
(
new
joints
::
Rz
(
pendulum
)),
rigidBody
::
New
(
"pendulum"
,
1
,
vector
(
0
,
-
1
,
0
),
0
.
02
*
I
)
);
}
// Create the joint-space state fields
scalarField
q
(
pendulum
.
nDoF
(),
Zero
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment