01 / 21

Model Energy Transfer
Computationally

Learn to use computational models to simulate how energy transforms between kinetic, potential, and thermal forms: track every joule with code.

High School Physics

What Is Energy Transfer?

Energy transfer is the process by which energy moves from one object or system to another, or converts from one form to another. In physics, we track energy using the law of conservation of energy: total energy in a closed system stays constant.

Kinetic Energy
Energy of motion: \( KE = \frac{1}{2}mv^2 \)
Potential Energy
Stored energy due to position: \( PE = mgh \)
Thermal Energy
Energy from random molecular motion: heat

Why Model Computationally?

Real-world energy systems involve many time steps and changing conditions. A computational model lets us simulate these systems step-by-step, updating energy values at each instant. This is far more powerful than solving a single equation.

1
Handle complexity: Model friction, drag, and variable forces that make analytic solutions difficult.
2
Visualize dynamics: Plot energy vs. time graphs and watch transfers unfold.
3
Test assumptions: Change parameters like mass or height instantly and observe outcomes.

The Core Energy Equation

For a system with gravity and friction, conservation of energy at each time step is:

Where \( E_{\text{thermal}} = f_k \cdot d \) is the energy converted to heat. In code, we update at each small time step \( \Delta t \):

Energy Flow Diagram

Potential
\( PE = mgh \)
Kinetic
\( KE = \frac{1}{2}mv^2 \)
Thermal
\( Q = f \cdot d \)
falling friction rising
Total \( E = KE + PE + \text{Thermal} = \text{const} \)

Analytic vs. Computational Models

Analytic Computational
Approach Solve equations exactly Step-by-step numerical iteration
Handles friction? Simple cases only Any force model
Time resolution Continuous (formula) Discrete (\( \Delta t \) steps)
Visualization Manual graphing Auto-generated plots
Best for Idealized problems Real-world complexity

The Computational Loop

1. Set initial conditions 2. Calculate net force 3. Update v and x 4. Compute KE, PE, Thermal repeat
\( t += \Delta t \)

How to Build the Model

1
Define constants: Set \( m \), \( g \), \( \mu_k \), \( \Delta t \), and initial height \( h_0 \).
2
Initialize variables: \( v = 0 \), \( x = 0 \), \( h = h_0 \), \( KE = 0 \), \( PE = mgh_0 \), \( E_{\text{thermal}} = 0 \).
3
Loop over time steps: Compute net force, update velocity and position, then recalculate all energy forms.
4
Store results: Append each energy value to a list for plotting.
5
Visualize: Plot \( KE \), \( PE \), \( E_{\text{thermal}} \), and total \( E \) vs. time.

Example 1: Falling Ball (No Friction)

A 2 kg ball is dropped from 20 m. Model its energy every \( \Delta t = 0.1 \) s until it hits the ground. No air resistance.

# Setup m = 2.0 # mass (kg) g = 9.8 # gravity (m/s^2) h = 20.0 # initial height (m) v = 0.0 # initial velocity (m/s) dt = 0.1 # time step (s) t = 0.0 while h > 0: a = -g h = h + v * dt # Update position with old velocity v = v + a * dt # Update velocity for next step KE = 0.5 * m * v**2 PE = m * g * max(h, 0) t = t + dt

Example 1: Energy vs. Time

0 200 400 Energy (J) 0 1.0 2.0 Time (s) PE KE Total

Example 2: Block with Friction

A 5 kg block slides down a 30° ramp starting from rest. The coefficient of kinetic friction is \( \mu_k = 0.2 \). Model the energy over 3 seconds.

m = 5.0; g = 9.8; theta = 30 # degrees mu = 0.2; dt = 0.01; v = 0; d = 0 E_th = 0 import math a_net = g*(math.sin(math.radians(theta)) - mu*math.cos(math.radians(theta))) for step in range(300): d_step = v * dt d = d + d_step v = v + a_net * dt h_fallen = d * math.sin(math.radians(theta)) KE = 0.5 * m * v**2 PE = m * g * (10 - h_fallen) # start height 10m f_k = mu * m * g * math.cos(math.radians(theta)) E_th = E_th + f_k * d_step

Example 2: Energy with Friction

0 250 500 Energy (J) 0 1 2 3 Time (s) PE KE Thermal Total

Example 3: Spring-Mass Oscillator

A 1 kg mass on a spring (\( k = 50 \) N/m) is displaced 0.3 m and released. Model the oscillating energy transfer with \( \Delta t = 0.001 \) s.

m = 1.0; k = 50; x = 0.3; v = 0 dt = 0.001 for step in range(3000): F = -k * x # Hooke's law a = F / m x = x + v * dt v = v + a * dt PE = 0.5 * k * x**2 KE = 0.5 * m * v**2 # Total = PE + KE ≈ 2.25 J always

Spring: Oscillating Energy

0 1.125 2.25 Energy (J) Time (s) 0 0.5 1.0 PE (spring) KE Total

Common Mistakes

Too-Large Time Step
Using \( \Delta t = 1 \) s instead of \( 0.01 \) s causes the simulation to "overshoot" and energy appears not conserved.
Forgetting Thermal
Omitting friction losses makes KE + PE seem to exceed the initial total. Always track \( E_{\text{thermal}} \).
Wrong Sign Convention
Gravity should accelerate downward (\( a = -g \) if up is positive). A sign error doubles or cancels the force.

Summary of Energy Forms

Energy Form Formula Code Variable When It Grows
Kinetic \( \frac{1}{2}mv^2 \) KE Speed increases
Gravitational PE \( mgh \) PE Height increases
Elastic PE \( \frac{1}{2}kx^2 \) PE_spring Spring compressed/stretched
Thermal \( f_k \cdot d \) E_thermal Friction acts over distance

Question 1 of 5

In a computational model of a falling object with no friction, the total mechanical energy at every time step should be:

Question 2 of 5

A student's simulation shows total energy increasing over time. Which is the most likely cause?

Question 3 of 5

In a spring-mass system modeled computationally, \( KE \) is maximum when:

Question 4 of 5

A 3 kg block slides on a surface with \( \mu_k = 0.1 \). After traveling 5 m, the thermal energy generated is:

Question 5 of 5

To improve accuracy of a computational energy model using Euler's method, you should: