Skip to content

A 2D wave simulator running on the GPU. Can be used for 2D light and sound simulations.

Notifications You must be signed in to change notification settings

dvalde0/WaveSimulator2D

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

2D Wave Simulation on the GPU

This repository contains a lightweight 2D wave simulator running on the GPU using CuPy library (probably requires a NVIDIA GPU). It can be used for 2D light and sound simulations. A simple visualizer shows the field and its intensity on the screen and writes a movie file for each to disks.

Example Image 1 Example Image 2

Usage

The simulation scenes are given as an 8Bit RGB image with the following channel semantics:

  • Red: The Refractive index times 100 (for refractive index 1.5 you would use value 150)
  • Green: Each pixel with a green value above 0 is a sinusoidal wave source. The green value defines its frequency.
  • Blue: Absorbtion field. Larger values correspond to higher dampening of the waves, use graduated transitions to avoid reflections

WARNING: Do not use anti-aliasing for the green channel ! The shades produced are interpreted as different source frequencies, which yields weird results.

Example Image 1

Recommended Installation

  1. Go here and install miniforge/mamba, which is a python package manager.
  2. Start the mamba command prompt (under windows type 'Miniforge Prompt' in the start menu and you should find it).
  3. install the dependencies by running:
    • mamba install numpy, opencv, matplotlib, cupy
  4. Run the program directly from the miniforge prompt (cd into the directory where you downloaded the Wave Simulator first): python main.py
  5. Alternatively, you can run the program from an IDE like PyCharm (don't forget to configure the IDE to use the python interpreter from the mamba/miniforge install directory)

About

A 2D wave simulator running on the GPU. Can be used for 2D light and sound simulations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%