> For the complete documentation index, see [llms.txt](https://tlcfem.gitbook.io/suanpan-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tlcfem.gitbook.io/suanpan-manual/example/structural/dynamics/triple-pendulum.md).

# triple pendulum

Minimum version: v2.4

The model can be downloaded [here](https://github.com/TLCFEM/suanPan-manual/tree/dev/docs/Example/Structural/Dynamics/triple-pendulum.zip).

The main purpose of this example is two-fold:

1. to illustrate how a dynamic system can be analysed, and
2. to show different performance of different time integration methods.

## Model

Such a model for pendulum can be established using two main approaches. As a triple pendulum, the model has four nodes.

```
node 1 0 0
node 2 0 -2
node 3 0 -3
node 4 0 -5

fix2 1 E 1
```

The first node is pinned so that it does not move.

### With Rigid Links

By using rigid truss elements, the inextensible links can be approximated given that if the rigidity is sufficiently large. Define the corresponding truss elements and point masses. Note here since the fixed node `1` is connected to the truss element `1`, there is no need to assign mass to it.

```
# with rigid links
material Elastic1D 1 1E7

element T2D2 1 1 2 1 1 true
element T2D2 2 2 3 1 1 true
element T2D2 3 3 4 1 1 true

element Mass 4 2 20 1 2
element Mass 5 3 10 1 2
element Mass 6 4 20 1 2
```

Note the nonlinear geometry switch is on to account for large displacement (but still small deformation).

### With Constraints

Alternatively, the [`FixedLength`](/suanpan-manual/constraint/fixedlength.md) constraint can be used to apply the inextensible constraints.

```
constraint FixedLength2D 10 1 2
constraint FixedLength2D 11 2 3
constraint FixedLength2D 12 3 4

element Mass 1 1 1 1 2 ! important
element Mass 2 2 20 1 2
element Mass 3 3 10 1 2
element Mass 4 4 20 1 2
```

Note here, compared to the previous approach, since the fixed node `1` is now not connected to any truss elements, it will be associated to nothing if no point mass is assigned to it. This is not allowed. Such an 'isolated' dummy node will be identified and automatically **disabled** during the initialisation stage. In order to avoid this, it is **necessary** to assign a point mass to it.

### Initial Conditions and Other Setup

An initial velocity is assigned to node `3`.

```
initial velocity 25 1 3
```

The gravity load is assigned in form of constant force.

```
amplitude Constant 1
cload 1 1 -200 2 2
cload 2 1 -100 2 3
cload 3 1 -200 2 4
```

There is no essential difference whether to assign the gravity load to node `1` as it is fixed. The applied load will be balanced out by the resistance. This only affects how the results shall be processed.

## Analyse

The analysis is performed with the Newmark integration method.

```
step dynamic 1 100
set ini_step_size 1E-3
set fixed_step_size 1
set symm_mat 0

integrator Newmark 1

converger AbsIncreDisp 1 1E-10 10 1

analyze
```

## Results

The animation is presented as follows.

![animation](https://1124082496-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEquxr3H9WpPg4iPvT2mB%2Fuploads%2Fgit-blob-79b3c9da353ef955adf81ae95233a3c3c2b097dc%2Ftriple-pendulum.gif?alt=media)

## What's Next?

Everything seems to be working fine, which appears to be good. So what's next? If the results are carefully examined, one would notice some unexpected behaviour. For ones who have a good background of dynamics, it must be noticed that the Newmark method has no algorithmic damping. It is also not ideal in terms of energy/momentum conservation.

If one plots the acceleration history, one can notice that the acceleration is not physically meaningful.

![newmark acceleration](https://1124082496-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEquxr3H9WpPg4iPvT2mB%2Fuploads%2Fgit-blob-7404fdbef45f47917ae63365a4e1d8af88d512fe%2Ftriple-pendulum-newmark.svg?alt=media)

Given that the Newmark method has no algorithmic damping, the high frequency noise cannot be suppressed. Try the extra two models using [`BatheTwoStep`](/suanpan-manual/integrator/implicit/bathetwostep.md) and [`GSSSS`](/suanpan-manual/integrator/implicit/gssss.md) methods in the archive.

If one instead uses the [`GSSSS`](/suanpan-manual/integrator/implicit/gssss.md) method with identical spectral radii, which is equivalent to the [`generalised alpha`](/suanpan-manual/integrator/implicit/generalizedalpha.md) method, the acceleration history can be plotted as follows.

![generalised alpha acceleration](https://1124082496-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEquxr3H9WpPg4iPvT2mB%2Fuploads%2Fgit-blob-e45df9705da6c859205cd486bcde3f42e54e3555%2Ftriple-pendulum-gssss.svg?alt=media)

All in all, as long as the system may result in high frequency response, the use of the Newmark method is discouraged.

The high frequency response may stem from either very large stiffness or very small mass. The former case may happen when parts of the system are very rigid. The application of penalty method often results in large stiffness components. The latter case may happen when the mass is under integrated or even lumped. Both are somehow inevitable in practical simulations. One shall consider other time integration methods to obtain more reliable results.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tlcfem.gitbook.io/suanpan-manual/example/structural/dynamics/triple-pendulum.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
