+
Energy and Phase Space of a Damped Oscillator
Developed by Deva O'Neil  Published July 23, 2017
A numerical model is developed for evolving the motion of a harmonic oscillator subject to linear damping. The purpose of this activity is to graph and analyze the energy and phase space of the system.
Subject Area  Mechanics 

Level  Beyond the First Year 
Available Implementations  Glowscript, IPython/Jupyter Notebook, and Mathematica 
Learning Objectives 
* Use numerical method (EulerCromer) to model oscillating systems and produce plots of the motion. (**Exercise 1**)
* Predict how motion responds to changes in initial conditions (**Exercise 1**)
* Apply concept of energy conservation to undamped and damped oscillators (**Exercise 2**)
* Make connection between the velocitydependence of damping force and the loss of total mechanical energy in the damped oscillator(**Exercise 2**)
* Interpret phase space diagrams (**Exercise 3**)

Time to Complete  100 min 
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
#Exercise 1
For this first exercise, you will apply two forces to a block attached to a horizontal spring:
1. A spring force, modeled with Hooke's Law: $\vec{F}_{sp} =  k~ (\vec{r}\vec{r}_0)$, where $\vec{r}_0$ is the equilibrium position of the mass. Here, we will take equilibrium position to be the origin, $\vec{r}_0 = (0,0,0)$.
2. A dissipative force, due to the block being immersed in a fluid. This force will provide damping. We will model it as linear in the velocity of the block:
$\vec{F}_{damp} =  b~ \vec{v}$.
__Programming__
Open the template for this activity. In your program, define the following physical constants.
 Parameters  Values  Interpretation
   
$mass$  $0.3~kg$  mass of block 
$k$  $1.8 ~N/m$  spring constant 
 $b$  $0.1~kg/s$ damping constant
Next, fill in the desired initial conditions. The first is provided for you in the template, so you can mimic the formatting.
Initial velocity:
$\vec{v}_{block} (0)= (0,0,0) m/s$
Initial position:
$\vec{r}_{block} (0)= (0.8,0,0) m$
Now, locate the while loop. Fill in the 2 forces that act on the block  the spring and the damping. Use the following variables, along with any parameters you need from the previous table.
 Variables  Interpretation
   
 $\vec{r}_{block}$  position vector of the block 
 $\vec{p}_{block}$  momentum ( $\vec{p} = m*\vec{v}$)
Finally, use the two forces you calculated to set the net force. Then, run the code. If you think the simulation looks correct, continue. If you see errors, call over an instructor for help.
__Testing__
* Describe how you could modify two initial conditions to produce a greater amplitude of the motion.
1) __________________________________________
2) __________________________________________
Test each of these separately and verify that you get a larger amplitude.
* Sketch your predictions for x(t) and v(t) in the situation where $x(0) = 0~m$ and $v(0) = 1~m/s$.
![](images/Damping/x_and_v_axes2.png "")
Test your predictions. If your results do not agree with your predictions, determine the source of the discrepancy before continuing.
* Describe how you could modify two parameters to produce a greater frequency of the motion.
1) __________________________________________
2) __________________________________________
* Explain your reasoning:
Test your predictions. If your results do not agree with your predictions, determine the source of the discrepancy before continuing. * Finally, what do you predict would happen if $b$ is set to zero? Record you prediction below, then test it.
* Explain the role that $b$ plays in this system:
#Exercise 2 The goal of this exercise is to understand how the energy of a damped harmonic oscillator changes with time. We will assume that our block starts out displaced to the right of its equilibrium position, with $v(0) = 0$. We will use the classical equation for kinetic energy, $K = \frac{1}{2}m~v^2$. The potential energy for a spring stretched a distance $\vec{r}$ from (0,0,0) is $U = \frac{1}{2} k~ r^2$. * Taking into account the initial conditions, sketch your predictions for $K(t)$, $U(t)$ for the case of $b = 0$ (no damping): ![](images/Damping/K_and_U_axes.png "") * With no damping, how do you expect the total mechanical energy to evolve with time?
Open the template for Exercise 2 and test your predictions. There are blanks for you to fill in the kinetic and potential energies. (Because this template is also used in Exercise 3, you'll see blocks of code commented out  leave those alone for now.) In testing your predictions to the graphs generated by the program, compare both the starting point of each graph and the overall behavior. If your results do not agree with your predictions, determine the source of the discrepancy before continuing. Test your prediction about total energy by changing the graph of U to a graph of total mechanical energy (K+U). * In Exercise 1, you should have found that giving the system an initial velocity increases the amplitude of the motion. Explain this result using energy reasoning.
**Damped Oscillator** We will now put a nonzero damping constant back in. Before running the code, record your predictions: * If there was damping, how would you expect the total mechanical energy to evolve with time? Make a sketch to support your answer: ![](images/Damping/total_mechanical_axes.png "") * How would you expect kinetic energy to evolve with time? Make a sketch to support your answer: ![](images/Damping/Kinetic_axes.png "") Test your predictions  your code should exhibit graphs of $K$ and $K + U$. * Explain why the decay of the total mechanical energy is not a smooth curve. (This is not a numerical artifact; it has a physical explanation.) *Hint:* At what times in the block's motion is the loss of mechanical energy the greatest? Explain your answer by revisiting the damping force equation.
#Exercise 3 To fully describe the state of a system at a point in time requires knowing both position and velocity (or, equivalently, momentum). One can describe the system at a point in the "space" of these two variables. For onedimensional motion, a graph of the motion in this "phase space" is a graph of $p$ vs. $x$. Both depend on time, so as time evolves, a path in the phase space is traced out. In the template, set $b = 0$. We'll start with the undamped oscillator. Sketch a prediction for the phase space graph for a damped oscillator ($ b = 0.1$) ![](images/Damping/phase.JPG "") In your program, remove the comments that disable the phase space graph. Don't forget to also uncomment the line in the while loop that adds to the phase space data. Compare the results to your prediction. Experiment with higher values of $b$. * Explain how to tell from the phase space plot what level of damping the block is subjected to.
* Explain how to tell from a phase space plot whether the system returns to its original state.
Test your predictions. If your results do not agree with your predictions, determine the source of the discrepancy before continuing. * Finally, what do you predict would happen if $b$ is set to zero? Record you prediction below, then test it.
* Explain the role that $b$ plays in this system:
#Exercise 2 The goal of this exercise is to understand how the energy of a damped harmonic oscillator changes with time. We will assume that our block starts out displaced to the right of its equilibrium position, with $v(0) = 0$. We will use the classical equation for kinetic energy, $K = \frac{1}{2}m~v^2$. The potential energy for a spring stretched a distance $\vec{r}$ from (0,0,0) is $U = \frac{1}{2} k~ r^2$. * Taking into account the initial conditions, sketch your predictions for $K(t)$, $U(t)$ for the case of $b = 0$ (no damping): ![](images/Damping/K_and_U_axes.png "") * With no damping, how do you expect the total mechanical energy to evolve with time?
Open the template for Exercise 2 and test your predictions. There are blanks for you to fill in the kinetic and potential energies. (Because this template is also used in Exercise 3, you'll see blocks of code commented out  leave those alone for now.) In testing your predictions to the graphs generated by the program, compare both the starting point of each graph and the overall behavior. If your results do not agree with your predictions, determine the source of the discrepancy before continuing. Test your prediction about total energy by changing the graph of U to a graph of total mechanical energy (K+U). * In Exercise 1, you should have found that giving the system an initial velocity increases the amplitude of the motion. Explain this result using energy reasoning.
**Damped Oscillator** We will now put a nonzero damping constant back in. Before running the code, record your predictions: * If there was damping, how would you expect the total mechanical energy to evolve with time? Make a sketch to support your answer: ![](images/Damping/total_mechanical_axes.png "") * How would you expect kinetic energy to evolve with time? Make a sketch to support your answer: ![](images/Damping/Kinetic_axes.png "") Test your predictions  your code should exhibit graphs of $K$ and $K + U$. * Explain why the decay of the total mechanical energy is not a smooth curve. (This is not a numerical artifact; it has a physical explanation.) *Hint:* At what times in the block's motion is the loss of mechanical energy the greatest? Explain your answer by revisiting the damping force equation.
#Exercise 3 To fully describe the state of a system at a point in time requires knowing both position and velocity (or, equivalently, momentum). One can describe the system at a point in the "space" of these two variables. For onedimensional motion, a graph of the motion in this "phase space" is a graph of $p$ vs. $x$. Both depend on time, so as time evolves, a path in the phase space is traced out. In the template, set $b = 0$. We'll start with the undamped oscillator. Sketch a prediction for the phase space graph for a damped oscillator ($ b = 0.1$) ![](images/Damping/phase.JPG "") In your program, remove the comments that disable the phase space graph. Don't forget to also uncomment the line in the while loop that adds to the phase space data. Compare the results to your prediction. Experiment with higher values of $b$. * Explain how to tell from the phase space plot what level of damping the block is subjected to.
* Explain how to tell from a phase space plot whether the system returns to its original state.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Deva O'Neil, "Energy and Phase Space of a Damped Oscillator," Published in the PICUP Collection, July 2017.
The instructor materials are ©2017 Deva O'Neil.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license