# Making Spirographs in Abaqus

Posted in Simulations and tagged on .

Bumping into Nathan Friend’s spirograph simulator inspirograph today reminds me the vivid joy of making the intriguing patterns when I was a small kid. Spirograph toys first taught me vaguely the concept of periodicity, but I have to admit I never completely understand how it worked before the toy faded away. As I played it few times today, my mechanics-trained brain began to digest it itself: the complexity of the mechanism of a spirograph is far less than that of the patterns it produces. More importantly, since I’ve been sharpening my Abaqus Python scripting skill in visualization recently, I can’t help myself to realize such a good nail that I can try with the hammer. So this becomes my first Abaqus as a hammer note.

## A Spirograph Toy

A spirograph consists of a planet gear that can travel inside another gear, which works as a ring gear, or outside another gear, which works as a sun gear. The planet gear can guide a pen through one of its holes to draw fascinating periodic patterns. The groups of curves made by the two respective working ways are called hypotrochoid and epitrochoid. The following figure shows a spirograph producing hypotrochoid. The gears in the figure are clipped from inspirograph.

## A Kinematical Model

From a kinematics perspective, the spirograph can be abstracted as a circle purely rolls (thus does not slip) inside or outside another fixed circle, shown as blue circles in the above figure. The teeth of gears in spirograph toys are meant to prevent slip between two circles and guarantee a pure rolling condition.

This two-circle mechanical model of spirograph can be abstracted further to a two-bar model, based on the kinematics of the moving circle. We can see the center of the moving circle actually travels on a circle, so the movement of the center can be modeled by a rotating bar pinned at the origin. The movement of the moving circle can be represented by one radius of it, which is modeled by another bar rotating about the other end of the first bar, shown as red in the above figure. The pure rolling condition is thus realized by satisfying a relation between the two angular velocities of the two bars. The relation for inside spirographs is:

$$\omega_1R_1=-\omega_2R_2,$$

and for outside spirographs is:

$$(R_1+R_2)\,\omega_1=\omega_2R_2.$$

The holes on the planet gear usually have a spiral distribution on the gear, which adjusts the radial and circumferential position of the pen as it is inserted. Here changing the radial position of a pen through the holes alters the characteristic of the curves, however, changing the circumferential position only rotates the produced curve about the its center. Thus, the characteristic of curves are only determined by three parameters:

• $$R_1,$$
• $$R_2,$$
• $$d,$$

where $$d$$ is the radial distance of the hole that the pen is inserted to draw.

## An Abaqus Model

Thus, we have a simple two-bar system to equivalently represent a spirograph toy. It’s such a simple system that we can directly write the parametric equation of the curves. But this is a Abaqus as a hammer post, I’ll use Abaqus to model the system and make spirograph curves in Abaqus (duh…).

The source code can be found in my GitHub repo. The Python script ComputeSpirograph.py builds the two-bar system and computes spirograph hypotrochoid curves . The hole which is used to insert a pen is modeled by a node placed according to a ratio $$r$$ which is equal to $$d$$ over $$R_2$$.

To visualize the hypotrochoid curves, we need to plot the trace line of nodes which is a feature Abaqus does not provide by default. I took advantage of the annotation feature and Python scripting to draw trace line in Abaqus. The Abaqus Python script PostProcessSpirograph.py processes the ODB file produced by the above script and draws spirograph curves.

## Examples

Here are three instances produced by the two scripts with the set of parameters:

• $$R_1=57$$
• $$R_2=48$$
• $$r=0.5, 0.8, 1$$

Happy hammering 🙂