diff --git a/crates/applications/stacked_cores/src/main.rs b/crates/applications/stacked_cores/src/main.rs index dd511c5..20f9505 100644 --- a/crates/applications/stacked_cores/src/main.rs +++ b/crates/applications/stacked_cores/src/main.rs @@ -66,7 +66,7 @@ impl ClockState { } } -#[derive(Copy, Clone)] +#[derive(Clone)] struct Params { input_magnitude: f32, clock_phase_duration: f32, @@ -79,14 +79,19 @@ struct Params { // 'io' = drive/control wire io_major: f32, io_minor: f32, - coupling_length: f32, coupling_major: f32, coupling_minor: f32, - coupling_loops: u32, + coupling_loops: u32, // per core // how far to place S away from the sim edge s_xy_buffer: f32, // coords for core 'n' sz1: f32, + couplings: Vec<( + u32, /* from core */ + u32, /* to core */ + u32, /* shift index */ + u32, /* coupling group */ + )>, } fn um(n: u32) -> f32 { n as f32 * 1e-6 @@ -104,9 +109,6 @@ impl Params { fn sz(&self, n: u32) -> f32 { (n + 1) as f32 * self.sz1 } - fn couplingz(&self, n: u32) -> f32 { - 0.5 * (self.sz(n) + self.sz(n+1)) - } /// control loop for core n (alternately called "drive" loop) fn ctl(&self, n: u32) -> Torus { Torus::new_xz(Meters::new(self.sx() - self.s_major, self.sy(), self.sz(n)), self.io_major, self.io_minor) @@ -118,31 +120,39 @@ impl Params { fn s(&self, n: u32) -> Torus { Torus::new_xy(Meters::new(self.sx(), self.sy(), self.sz(n)), self.s_major, self.s_minor) } - fn coupling_angle(&self, set_id: u32, loop_: u32) -> f32 { - // coupling onto 2 cores, plus 1 control and an optional sense. - let total_loops = self.coupling_loops * 2 + 2; + fn coupling_angle(&self, loop_: u32, set_id: u32, of_set: u32) -> f32 { + // plus 1 control and an optional sense. + let total_loops = self.coupling_loops * of_set + 2; // + 1 because we reserve loop 0 for control. - let mut idx = loop_ * 2 + 1 + set_id % 2; + let mut idx = loop_ * of_set + 1 + set_id; // reserve idx = 50% for sense wire. if idx >= total_loops / 2 { idx += 1; } idx as f32 / total_loops as f32 * f32::two_pi() } - /// coupling(n) is the wire which couples core n into core n+1 - fn coupling(&self, n: u32, loop_: u32) -> Translate> { - let angle = self.coupling_angle(n, loop_); + /// coupling(n) is the wire which couples core `from` to core `to`. + /// - `of_set` indicates how many sets of loops this core has (e.g. 2 if it's coupling separately + /// to the above and below cores, equally). + /// - `set_id` is [0, of_set). + /// - `loop_` is [0, self.coupling_loops). + fn coupling(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> Translate> { + let angle = self.coupling_angle(loop_, set_id, of_set); + let from_z = self.sz(from); + let to_z = self.sz(to); + let center_z = (from_z + to_z) * 0.5; + let coupling_length = (to_z - from_z).abs(); Translate::new( Rotate::about_z( angle, ElongatedTorus::new_xz( Meters::new(self.s_major, 0.0, 0.0), - self.coupling_length, + coupling_length, self.coupling_major, self.coupling_minor, ), ), - Meters::new(self.sx(), self.sy(), self.couplingz(n)), + Meters::new(self.sx(), self.sy(), center_z) ) } @@ -166,33 +176,45 @@ impl Params { .shifted(start.cast()) } - fn with_input_magnitude(mut self, p: f32) -> Self { - self.input_magnitude = p; - self + fn with_input_magnitude(&self, p: f32) -> Self { + let mut me = self.clone(); + me.input_magnitude = p; + me } - fn with_clock_phase_duration(mut self, p: f32) -> Self { - self.clock_phase_duration = p; - self + fn with_clock_phase_duration(&self, p: f32) -> Self { + let mut me = self.clone(); + me.clock_phase_duration = p; + me } - fn with_clock_decay(mut self, p: f32) -> Self { - self.clock_decay = p; - self + fn with_clock_decay(&self, p: f32) -> Self { + let mut me = self.clone(); + me.clock_decay = p; + me } - fn with_ctl_conductivity(mut self, p: f32) -> Self { - self.ctl_conductivity = p; - self + fn with_ctl_conductivity(&self, p: f32) -> Self { + let mut me = self.clone(); + me.ctl_conductivity = p; + me } - fn with_coupling_conductivity(mut self, p: f32) -> Self { - self.coupling_conductivity = p; - self + fn with_coupling_conductivity(&self, p: f32) -> Self { + let mut me = self.clone(); + me.coupling_conductivity = p; + me } - fn with_coupling_loops(mut self, p: u32) -> Self { - self.coupling_loops = p; - self + fn with_coupling_loops(&self, p: u32) -> Self { + let mut me = self.clone(); + me.coupling_loops = p; + me } - fn with_s_major(mut self, p: f32) -> Self { - self.s_major = p; - self + fn with_s_major(&self, p: f32) -> Self { + let mut me = self.clone(); + me.s_major = p; + me + } + fn with_coupling(&self, from: u32, to: u32, id: u32, of: u32) -> Self { + let mut me = self.clone(); + me.couplings.push((from, to, id, of)); + me } } @@ -371,393 +393,401 @@ fn main() { // 'io' = drive/control wire io_major: um(70), io_minor: um(20), - coupling_length: um(320), coupling_major: um(70), coupling_minor: um(20), coupling_loops: 1, s_xy_buffer: um(150), // coords for core 'n' sz1: um(320), + couplings: Vec::new(), }; - // TODO: use a deque, with push_front and push_back - let deferred = || {}; // add to this to schedule sims at a lower priority + // if false { + // let p17x = params + // .with_clock_phase_duration(ps(2000)) + // .with_clock_decay(ps(100)) + // .with_input_magnitude(5e9) + // .with_ctl_conductivity(1e3) + // .with_coupling_conductivity(1e4) + // .with_s_major(um(160)) + // ; + // run_sim( + // "171-2ns-100ps-5e9A-1e3pctl-1e4pcpl-4loops", + // drive_map_isolated_inv(), + // p17x.with_coupling_loops(4), + // ); + // run_sim( + // "172-2ns-100ps-5e9A-1e3pctl-1e4pcpl-2loops", + // drive_map_isolated_inv(), + // p17x.with_coupling_loops(2), + // ); + // run_sim( + // "173-2ns-100ps-5e9A-1e3pctl-1e4pcpl-1loops", + // drive_map_isolated_inv(), + // p17x.with_coupling_loops(1), + // ); + // run_sim( + // "174-2ns-100ps-5e9A-1e3pctl-1e4pcpl-6loops", + // drive_map_isolated_inv(), + // p17x.with_coupling_loops(6), + // ); + // } + // if false { + // let p3xx = params + // .with_clock_phase_duration(ps(2000)) + // .with_clock_decay(ps(100)) + // .with_input_magnitude(5e10) + // .with_ctl_conductivity(1e3) + // .with_coupling_conductivity(1e4) + // .with_s_major(um(400)) + // ; + // run_sim( + // "301-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-1loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(1), + // ); + // run_sim( + // "302-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-2loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(2), + // ); + // run_sim( + // "304-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-4loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(4), + // ); + // run_sim( + // "308-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-8loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(8), + // ); + // run_sim( + // "312-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-12loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(12), + // ); + // run_sim( + // "316-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-16loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(16), + // ); + // run_sim( + // "320-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-20loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(20), + // ); + // run_sim( + // "324-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-24loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(24), + // ); + // run_sim( + // "328-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-28loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(28), + // ); + // run_sim( + // "332-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-32loops", + // drive_map_isolated_inv(), + // p3xx.with_coupling_loops(32), + // ); + // } + // if false { + // let p4xx = params + // .with_clock_phase_duration(ps(1000)) + // .with_clock_decay(ps(50)) + // .with_input_magnitude(8e10) + // .with_ctl_conductivity(5e2) + // .with_coupling_conductivity(5e3) + // .with_s_major(um(400)) + // .with_coupling(1, 0, 0, 2) + // .with_coupling(1, 2, 1, 2) + // ; + // run_sim( + // "401-1loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(1), + // ); + // run_sim( + // "402-2loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(2), + // ); + // run_sim( + // "404-4loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(4), + // ); + // run_sim( + // "406-6loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(6), + // ); + // run_sim( + // "408-8loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(8), + // ); + // run_sim( + // "410-10loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(10), + // ); + // run_sim( + // "412-12loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(12), + // ); + // run_sim( + // "416-16loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(16), + // ); + // run_sim( + // "420-20loops", + // drive_map_3stack(), + // p4xx.with_coupling_loops(20), + // ); + // } + // if false { + // let p5xx = params + // .with_clock_phase_duration(ps(1000)) + // .with_clock_decay(ps(50)) + // .with_input_magnitude(8e10) + // .with_ctl_conductivity(5e2) + // .with_coupling_conductivity(5e3) + // .with_s_major(um(400)) + // .with_coupling(0, 1, 0, 2) + // .with_coupling(1, 2, 1, 2) + // ; + // run_sim( + // "501-1loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(1), + // ); + // run_sim( + // "502-2loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(2), + // ); + // run_sim( + // "504-4loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(4), + // ); + // run_sim( + // "506-6loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(6), + // ); + // run_sim( + // "508-8loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(8), + // ); + // run_sim( + // "510-10loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(10), + // ); + // run_sim( + // "512-12loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(12), + // ); + // run_sim( + // "516-16loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(16), + // ); + // run_sim( + // "520-20loops", + // drive_map_3stack_one_sided(), + // p5xx.with_coupling_loops(20), + // ); + // } + // if false { + // let p6xx = params + // .with_clock_phase_duration(ps(1000)) + // .with_clock_decay(ps(50)) + // .with_input_magnitude(8e10) + // .with_ctl_conductivity(5e2) + // .with_coupling_conductivity(5e3) + // .with_s_major(um(400)) + // .with_coupling(0, 1, 0, 2) + // .with_coupling(1, 2, 1, 2) + // ; + // run_sim( + // "601-1loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(1), + // ); + // run_sim( + // "602-2loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(2), + // ); + // run_sim( + // "604-4loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(4), + // ); + // run_sim( + // "606-6loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(6), + // ); + // run_sim( + // "608-8loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(8), + // ); + // run_sim( + // "610-10loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(10), + // ); + // run_sim( + // "612-12loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(12), + // ); + // run_sim( + // "616-16loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(16), + // ); + // run_sim( + // "620-20loops", + // drive_map_3stack_one_sided_inv(), + // p6xx.with_coupling_loops(20), + // ); + // } + // if false { + // let p7xx = params + // .with_clock_phase_duration(ps(1000)) + // .with_clock_decay(ps(50)) + // .with_input_magnitude(8e10) + // .with_ctl_conductivity(5e2) + // .with_coupling_conductivity(5e3) + // .with_s_major(um(400)) + // .with_coupling(0, 1, 0, 2) + // .with_coupling(1, 2, 1, 2) + // .with_coupling(2, 3, 0, 2) + // .with_coupling(3, 4, 1, 2) + // ; + // run_sim( + // "701-1loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(1), + // ); + // run_sim( + // "702-2loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(2), + // ); + // run_sim( + // "704-4loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(4), + // ); + // run_sim( + // "706-6loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(6), + // ); + // run_sim( + // "708-8loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(8), + // ); + // run_sim( + // "710-10loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(10), + // ); + // run_sim( + // "712-12loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(12), + // ); + // run_sim( + // "716-16loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(16), + // ); + // run_sim( + // "720-20loops", + // drive_map_5stack_one_sided_inv(), + // p7xx.with_coupling_loops(20), + // ); + // } + // if false { + // let p8xx = params + // .with_clock_phase_duration(ps(1000)) + // .with_clock_decay(ps(50)) + // .with_input_magnitude(8e10) + // .with_ctl_conductivity(5e2) + // .with_coupling_conductivity(5e3) + // .with_s_major(um(400)) + // .with_coupling_loops(16) + // ; + // run_sim( + // "803-3core", + // drive_map_nstack_one_sided_inv::<3>(), + // p8xx, + // ); + // run_sim( + // "805-5core", + // drive_map_nstack_one_sided_inv::<5>(), + // p8xx, + // ); + // run_sim( + // "807-7core", + // drive_map_nstack_one_sided_inv::<7>(), + // p8xx, + // ); + // run_sim( + // "809-9core", + // drive_map_nstack_one_sided_inv::<9>(), + // p8xx, + // ); + // run_sim( + // "811-11core", + // drive_map_nstack_one_sided_inv::<11>(), + // p8xx, + // ); + // run_sim( + // "813-13core", + // drive_map_nstack_one_sided_inv::<13>(), + // p8xx, + // ); + // run_sim( + // "815-15core", + // drive_map_nstack_one_sided_inv::<15>(), + // p8xx, + // ); + // run_sim( + // "817-17core", + // drive_map_nstack_one_sided_inv::<17>(), + // p8xx, + // ); + // run_sim( + // "819-19core", + // drive_map_nstack_one_sided_inv::<19>(), + // p8xx, + // ); + // run_sim( + // "820-20core", + // drive_map_nstack_one_sided_inv::<20>(), + // p8xx, + // ); + // run_sim( + // "821-21core", + // drive_map_nstack_one_sided_inv::<21>(), + // p8xx, + // ); + // } if false { - let p17x = params - .with_clock_phase_duration(ps(2000)) - .with_clock_decay(ps(100)) - .with_input_magnitude(5e9) - .with_ctl_conductivity(1e3) - .with_coupling_conductivity(1e4) - .with_s_major(um(160)) - ; - run_sim( - "171-2ns-100ps-5e9A-1e3pctl-1e4pcpl-4loops", - drive_map_isolated_inv(), - p17x.with_coupling_loops(4), - ); - run_sim( - "172-2ns-100ps-5e9A-1e3pctl-1e4pcpl-2loops", - drive_map_isolated_inv(), - p17x.with_coupling_loops(2), - ); - run_sim( - "173-2ns-100ps-5e9A-1e3pctl-1e4pcpl-1loops", - drive_map_isolated_inv(), - p17x.with_coupling_loops(1), - ); - run_sim( - "174-2ns-100ps-5e9A-1e3pctl-1e4pcpl-6loops", - drive_map_isolated_inv(), - p17x.with_coupling_loops(6), - ); - } - if false { - let p3xx = params - .with_clock_phase_duration(ps(2000)) - .with_clock_decay(ps(100)) - .with_input_magnitude(5e10) - .with_ctl_conductivity(1e3) - .with_coupling_conductivity(1e4) - .with_s_major(um(400)) - ; - run_sim( - "301-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-1loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(1), - ); - run_sim( - "302-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-2loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(2), - ); - run_sim( - "304-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-4loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(4), - ); - run_sim( - "308-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-8loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(8), - ); - run_sim( - "312-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-12loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(12), - ); - run_sim( - "316-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-16loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(16), - ); - run_sim( - "320-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-20loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(20), - ); - run_sim( - "324-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-24loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(24), - ); - run_sim( - "328-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-28loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(28), - ); - run_sim( - "332-2ns-100ps-5e10A-1e3pctl-1e4pcpl-400um-32loops", - drive_map_isolated_inv(), - p3xx.with_coupling_loops(32), - ); - } - if false { - let p4xx = params - .with_clock_phase_duration(ps(1000)) - .with_clock_decay(ps(50)) - .with_input_magnitude(8e10) - .with_ctl_conductivity(5e2) - .with_coupling_conductivity(5e3) - .with_s_major(um(400)) - ; - run_sim( - "401-1loops", - drive_map_3stack(), - p4xx.with_coupling_loops(1), - ); - run_sim( - "402-2loops", - drive_map_3stack(), - p4xx.with_coupling_loops(2), - ); - run_sim( - "404-4loops", - drive_map_3stack(), - p4xx.with_coupling_loops(4), - ); - run_sim( - "406-6loops", - drive_map_3stack(), - p4xx.with_coupling_loops(6), - ); - run_sim( - "408-8loops", - drive_map_3stack(), - p4xx.with_coupling_loops(8), - ); - run_sim( - "410-10loops", - drive_map_3stack(), - p4xx.with_coupling_loops(10), - ); - run_sim( - "412-12loops", - drive_map_3stack(), - p4xx.with_coupling_loops(12), - ); - run_sim( - "416-16loops", - drive_map_3stack(), - p4xx.with_coupling_loops(16), - ); - run_sim( - "420-20loops", - drive_map_3stack(), - p4xx.with_coupling_loops(20), - ); - } - if false { - let p5xx = params - .with_clock_phase_duration(ps(1000)) - .with_clock_decay(ps(50)) - .with_input_magnitude(8e10) - .with_ctl_conductivity(5e2) - .with_coupling_conductivity(5e3) - .with_s_major(um(400)) - ; - run_sim( - "501-1loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(1), - ); - run_sim( - "502-2loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(2), - ); - run_sim( - "504-4loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(4), - ); - run_sim( - "506-6loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(6), - ); - run_sim( - "508-8loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(8), - ); - run_sim( - "510-10loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(10), - ); - run_sim( - "512-12loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(12), - ); - run_sim( - "516-16loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(16), - ); - run_sim( - "520-20loops", - drive_map_3stack_one_sided(), - p5xx.with_coupling_loops(20), - ); - } - if false { - let p6xx = params - .with_clock_phase_duration(ps(1000)) - .with_clock_decay(ps(50)) - .with_input_magnitude(8e10) - .with_ctl_conductivity(5e2) - .with_coupling_conductivity(5e3) - .with_s_major(um(400)) - ; - run_sim( - "601-1loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(1), - ); - run_sim( - "602-2loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(2), - ); - run_sim( - "604-4loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(4), - ); - run_sim( - "606-6loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(6), - ); - run_sim( - "608-8loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(8), - ); - run_sim( - "610-10loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(10), - ); - run_sim( - "612-12loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(12), - ); - run_sim( - "616-16loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(16), - ); - run_sim( - "620-20loops", - drive_map_3stack_one_sided_inv(), - p6xx.with_coupling_loops(20), - ); - } - if false { - let p7xx = params - .with_clock_phase_duration(ps(1000)) - .with_clock_decay(ps(50)) - .with_input_magnitude(8e10) - .with_ctl_conductivity(5e2) - .with_coupling_conductivity(5e3) - .with_s_major(um(400)) - ; - run_sim( - "701-1loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(1), - ); - run_sim( - "702-2loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(2), - ); - run_sim( - "704-4loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(4), - ); - run_sim( - "706-6loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(6), - ); - run_sim( - "708-8loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(8), - ); - run_sim( - "710-10loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(10), - ); - run_sim( - "712-12loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(12), - ); - run_sim( - "716-16loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(16), - ); - run_sim( - "720-20loops", - drive_map_5stack_one_sided_inv(), - p7xx.with_coupling_loops(20), - ); - } - if false { - let p8xx = params - .with_clock_phase_duration(ps(1000)) - .with_clock_decay(ps(50)) - .with_input_magnitude(8e10) - .with_ctl_conductivity(5e2) - .with_coupling_conductivity(5e3) - .with_s_major(um(400)) - .with_coupling_loops(16) - ; - run_sim( - "803-3core", - drive_map_nstack_one_sided_inv::<3>(), - p8xx, - ); - run_sim( - "805-5core", - drive_map_nstack_one_sided_inv::<5>(), - p8xx, - ); - run_sim( - "807-7core", - drive_map_nstack_one_sided_inv::<7>(), - p8xx, - ); - run_sim( - "809-9core", - drive_map_nstack_one_sided_inv::<9>(), - p8xx, - ); - run_sim( - "811-11core", - drive_map_nstack_one_sided_inv::<11>(), - p8xx, - ); - run_sim( - "813-13core", - drive_map_nstack_one_sided_inv::<13>(), - p8xx, - ); - run_sim( - "815-15core", - drive_map_nstack_one_sided_inv::<15>(), - p8xx, - ); - run_sim( - "817-17core", - drive_map_nstack_one_sided_inv::<17>(), - p8xx, - ); - run_sim( - "819-19core", - drive_map_nstack_one_sided_inv::<19>(), - p8xx, - ); - run_sim( - "820-20core", - drive_map_nstack_one_sided_inv::<20>(), - p8xx, - ); - run_sim( - "821-21core", - drive_map_nstack_one_sided_inv::<21>(), - p8xx, - ); - } - if true { let p9xx = params .with_clock_phase_duration(ps(1000)) .with_clock_decay(ps(50)) @@ -765,6 +795,8 @@ fn main() { .with_ctl_conductivity(5e2) .with_coupling_conductivity(5e3) .with_s_major(um(400)) + .with_coupling(1, 0, 0, 2) + .with_coupling(1, 2, 1, 2) ; run_sim( "912-12loops", @@ -812,41 +844,64 @@ fn main() { p9xx.with_coupling_loops(4), ); } - // run_sim( - // "76-2ns-100ps-1e10A-1e3pctl-1e4pcpl-4loops", - // drive_map_isolated_inv(), - // params - // .with_clock_phase_duration(ps(2000)) - // .with_clock_decay(ps(100)) - // .with_input_magnitude(1e10) - // .with_ctl_conductivity(1e3) - // .with_coupling_conductivity(1e4) - // .with_coupling_loops(4) - // ); - // run_sim( - // "82-2ns-100ps-5e10A-1e3pctl-1e4pcpl-4loops", - // drive_map_isolated_inv(), - // params - // .with_clock_phase_duration(ps(2000)) - // .with_clock_decay(ps(100)) - // .with_input_magnitude(5e10) - // .with_ctl_conductivity(1e3) - // .with_coupling_conductivity(1e4) - // .with_coupling_loops(4) - // ); - // run_sim( - // "85-2ns-100ps-1e11A-1e2pctl-1e4pcpl-4loops", - // drive_map_isolated_inv(), - // params - // .with_clock_phase_duration(ps(2000)) - // .with_clock_decay(ps(100)) - // .with_input_magnitude(1e11) - // .with_ctl_conductivity(1e2) - // .with_coupling_conductivity(1e4) - // .with_coupling_loops(4) - // ); - - deferred(); + if true { + let p10xx = params + .with_clock_phase_duration(ps(1000)) + .with_clock_decay(ps(50)) + .with_input_magnitude(8e10) + .with_ctl_conductivity(5e2) + .with_coupling_conductivity(5e3) + .with_s_major(um(400)) + .with_coupling(1, 0, 0, 3) + .with_coupling(1, 2, 1, 3) + .with_coupling(0, 2, 2, 3) + ; + run_sim( + "1008-8loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(8), + ); + run_sim( + "1010-10loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(10), + ); + run_sim( + "1012-12loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(12), + ); + run_sim( + "1006-6loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(6), + ); + run_sim( + "1014-14loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(14), + ); + run_sim( + "1001-1loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(1), + ); + run_sim( + "1002-2loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(2), + ); + run_sim( + "1004-4loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(4), + ); + run_sim( + "1016-16loops", + drive_map_3stack_and_rev(), + p10xx.with_coupling_loops(16), + ); + } } @@ -890,7 +945,7 @@ fn run_sim( let coupling_mat = IsomorphicConductor::new(params.coupling_conductivity.cast::()); let ferro_mat = Ferroxcube3R1MH::new(); - let last_core = num_cores - 1; + // let last_core = num_cores - 1; let mut driver = Driver::new(Sim::new( sim_bounds(num_cores).to_index(feat_size), feat_size, @@ -902,9 +957,9 @@ fn run_sim( for core in 0..num_cores { driver.fill_region(¶ms.s(core), ferro_mat); driver.fill_region(¶ms.ctl(core), ctl_mat); - if core != last_core { + for &(from, to, id, of) in ¶ms.couplings { for loop_ in 0..params.coupling_loops { - driver.fill_region(¶ms.coupling(core, loop_), coupling_mat); + driver.fill_region(¶ms.coupling(from, to, loop_, id, of), coupling_mat); } } } @@ -916,17 +971,12 @@ fn run_sim( params.ctl(core), )); } - for core in 0..num_cores { - let name = format!("sense{}", core); - if core != last_core { - driver.add_measurement(meas::CurrentLoop::new( - &name, params.coupling(core, 0), - )); - } else { - // driver.add_measurement(meas::CurrentLoop::new( - // &name, params.sense(core), - // )); - } + for &(from, to, id, of) in ¶ms.couplings { + let name = format!("sense{}_{}", from, to); + // measure just *one* of the coupling loops + driver.add_measurement(meas::CurrentLoop::new( + &name, params.coupling(from, to, 0, id, of), + )); } for core in 0..num_cores { driver.add_measurement(meas::MagneticLoop::new( @@ -947,7 +997,7 @@ fn run_sim( let prefix = format!("out/applications/stacked_cores/{}/", name); let _ = std::fs::create_dir_all(&prefix); driver.add_state_file(&*format!("{}state.bc", prefix), 25600); - // driver.add_serializer_renderer(&*format!("{}frame-", prefix), 6400, Some(12800)); + driver.add_serializer_renderer(&*format!("{}frame-", prefix), 6400, Some(12800)); // driver.add_csv_renderer(&*format!("{}meas-detailed.csv", prefix), 100, None); driver.add_csv_renderer(&*format!("{}meas.csv", prefix), 1600, None); driver.add_csv_renderer(&*format!("{}meas-sparse.csv", prefix), 12800, None);