Files
fdtd-coremem/examples/coremem.rs

27 lines
705 B
Rust

use coremem::SimState;
use coremem::render::ColorTermRenderer as Renderer;
use coremem::consts;
use std::{thread, time};
fn main() {
let mut state = SimState::new(101, 101, 1e-3 /* feature size */);
for y in 70..100 {
for x in 0..100 {
state.get_mut(x, y).mat_mut().conductivity = 1.0.into();
}
}
let mut step = 0u64;
loop {
step += 1;
let imp = 50.0 * ((step as f64)*0.05).sin();
// state.impulse_ex(50, 50, imp);
// state.impulse_ey(50, 50, imp);
state.impulse_bz(50, 50, (imp / 3.0e8) as _);
Renderer.render(&state);
state.step();
thread::sleep(time::Duration::from_millis(33));
}
}