This is a numerical simulation application designed to model and visualize the propagation of a 2D scalar wave. It utilizes the Finite-Difference Time-Domain (FDTD) method to solve the wave equation on a discrete grid. The simulator allows for the observation of wave phenomena such as interference and reflection, with configurable boundary conditions and user-defined obstacles.
A live demo of the simulator is available at the following link:
The simulation is based on the 2D scalar wave equation:
∂²u/∂t² = c² * (∂²u/∂x² + ∂²u/∂y²)
Where:
u(x, y, t) is the wave amplitude at position (x, y) and time t.c is the propagation speed of the wave.This partial differential equation is solved numerically using the FDTD method. The continuous space and time are discretized into a grid. The wave amplitude U at a grid point (i, j) at the next time step t+dt is calculated from its current and past values, as well as the values of its neighbors, using the following central-difference update equation:
U(i, j, t+dt) = 2U(i, j, t) - U(i, j, t-dt) + (c*dt/dx)² * [U(i+1, j, t) + U(i-1, j, t) + U(i, j+1, t) + U(i, j-1, t) - 4*U(i, j, t)]
The stability of this numerical scheme is maintained by respecting the Courant-Friedrichs-Lewy (CFL) condition:
c * dt / dx ≤ 1/√2
FDTD-Wave-Simulator/
|-- templates/
| |-- index.html
|-- static/
| |-- style.css
| |-- script.js
|-- app.py
|-- demo.html
|-- requirements.txt
|-- run.bat
To run the simulation application, follow these steps:
Install Dependencies: Ensure all required dependencies are installed. You can typically do this by using the requirements.txt file with a package manager.
Launch the Application: Execute the run.bat script. This will start the local server.
Access the Simulator: Open a web browser and navigate to the address provided in the console (e.g., http://127.0.0.1:5000).
This project is released under the MIT License. See the LICENSE file for details.