Skip to content
SpaceEngineerSSPublic

About

PhotonLab FDTD Electromagnetic Simulator

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

PhotonLab

A real-time electromagnetic wave simulator that runs in the browser.

Draw a lens, a slit or a waveguide, switch on a source, and watch Maxwell's equations play out live. Underneath is a 2D finite-difference time-domain (FDTD) solver written in Rust and compiled to WebAssembly. It runs on its own thread, so the interface stays smooth on laptops, tablets and phones.

Open the app · Documentation · Türkçe belgeler

PhotonLab running the double-slit experiment

What it does

  • Solver. TM and TE polarization, a convolutional PML that reflects 87 dB below the incident wave, one-way plane waves and Gaussian beams (total-field / scattered-field), mirror and periodic boundaries, dielectrics, perfect conductors, and Drude metals (silver, gold) with surface plasmons.
  • Drawing. Brush, line, rectangle, ellipse and polygon tools. Glass, water, silicon, metals, an absorber, or any refractive index you choose.
  • Sources. Point sources, plane waves, Gaussian beams and phased arrays. Continuous waves, pulses or wave packets.
  • Measurement. Up to eight probes that record every time step, with signal, spectrum and energy plots. A resolution readout warns you when the grid is too coarse for the material.
  • Sharing. Undo history, scene files, share links that carry the whole scene, PNG, video and CSV export.
  • Twelve experiments to start from: double slit, lens, parabolic mirror, total internal reflection, zone plate, anti-reflection coating, silicon waveguide, photonic crystal, surface plasmons, phased array and more.
  • Runs anywhere. A start-up benchmark picks a grid size the device can carry. Installable as an offline app. English and Turkish.

The solver is checked against known results on every commit: Fresnel reflection from glass and silicon, metal reflection, energy conservation in a closed cavity, boundary reflection and plane-wave leakage. The numbers are in the validation page.

Running it locally

Requires Node.js 20.19 or newer.

npm install
npm run dev          # app on http://localhost:5173
npm run dev:docs     # docs on http://localhost:4321/docs
npm test             # web unit tests

The compiled solver is committed in rust-core/pkg, so Rust is only needed to change the solver:

rustup target add wasm32-unknown-unknown && cargo install wasm-pack
npm run build:wasm
cd rust-core && cargo test --release

See Building and contributing for the details and Architecture for how the pieces fit together.

Project layout

rust-core/   FDTD solver (Rust → WebAssembly) and its physics tests
web/         the app (React, TypeScript, Vite, WebGL 2)
docs/        documentation site (Astro Starlight), English and Turkish
tools/       screenshot, figure and icon generators

Contributing

Bug reports, ideas and pull requests are welcome. Please read CONTRIBUTING.md first. Changes are listed in CHANGELOG.md.

License

MIT © Mehmet Gümüş. See LICENSE.

About

PhotonLab FDTD Electromagnetic Simulator

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages