A numerical solver for the wave equation written in C++. CUDA support is also added for physical simulation.
The wave equation is a second-order linear partial differential equation that describes the motion of waves in a medium.
The two dimensional equation reads:
where
The following image is the result of the simulation of a delta impulse in the center of the domain.
Compilation of all files can be done using make
command.
As this project supports both CUDA and normal processing those two executables can be compiled seperately.
To compile only non-CUDA version run make main.out
and to compile the CUDA version using nvcc run make mainCUDA.out
.
This project was tested on Ryzen 7 5800X CPU and Nvidia RTX3060 GPU.
The performance difference is starking. Physics function call takes ~0.30 seconds on CPU and ~0.012 seconds on GPU.
That makes the CUDA version ~25x faster.