improve verification for buffer_proto5

verify that different pieces of the sim are properly connected.
This commit is contained in:
2022-01-11 14:03:46 -08:00
parent be16f7d21c
commit fe5eab5e43
9 changed files with 310 additions and 59 deletions

View File

@@ -2,10 +2,13 @@
//! v.s. the fourth prototype, it changes the couplings in an attempt to reduce unwanted
//! clock -> mem2 coupling
use coremem::{Driver, mat, meas, SampleableSim as _, SpirvDriver};
use coremem::real::R32 as Real;
use coremem::geom::{region, Cube, Dilate, Index, Meters, Spiral, SwapYZ, Torus, Translate, Wrap};
use coremem::{Driver, mat, meas, SpirvDriver};
use coremem::geom::{region, Cube, Dilate, Meters, Region, Spiral, SwapYZ, Torus, Translate, Wrap};
use coremem::stim::{CurlStimulus, Gated, Sinusoid1, TimeVarying1 as _};
use log::info;
#[allow(unused)]
use coremem::geom::{Coord as _, Region as _};
#[derive(Copy, Clone, Debug)]
struct Params {
@@ -108,23 +111,27 @@ fn run_sim(id: u32, p: Params) {
ferro_center + Meters::new_y(p.ferro_major + 4.0*p.wire_wrap_minor + 12.0*p.feat_size),
Meters::new(p.ferro_buffer + 2.0*p.ferro_major + 4.0*p.feat_size, 2.0*p.feat_size, 2.0*p.feat_size)
);
let coupling_stub_top_left = Cube::new_including_negatives(
coupling_wire_top.bot_left_out(),
coupling_wire_top.bot_left_out() + Meters::new(4.0*p.feat_size, 10.0*p.feat_size, 2.0*p.feat_size)
);
let coupling_stub_top_right = Cube::new_including_negatives(
coupling_wire_top.bot_right_out(),
coupling_wire_top.bot_right_out() + Meters::new(-4.0*p.feat_size, 10.0*p.feat_size, 2.0*p.feat_size)
);
let coupling_stub_bot_left = Cube::new_including_negatives(
coupling_wire_bot.top_left_out(),
coupling_wire_bot.top_left_out() + Meters::new(4.0*p.feat_size, -10.0*p.feat_size, 2.0*p.feat_size)
);
let coupling_stub_bot_right = Cube::new_including_negatives(
coupling_wire_bot.top_right_out(),
coupling_wire_bot.top_right_out() + Meters::new(-4.0*p.feat_size, -10.0*p.feat_size, 2.0*p.feat_size)
);
let coupling_stubs = region::Union::new()
.with(Cube::new_including_negatives(
coupling_wire_top.bot_left_out(),
coupling_wire_top.bot_left_out() + Meters::new(4.0*p.feat_size, 10.0*p.feat_size, 2.0*p.feat_size)
))
.with(Cube::new_including_negatives(
coupling_wire_top.bot_right_out(),
coupling_wire_top.bot_right_out() + Meters::new(-4.0*p.feat_size, 10.0*p.feat_size, 2.0*p.feat_size)
))
.with(Cube::new_including_negatives(
coupling_wire_bot.top_left_out(),
coupling_wire_bot.top_left_out() + Meters::new(4.0*p.feat_size, -10.0*p.feat_size, 2.0*p.feat_size)
))
.with(Cube::new_including_negatives(
coupling_wire_bot.top_right_out(),
coupling_wire_bot.top_right_out() + Meters::new(-4.0*p.feat_size, -10.0*p.feat_size, 2.0*p.feat_size)
))
.with(coupling_stub_top_left.clone())
.with(coupling_stub_top_right.clone())
.with(coupling_stub_bot_left.clone())
.with(coupling_stub_bot_right.clone())
;
let coupling_wires = region::Union::new()
@@ -160,6 +167,33 @@ fn run_sim(id: u32, p: Params) {
p.feat_size,
), "{:?}", p);
assert!(wrap1_with_coupling.contains(
coupling_stub_top_left.center().to_index(p.feat_size).to_meters(p.feat_size),
));
assert!(wrap1_with_coupling.contains(
coupling_stub_bot_left.center().to_index(p.feat_size).to_meters(p.feat_size),
));
assert!(wrap2_with_coupling.contains(
coupling_stub_top_right.center().to_index(p.feat_size).to_meters(p.feat_size),
));
assert!(wrap2_with_coupling.contains(
coupling_stub_bot_right.center().to_index(p.feat_size).to_meters(p.feat_size),
));
info!("wrap1 length: {}", region::distance_to(
&wrap1_with_coupling,
coupling_stub_top_left.center().to_index(p.feat_size),
coupling_stub_bot_left.center().to_index(p.feat_size),
p.feat_size,
).unwrap());
info!("wrap2 length: {}", region::distance_to(
&wrap2_with_coupling,
coupling_stub_top_right.center().to_index(p.feat_size),
coupling_stub_bot_right.center().to_index(p.feat_size),
p.feat_size,
).unwrap());
return;
// mu_r=881.33, starting at H=25 to H=75.
let ferro_mat = mat::MHPgram::new(25.0, 881.33, 44000.0);
// let ferro_mat = mat::db::conductor(wire_conductivity);
@@ -173,10 +207,10 @@ fn run_sim(id: u32, p: Params) {
driver.fill_region(&set2_region, wire_mat);
driver.fill_region(&coupling_region, wire_mat);
println!("boundary: {}um; {}um", m_to_um(p.boundary_xy), m_to_um(p.boundary_z));
println!("size: {}, {}, {}", width, height, depth);
println!("ferro1: {:?}", ferro1_center);
println!("ferro2: {:?}", ferro2_center);
info!("boundary: {}um; {}um", m_to_um(p.boundary_xy), m_to_um(p.boundary_z));
info!("size: {}, {}, {}", width, height, depth);
info!("ferro1: {:?}", ferro1_center);
info!("ferro2: {:?}", ferro2_center);
driver.add_classical_boundary(Meters::new(p.boundary_xy, p.boundary_xy, p.boundary_z));
assert!(driver.test_region_filled(&ferro1_region, ferro_mat));
@@ -271,15 +305,20 @@ fn run_sim(id: u32, p: Params) {
fn main() {
coremem::init_logging();
for (i, dump_frames, wraps1, wraps2) in [
(38, Some(1000000), 20.0, 12.0),
(39, Some(1000000), 20.0, 8.0),
(40, Some(1000000), 20.0, 16.0),
(41, Some(1000000), 20.0, 20.0),
// // (42, Some(1000000), 24.0, 12.0),
// (38, Some(1000000), 20.0, 12.0),
// (39, Some(1000000), 20.0, 8.0),
// (51, Some(1000000), 16.0, 16.0),
// (41, Some(1000000), 20.0, 20.0),
// // (42, Some(1000000), 24.0, 12.0), // FAILS auto connection check
// // (43, Some(1000000), 28.0, 12.0),
// // (44, Some(1000000), 32.0, 12.0),
// // (45, Some(1000000), 24.0, 16.0),
// // (46, Some(1000000), 24.0, 20.0),
(47, Some(1000000), 24.0, 16.0),
(48, Some(1000000), 24.0, 20.0), // passes auto connection check
(49, Some(1000000), 28.0, 16.0), // passes auto connection check
(50, Some(1000000), 28.0, 20.0), // passes auto connection check
// // (51, Some(1000000), 32.0, 16.0), // FAILS auto connection check
].iter().copied() {
run_sim(i, Params {
feat_size: 40e-6f32,
@@ -289,7 +328,7 @@ fn main() {
boundary_xy: 320e-6,
boundary_z: 320e-6,
ferro_major: 1240e-6,
ferro_major: 1360e-6,
ferro_minor: 60e-6,
ferro_buffer: 1320e-6,
wire_minor: 40e-6,