Problem 5

Question

FTCS solution of the wave equation Consider a piano string of length \(L_{,}\)initially at rest. At time \(t=0\) the string is struck by the piano hammer a distance \(d\) from the end of the string: The string vibrates as a result of being struck, except at the ends, \(x=0\) and \(x=L\), where it is held fixed. a) Write a program that uses the FTCS method to solve the complete set of simultaneous first-order equations, Eq. \((9.28)\), for the case \(v=100 \mathrm{~m} \mathrm{~s}^{-1}\), with the initial condition that \(\phi(x)=0\) everywhere but the velocity \(\psi(x)\) is nonzero, with profile $$ \psi(x)=C \frac{x(L-x)}{L^{2}} \exp \left[-\frac{(x-d)^{2}}{2 \sigma^{2}}\right] $$ where \(L=1 \mathrm{~m}, d=10 \mathrm{~cm}, C=1 \mathrm{~ms}^{-1}\), and \(\sigma=0.3 \mathrm{~m}\). You will also need to choose a value for the time- step \(h .\) A reasonable choice is \(h=10^{-6} 5\). b) Make an animation of the motion of the piano string using the facilities provided by the visual package, which we studied in Section 3.4. There are various ways you could do this. A simple one would be to just, place a small sphere at the location of each grid point on the string. A more sophisticated approach would be to use the curve object in the visual package-see the on- line documentation at uvu. vpython. org for details. A convenient feature of the curve object is that you can specify its set of \(x\) positions and \(y\) positions separately as arrays. In this exercise the \(x\) positions only need to specified once, since they never change, while the \(y\) positions will need to be specified anew each time you take a timestep. Also, since the vertical displacement of the string is much less than its horizontal length, you will probably need to multiply the vertical displacement by a fairly large factor to make it visible on the screen. Allow your animation to run for some time, until numerical instabilities start to appear.

Step-by-Step Solution

Verified
Answer
Discretize the string, initialize parameters, define initial conditions, use FTCS scheme, apply boundary conditions, and animate.
1Step 1 - Understand the Problem
The exercise involves solving the wave equation for a vibrating piano string using the FTCS method. The initial velocity profile \( \psi(x) \) is given while the initial displacement \( \phi(x) \) is zero. The string is fixed at both ends, and the goal is to animate its motion.
2Step 2 - Discretize the String
Divide the string of length \( L = 1 \) m into \( N \) segments, where each grid point is \( \Delta x = L/N \) apart. Choose an appropriate \( N \) based on the desired accuracy.
3Step 3 - Initialize Parameters
Set the wave speed \( v = 100 \) m/s, hammer position \( d = 0.1 \) m, constant \( C = 1 \)ms\textsuperscript{-1}, and \( \sigma = 0.3 \) m. Set the time step \( h = 10^{-6} \times 5 \) s.
4Step 4 - Define Initial Conditions
The initial displacement \(\( \phi(x,0) = 0 \)\). The initial velocity is \( \psi(x) = C \frac{x(L-x)}{L^2} \exp \left[-\frac{(x-d)^2}{2 \sigma^2}\right] \).
5Step 5 - Create FTCS Scheme
The FTCS (Forward Time Centered Space) scheme will be used to solve the wave equations:\[ \frac{ \partial \phi}{ \partial t} = \psi \] \[ \frac{ \partial \psi}{ \partial t} = v^2 \frac{ \partial^2 \phi}{ \partial x^2} \]Translate these equations into discrete time-steps using finite differences.
6Step 6 - Implement Boundary Conditions
The boundaries are fixed: \( \phi(0, t) = \phi(L, t) = 0 \). Ensure these boundary conditions are maintained throughout the simulation.
7Step 7 - Create the Animation
Use the visual package to create the animation. Represent the string positions with small spheres or a curve object. Update the \( y \) positions at every time-step and render the new state of the string.

Key Concepts

Numerical MethodsWave EquationsFinite Difference MethodComputer SimulationsBoundary Conditions
Numerical Methods
Numerical methods convert mathematical problems into a form that can be solved using numerical approximations. This allows us to work with differential equations, like the wave equation, on computers. By approximating function values at discrete points, we can iteratively calculate their evolution over time.
Wave Equations
Wave equations describe how waves propagate through different media. For a piano string, the wave equation governs how the string vibrates when struck by a hammer. It essentially models the displacement of the string at each point as a function of time.
Finite Difference Method
The finite difference method is a numerical technique used to approximate solutions to differential equations by discretizing the equations. Using this method, derivatives are approximated using differences between function values at grid points.
For the wave equation, this involves creating a grid along the length of the string and calculating the displacement at each grid point over discrete time intervals.
Computer Simulations
Computer simulations allow us to visualize how physical systems evolve over time. By using numerical methods, we can animate the motion of a vibrating piano string. Instead of solving equations analytically, we let the computer handle the iterative calculations and render the string's vibration.
Boundary Conditions
Boundary conditions specify the behavior of a system at its boundaries. For a piano string fixed at both ends, the displacement must be zero at the ends at all times. Implementing boundary conditions ensures that the simulation accurately reflects the physical constraints imposed on the string.