Skip to content

Repository files navigation

WaveTank

WaveTank computational physics laboratory

WaveTank is a collection of eight interactive computational-physics instruments. It is built for learning by experimentation: change a model, watch the result, read the measurements, and connect what happened to the physics and numerical method underneath.

Open WaveTank

The simulations run locally in the browser.

How to use it

Choose an instrument from the home page, then select one of its prepared experiments. The controls alter meaningful model parameters rather than merely changing the presentation. Readouts update from the running simulation, and the explanation below each instrument follows the experiment currently selected.

There is no prescribed order. The eight instruments are independent and equally complete.

Instruments

01 - Wave Field

Study two-dimensional wave propagation in an open field, behind a double slit, or inside a resonant cavity. Move the emitter and probe, draw boundaries, listen to the transposed probe signal, and inspect the cost of advancing the numerical field.

The model uses a five-point finite-difference stencil on a 180 × 112 pressure grid. Three solver steps run for each rendered frame.

Representative equation: ∂²p/∂t² = c²∇²p

02 - Particle Chamber

Connect microscopic collisions to macroscopic quantities. Experiments cover an elastic gas, two-species mixing, and Brownian motion of a heavy tracer. Change particle count, temperature, and gravity, or stir the chamber directly.

Particles are elastic disks in a two-dimensional box. Collision search checks every pair, so its cost grows roughly with the square of particle count. That limitation is exposed because computational cost is part of the lesson.

Representative equation: P ∝ ⟨m v²⟩ / A

03 - Field Table

Arrange electric charges and compare potential, field direction, field strength, and interaction energy. Prepared systems include a dipole, a plate capacitor, and a quadrupole.

Every displayed sample sums softened Coulomb contributions from all sources. The color map shows scalar potential; arrows show the related vector field, E = −∇V.

Representative equation: V(r) = k Σ qᵢ / |r − rᵢ|

04 - Orbital Desk

Explore circular and eccentric orbits, escape, and a gravity-assist encounter. Drag a moving body to add a velocity impulse, then follow distance, speed, escape speed, angular momentum, and the exchange between kinetic and potential energy.

The model uses inverse-square gravity and a velocity-Verlet integrator, chosen to keep energy drift small enough for orbital comparisons to remain meaningful.

Representative equation: ε = v²/2 − GM/r

05 - Heat Plate

Paint hot and cold regions, lower the conductivity of selected material, and measure diffusion toward equilibrium. Experiments cover a free hot spot, a thermal bridge, and a heat shield.

The plate advances the two-dimensional heat equation with an explicit finite-difference stencil. The step size is limited for numerical stability.

Representative equation: ∂T/∂t = α∇²T

06 - Quantum Sketchbook

Shape a one-dimensional potential and follow a complex wavefunction through reflection, interference, tunneling, confinement, and coupled wells. Readouts show probability normalization, expected position, left/right probability, and energy.

Time evolution uses a fourth-order Runge–Kutta solver. Small floating-point drift is corrected by renormalizing total probability after each step.

Representative equation: iℏ ∂ψ/∂t = −(ℏ²/2m)∂²ψ/∂x² + Vψ

07 - Chaos Bench

Compare two systems separated by a microscopic change in their initial conditions. The double pendulum, Lorenz system, and logistic map show different routes from deterministic rules to practical unpredictability.

The instrument measures phase-space separation and a finite-time Lyapunov estimate. No randomness is added after initialization.

Representative equation: xₙ₊₁ = r xₙ(1 − xₙ)

08 - Optics Table

Construct principal rays for a convex lens and concave mirror, or apply Snell’s law at a material boundary. Change focal length, object position, incident angle, and refractive index while reading image distance, magnification, and refraction angle.

This is an ideal geometric-optics model. It deliberately omits lens thickness, diffraction, dispersion, and aberrations except where those limits are explained.

Representative equation: n₁ sin θ₁ = n₂ sin θ₂

Running locally

WaveTank requires Node.js 22.13 or newer.

npm install
npm run dev

The development server prints the local URL. Production validation is available through:

npm test
npm run lint

npm test builds the production application, checks the independent numerical models, and verifies that all eight instrument routes render their learning content.

About

Computational physics laboratory

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages