designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Damped Harmonic Motion

October 7, 2026 | Algorithms
#grasshopper #harmonic #simulation

Have you ever thought about making a damped pendulum in Grasshopper? I have no idea why, but I did. I just decided to transfer a Python snippet I found online into a Grasshopper definition. Here, the Initial Angle (Radians) Number slider sets the initial angle to any value from 0 to Pi. The letter G represents the acceleration due to gravity (approximately 9.81 m/s2). This is the primary force pulling the pendulum downward. As you know, pendulums wouldn’t swing without gravity. And L is simply the length of the pendulum. Let’s go:

Damped Harmonic Motion animation

Simple Harmonic Motion

According to Wikipedia, if a body moves around a circle, its motion is a simple harmonic motion with an amplitude of r and an angular frequency (angular velocity) of omega. While I didn’t entirely know where the Sqrt(g/l) in my code came from, that encyclopedia article also points out a 2pi multiplier in that formula. An interesting takeaway here is that the period of oscillation is independent of the pendulum’s mass but depends on the acceleration due to gravity. The same formula is also mentioned under Newton’s second law and here.

Exponential Damping

The next section of the Grasshopper definition serves as the core engine calculating the pendulum’s angle at any given moment (t). Naturally, we need some damping here. We handle this damping using an exponential function, which relies on a special constant called e (Euler’s number). We raise e to the power of x. Here, we use t for time and d for the damping (or friction) coefficient. When time t = 0 (since time hasn’t started ticking yet), e to the power of zero equals 1, meaning no damping occurs at first. As time goes on, the exponent increases along with the damping coefficient, and the result rapidly approaches zero. That was my best attempt at understanding it anyway. This value was tied to time as our damping multiplier. We then multiply this by the initial angle (in radians) and the time-dependent Simple Harmonic Motion (see the previous section).

Pendulum Position

The value obtained by multiplying these three components is the pendulum’s angle at time t. Now, all we have to do is use this angle and the length (L) with Grasshopper’s “Point Polar” component to position the tip of the pendulum. For aesthetic reasons, we rotated the angle by 90 degrees so the pendulum points downward on the screen. I know, this part wasn’t elegant at all, but it got the job done. In the end, we managed to build our damped pendulum simulator in Grasshopper.

Damped Harmonic Motion Grasshopper definition

What I found interesting throughout this process was how I kept trying to investigate why things were the way they were while attempting to adapt a snippet of code into Grasshopper. Thanks to this code, I realized that certain things can be done without using loops like Anemone. Even though the formulas are laid out clearly in the Wikipedia links I shared with you, I couldn’t find an answer to the “Why?” question. Sometimes a formula can be deceptively simple. As a designer, understanding and modeling this is fun up to a point, but sometimes I catch myself thinking, “I wish I had studied more physics and math.” Today, we really ought to question the fundamental physics and math education of architects who call themselves computational designers (myself included). Sure, we’re good at applying formulas, coding, and visualizing the results, and assuming that we understand everything. But if someone asked me to develop this code entirely from scratch without any outside help, I couldn’t have done it. All I can do is let the ignorance I feel in situations like this drive me to experiment even more.

Grasshopper definition (GH)Download

Cite this post

Yazar, T. (2026, October 7). Damped Harmonic Motion. designcoding. Retrieved October 7, 2026, from https://www.designcoding.net/damped-harmonic-motion/

Related Posts

Generating Harmonic Motion

September 21, 2026

While trying to program the curves produced by Spirograph toys in Grasshopper, I took a slightly different path. The topic eventually led to a broader heading: harmonic motion, and from there, to the Fourier Series we looked at previously. This simple Python code models Fourier Synthesis, driven by circles of different radii in a very straightforward way. The Python component sets up a loop that calculates the effect of each circle to the x and y values, individually. In this…

Flow Map on Terrains

September 11, 2026

We previously looked at the terrain generator script we used in midterm projects with first-year architecture students over here. Later on, we added a few analysis modules to this tool. You might remember the slope analysis tool from this link. Today’s topic is another type of analysis: flow. The idea for this code wasn’t actually mine; I developed it by looking at an existing script based on Serkan Uysal’s suggestion. Unfortunately, I don’t know who originally wrote it. Keeping track…

Differential Growth

June 16, 2025

Differential growth is a process where different parts of a structure grow at different rates, leading to complex forms. After watching this, I decided to try it in Grasshopper. Here, differential growth mimics this behavior by applying rules such as Repulsion to avoid crowding or overlapping, Cohesion to keep parts connected or within a range, and Insertion to add new elements when a part stretches too far. The algorithm I present here simulates a differential growth process starting from a…

Wandering Simulator

March 9, 2024

In 1986, Craig Reynolds developed an algorithm aiming to model the flocking behavior of birds, which remains a cult method used in flock simulations today. In my initial study, the bird-oids (boids) have no rules or limitations, just chilling randomly on the screen. I call this initial version Wandering Simulator. There are several reasons why this fundamental simulation is difficult in Grasshopper and Python, our parametric design interface. In Grasshopper (data flow modeling), pushing the back doors a bit is…

Solar Position

May 6, 2012

Experimenting with various plug-ins for solar calculations, I found Daniel Da Rocha’s robust implementation of the solar position algorithm in vb.net. It calculates the solar angle of any place and time. Although it’s written in the old vb.net component, it still works great. I’m trying to create a fast and easy workflow to optimize Grasshopper models based on solar directions. This is done by projecting faces to the solar planes and checking how much of their area is included in…

  • Chapters

    • Algorithms
    • Discourses
    • Fabrications
    • Studios
  • Explore

    • All Keywords
    • Table of Contents
    • Monthly Archive
    • #rhino-python
    • #polyhedra
    • #design-education
    • #robot
    • #parametric-surface
    • #terrain
    • #tessellation
    • #kuka-prc
    • #curvature
    • #fourier
    • #computational-geometry
    • #visualization
    • #dual
    • #parakeet
    • #pattern
    • #vector-field
    • #growth
    • #boolean
    • #sandblasting
    • #stone
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement