Skip to content
Snippets Groups Projects
Commit 7d757a79 authored by Henry Weller's avatar Henry Weller
Browse files

applications/test/rigidBodyDynamics/pendulum: Cleanup

parent 292543a3
Branches
Tags
1 merge request!33Merge foundation
pendulum.C
EXE = $(FOAM_USER_APPBIN)/pendulum
EXE = $(FOAM_USER_APPBIN)/Test-pendulum
bodies
bodies0
{
pendulum
{
......@@ -15,7 +15,7 @@ bodies
}
}
bodies0
bodies
{
hinge
{
......
......@@ -81,16 +81,15 @@ int main(int argc, char *argv[])
*/
// Create the pendulum model from dictionary
rigidBodyModel pendulum1(dictionary(IFstream("pendulum")()));
rigidBodyModel pendulum = pendulum1;
rigidBodyModel pendulum(dictionary(IFstream("pendulum")()));
Info<< pendulum << endl;
// Create the joint-space state fields
scalarField q(pendulum.nDoF(), Zero);
scalarField w(pendulum.nw(), Zero);
scalarField qdot(pendulum.nDoF(), Zero);
scalarField qddot(pendulum.nDoF(), Zero);
scalarField qDot(pendulum.nDoF(), Zero);
scalarField qDdot(pendulum.nDoF(), Zero);
scalarField tau(pendulum.nDoF(), Zero);
// Set the angle of the pendulum to 0.3rad
......@@ -104,20 +103,20 @@ int main(int argc, char *argv[])
scalar deltaT = 0.01;
for (scalar t=0; t<4.1; t+=deltaT)
{
qdot += 0.5*deltaT*qddot;
q += deltaT*qdot;
qDot += 0.5*deltaT*qDdot;
q += deltaT*qDot;
pendulum.forwardDynamics
(
q,
w,
qdot,
qDot,
tau,
Field<spatialVector>(),
qddot
qDdot
);
qdot += 0.5*deltaT*qddot;
qDot += 0.5*deltaT*qDdot;
Info<< "Time " << t << "s, angle = " << q[0] << "rad" << endl;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment