diff --git a/crates/applications/stacked_cores/src/main.rs b/crates/applications/stacked_cores/src/main.rs index a3b1262..15f7def 100644 --- a/crates/applications/stacked_cores/src/main.rs +++ b/crates/applications/stacked_cores/src/main.rs @@ -83,9 +83,9 @@ struct Params { coupling_major: f32, coupling_minor: f32, coupling_loops: u32, + // how far to place S away from the sim edge + s_xy_buffer: f32, // coords for core 'n' - sx: f32, - sy: f32, sz1: f32, } fn um(n: u32) -> f32 { @@ -95,6 +95,12 @@ fn ps(n: u32) -> f32 { n as f32 * 1e-12 } impl Params { + fn sx(&self) -> f32 { + self.s_major + self.io_major + self.io_minor + self.s_xy_buffer + } + fn sy(&self) -> f32 { + self.s_major + self.io_major + self.io_minor + self.s_xy_buffer + } fn sz(&self, n: u32) -> f32 { (n + 1) as f32 * self.sz1 } @@ -103,14 +109,14 @@ impl Params { } /// 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) + Torus::new_xz(Meters::new(self.sx() - self.s_major, self.sy(), self.sz(n)), self.io_major, self.io_minor) } /// the last core gets an external output in place of its coupling loop fn sense(&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) + Torus::new_xz(Meters::new(self.sx() + self.s_major, self.sy(), self.sz(n)), self.io_major, self.io_minor) } fn s(&self, n: u32) -> Torus { - Torus::new_xy(Meters::new(self.sx, self.sy, self.sz(n)), self.s_major, self.s_minor) + Torus::new_xy(Meters::new(self.sx(), self.sy(), self.sz(n)), self.s_major, self.s_minor) } fn coupling_angle(&self, loop_: u32) -> f32 { let loop_ = match self.coupling_loops % 2 { @@ -133,7 +139,7 @@ impl Params { self.coupling_minor, ), ), - Meters::new(self.sx, self.sy, self.couplingz(n)), + Meters::new(self.sx(), self.sy(), self.couplingz(n)), ) } @@ -181,6 +187,10 @@ impl Params { self.coupling_loops = p; self } + fn with_s_major(mut self, p: f32) -> Self { + self.s_major = p; + self + } } @@ -217,7 +227,7 @@ fn main() { ctl_conductivity: 0.0, coupling_conductivity: 0.0, // 's' = core (ferromagnetic part) - s_major: um(160), + s_major: 0.0, s_minor: um(30), // 'io' = drive/control wire io_major: um(70), @@ -226,90 +236,135 @@ fn main() { coupling_major: um(70), coupling_minor: um(20), coupling_loops: 1, + s_xy_buffer: um(150), // coords for core 'n' - sx: um(400), - sy: um(400), sz1: um(320), }; // TODO: use a deque, with push_front and push_back let deferred = || {}; // add to this to schedule sims at a lower priority - run_sim( - "171-2ns-100ps-5e9A-1e3pctl-1e4pcpl-4loops", - drive_map_isolated_inv(), - params + 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_coupling_loops(4) - ); - run_sim( - "172-2ns-100ps-5e9A-1e3pctl-1e4pcpl-2loops", - drive_map_isolated_inv(), - 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_coupling_loops(2) - ); - run_sim( - "173-2ns-100ps-5e9A-1e3pctl-1e4pcpl-1loops", - drive_map_isolated_inv(), - 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_coupling_loops(1) - ); - run_sim( - "174-2ns-100ps-5e9A-1e3pctl-1e4pcpl-6loops", - drive_map_isolated_inv(), - 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_coupling_loops(6) - ); - run_sim( - "176-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( - "182-2ns-100ps-5e10A-1e3pctl-1e4pcpl-4loops", - drive_map_isolated_inv(), - params + .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 true { + 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_coupling_loops(4) - ); - run_sim( - "185-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) - ); + .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), + ); + } + // 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(); } @@ -323,7 +378,7 @@ fn run_sim( let sim_padding = Meters::new(um(80), um(80), um(80)); let sim_bounds = |num_cores| { - Meters::new(params.sx * 2.0, params.sy * 2.0, params.sz(num_cores)) + Meters::new(params.sx() * 2.0, params.sy() * 2.0, params.sz(num_cores)) + sim_padding };