use coremem::{Driver, mat}; fn main() { let width = 201; let height = 101; let mut driver = Driver::new(width, height, 1e-3 /* feature size */) .with_y4m_renderer("ferromagnet.y4m") ; for y in 0..height { for x in 50..60 { *driver.state.get_mut(x, y).mat_mut() = mat::Static::conductor(1.0e1).into(); } // for x in 30..40 { // *state.get_mut(x, y).mat_mut() = mat::Conductor { conductivity: 1.0e8 }.into(); // } // if (0..10).contains(&y) || (height-10..height).contains(&y) { // for x in 40..50 { // *state.get_mut(x, y).mat_mut() = mat::Conductor { conductivity: 1.0e8 }.into(); // } // } for x in 72..80 { *driver.state.get_mut(x, y).mat_mut() = mat::Static::conductor(1.0e1).into(); } } for y in 40..60 { for x in 62..70 { *driver.state.get_mut(x, y).mat_mut() = mat::PiecewiseLinearFerromagnet::from_bh(&[ ( 35.0, 0.0), ( 50.0, 0.250), ( 100.0, 0.325), ( 200.0, 0.350), (1000.0, 0.390), // Falling ( 200.0, 0.360), ( 100.0, 0.345), ( 50.0, 0.340), ( 0.0, 0.325), ]).into(); //*state.get_mut(x, y).mat_mut() = mat::ComsolFerromagnet { // xi: 150.0, // ms: 2.0, // ..mat::ComsolFerromagnet::default() //}.into(); } } //let mut renderer = render::NullRenderer; loop { //let imp = match state.step_no() { // 20..=60 => 1e6, // 400..=440 => -1e6, // _ => 0.0 //}; let imp = if driver.state.step_no() < 50 { 250000.0 * ((driver.state.step_no() as f64)*0.02*std::f64::consts::PI).sin() } else { 0.0 }; // state.impulse_ex(50, 50, imp); // state.impulse_ey(50, 50, imp); // state.impulse_bz(20, 20, (imp / 3.0e8) as _); // state.impulse_bz(80, 20, (imp / 3.0e8) as _); for y in 10..height-10 { for x in 52..58 { driver.state.impulse_ey(x, y, imp as _); } } driver.step(); } }