Skip to main content

Module wave

Module wave 

Source
Expand description

2D wave equation ∂²u/∂t² = c²∇²u by explicit leapfrog (periodic).

u_new = 2u − u_old + (cΔt)²∇²u, CFL cΔt·√(hx⁻²+hy⁻²) ≤ 1.

Validation: u(x,y,0)=sin(x)sin(y) with zero initial velocity is a standing wave u(t)=sin(x)sin(y)·cos(ωt), ω=c√2. After half a period the field inverts (u(T/2) ≈ −u(0)); the test checks that the solution is strongly anti-correlated with the initial state at T/2 and never blows up.

Functions§

solve
Solves.