Solving the 2D Wave Equation

Christopher Lum
lum@uw.edu

This document accompanies the YouTube video at https://youtu.be/Whp6jolTu34.

Step 2: Satisfying the Boundary Conditions

Check Helmholtz Solution

Define the solution to the Helmholtz equation and show that it satisfies the boundary conditions

Fmn[x_,y_]=Γ Sin[((m π)/a) x] Sin[((n π)/b)y];

Print["Satisfies left boundary condition"]
Fmn[0,y]==0
Print[" "]

Print["Satisfies right boundary condition"]
Simplify[Fmn[a,y]==0,{Element[m,Integers],Element[n,Integers]}]
Print[" "]

Print["Satisfies bottom boundary condition"]
Fmn[x,0]==0
Print[" "]

Print["Satisfies top boundary condition"]
Simplify[Fmn[x,b]==0,{Element[m,Integers],Element[n,Integers]}]
Print[" "]

Now find the value of ν that will allow (Subscript[F, mn])(x,y) to satisfies the Helmholtz equation.

Simplify[D[Fmn[x,y],{x,2}]+D[Fmn[x,y],{y,2}]+νSquared Fmn[x,y], {Element[m,Integers],Element[n,Integers]}]

Solve[D[Fmn[x,y],{x,2}]+D[Fmn[x,y],{y,2}]+νSquared Fmn[x,y]==0,νSquared]

This is the same as the expression we derived on the whiteboard

((((b^2) (m^2)+(a^2) (n^2)) (π^2))/((a^2) (b^2)))==(((((m π)/a)))^2)+(((((n π)/b)))^2)//Simplify

Check Eigenfunctions Satisfy BCs and Original PDE

Show that eigenfunction satisfies the boundary condition and the original PDE (2D wave equation)

(*Define the solution to the temporal ODE*)
λmn=c π(((((((n/b)))^2)+((((m/a)))^2)))^(1/2))
Gmn[t_]=Bmn Cos[λmn t]+BmnStar Sin[λmn t];

(*Define the total solution (AKA the eigenfunction)*)

umn[x_,y_,t_]=Fmn[x,y] Gmn[t]/.{Γ->1}

Verify (Subscript[u, mn])(x,y,t) satisfies 2D Wave Equation and boundary conditions

Print["Satisfies original, governing PDE (2D wave equation)"]
LHS=D[umn[x,y,t],{t,2}]//Simplify;
RHS=(c^2)(D[umn[x,y,t],{x,2}]+D[umn[x,y,t],{y,2}])//Simplify;
LHS==RHS//FullSimplify
Print[" "]

(*Verify that this satisfies the boundary condition*)
Print["Satisfies left boundary condition"]
umn[0,y,t]==0
Print[" "]

Print["Satisfies right boundary condition"]
Simplify[umn[a,y,t]==0,{Element[m,Integers],Element[n,Integers]}]
Print[" "]

Print["Satisfies bottom boundary condition"]
umn[x,0,t]==0
Print[" "]

Print["Satisfies top boundary condition"]
Simplify[umn[x,b,t]==0,{Element[m,Integers],Element[n,Integers]}]
Print[" "]

Example: Square Membrane

Consider the square membrane with a=b=1.  For simplicity, we assume that c=1.

(*Define the m and n that we would like to investigate*)
mPlot=1;    (*Change these to change animation*)
nPlot=3;   (*Change these to change animation*)

(*Define eigenvalue for this case*)
Print["Eigenvalue"]
λmnPlot=λmn/.{m->mPlot,n->nPlot,a->1,b->1,c->1}
Print[" "]

Print["Frequency (Hz)"]
fHz=((λmnPlot)/(2 π))//N
Print[" "]

(*Define the eigenfunction for this case*)
Clear[umnPlot]
Print["Eigenfunction"]
umnPlot[x_,y_,t_]=umn[x,y,t]/.{m->mPlot,n->nPlot,a->1,b->1,c->1,Bmn->1,BmnStar->0}
Print[" "]

(*Animate the eigenfunction*)
Manipulate[
Plot3D[umnPlot[x,y,t],{x,0,1},{y,0,1},

(*Plot options*)
PlotRange->{{0, 1},{0, 1},{-1,1}},
AxesLabel->{"x","y","u(x,y,t)"},
PlotLabel->StringJoin["m = ",ToString[mPlot],", n = ",ToString[nPlot]]
],

{t,0,1/fHz}
]

Step 3: Satisfying the Initial Conditions

We  investigate this in a homework assignment.