Thanks to visit codestin.com
Credit goes to github.com

Skip to content

icedcoffeeee/fdtd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FDTD-rs

A finite difference time domain simulation program written in Rust.

use fdtd::*;

fn main() {
  // define bounds of dielectrics
  let circle = Dielectric::circle(Vec3::ZERO, 5.).with_epsilon(Complex32::new(1.33, 0.));

  // define sources
  let source = Source::gaussian(0., 0.2)
    .with_freq(1e-9)
    .with_center(Vec3::new(-18., 18., 0.))
    .with_efield(Vec3::new(0., 1., 0.), 0.);

  // define space and time ranges
  let mut field = Field::new((-20., 20., 10), (-20., 20., 10), (1., 10))
    .add_dielectric(circle)
    .add_source(source);

  // run and save to file
  field.run(Some("./test.mp4"));

  // query field values at any point
  println!("{at:#?}", at = field.at(0., 0.))
}

TODO

  • the run function 🙄
    • maxwell's equations
  • save to video/image
  • documentation?

known issues

  • adding dielectrics depends on field resolution. 50 points per unit takes half a minute on my machine.

About

finite difference time domain sim in rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages