# COMSOL Blog

## Double Pendulum Simulation Tutorial

##### Pawan Soami | May 22, 2013

Dynamic simulation of a double pendulum system can easily be performed using the Multibody Dynamics Module available in COMSOL Multiphysics. This module enables the mechanical simulations of assemblies of flexible and rigid bodies, often coupled with other phenomena such as from heat, electrical, and others.

### What Is a Double Pendulum?

A double pendulum is a simple physical system comprised of two arms that are connected to each other through a hinge joint. In spite of being a simple system, a double pendulum also exhibits rich dynamic behavior with a strong sensitivity to initial conditions, making it an example of a chaotic system. A double pendulum is also a highly nonlinear, under-actuated mechanical system.

A double pendulum model is used in control systems to measure the effectiveness of stabilizing algorithms. Many real-life physical structures can be approximated with a double pendulum to gain more insight about the system behavior. Some typical applications include analyzing the sway motion of a payload in an overhead crane, or optimizing a tennis stroke, where the two arms of the double pendulum are the racquet and forearm.

### Modeling a Hinge Joint

A hinge joint, also known as a pin joint, is a type of joint that connects two components in such a way that they are only allowed to rotate about each other. This allowed rotation is in a specified direction, known as the axis of rotation, and at a specified location, known as the center of rotation. The axis of rotation and the center of rotation are, in general, attached to one of the components, and move in space with that component in transient simulations. All other types of possible motion, namely translation, or rotation between the two components, are constrained by this type of joint. As a consequence of constraining these other possible motions, forces, and moments corresponding to the constrained degrees of freedom are transferred from one component to another component though this joint.

The Multibody Dynamics Module provides a pre-defined feature to establish a hinge joint between two components. This Hinge Joint feature is used in the double pendulum model to connect both the pendulum arms in our example model.

### Video Tutorial: Double Pendulum Simulation

The aim of this video is to demonstrate how to use a Hinge Joint feature in COMSOL Multiphyics to model a double pendulum and perform a transient analysis. Here, pendulum arms are subjected to a gravity load and their resultant oscillatory motion is studied. Our specific interest is in computing the forces experienced by the hinge joint, and tracking the locus of the bottom tip of the pendulum. Here both the pendulum arms are assumed to be flexible components that give us the freedom to evaluate the stresses generated in the arms.

### Video Transcription

This video will demonstrate the modeling of a double pendulum using the Multibody Dynamics Module available for use with the Structural Mechanics Module.

The primary aim of this model is to perform a flexible multibody analysis. Here, we demonstrate features available in the Multibody Dynamics Module to model interactions between mechanical components, such as joint forces and motion tracking. We will perform a transient analysis of the double pendulum motion, and track the locus of the double pendulum’s bottom tip, as it oscillates under gravity load.

Choose 3D as the spatial dimension, and select Multibody Dynamics from the Structural Mechanics branch. Choose the ‘Time Dependent’ study type, and click the Finish button.

Right-click the geometry node, and select the “Insert sequence from file” option. Browse to the model’s Model Library folder and Import the geometry sequence from the double pendulum file.

For the Finalization method, make sure to form an “Assembly” and right-click the Geometry node to build the sequence. To help with the joint definition later on, create explicit selections on the hinge pin and the barrel hinge. For better visualization of the pin boundaries, we can hide the barrel hinge. Choose boundary as the geometric entity level and select a boundary on the pin surface. Then check the “group by continuous tangent” option to add the pin’s other boundaries. Un-hide the barrel hinge and create a second explicit to repeat the selection and creation process for the inner boundaries of the barrel hinge. Hide the hinge pin this time, select boundary and click on one interior boundary of the hinge barrel. Check the “group by continuous tangent” option to select all the interior boundaries.

A third explicit is created, and the same boundary selection process is used to create a group of boundaries around which the pendulum will rotate. Under the Materials node, open the Material Browser and from the Built-In library, add Aluminum to the model for both components of the pendulum.

We now begin the physics setup for the Flexible Multibody problem. From the Multibody Dynamics node, create an attachment using the group of boundaries from the first explicit. Create a second attachment with the second explicit’s boundaries. Now these two attachments can be used to create and define a hinge joint found under the Multibody Dynamics node in the joint menu. In the joint setting window, you can view the joint sketch by expanding the Sketch tab. In the Attachment Selection window, choose Attachment 1 as the source and Attachment 2 as the destination attachments respectively. We keep the centroid of source as the center of the joint and specify the joint axis to be along the y axis.

Create a rigid connector boundary condition using the explicit three boundaries for the pendulum to rotate around. Prescribe displacements in all x, y, and z directions, then constrain the rotation around the x and z axes, limiting rotation to the y direction. From the Multibody dynamics node, add a body load and add both domains to the selection. The force of the body load is equal to the weight of both components. Keep the default mesh settings for this model, and build the mesh.

Go to the Step 1 time dependent node and in the “times” edit field, define a range to solve for 20 seconds, with a step size of 0.025 seconds. Right click Study1 and click compute.

Required analysis can now be performed on the solved model. The default plots are created to view the displacement and the component velocity. You can view the results at any of the 800 results solved in this model. Right click ‘Results’ and add a ’1D plot group’, then right click 1D plot group and add a ‘global’ plot. Click replace expression and go to Multibody Dynamics, hinge joints, hinge joint 1, joint force, and choose the x component. You can now copy this expression and paste it in the fields below, replacing the suffix x with y and z respectively. Click plot to view the joint forces at the different times. Create another ’1D plot group’, with a ‘point’ plot this time and add any point on the bottom face to the selection. In the expression field type ‘z’. In the expression field for the x-axis of this plot, type ‘x’. Click plot to view the bottom tip displacement.Here is an animation showing the bottom tip displacement over the twenty second interval.