fix broken tests:
- mb_ferromagnet_diff_repro - mb_ferromagnet_diff_minimal_repro as the comment hinted: > these tests probably failed earlier because they were allowing negative mu_r values. > no (ordinary?) material has a negative permeability. > most materials (except superconductors) have >= 1.0 relative permeability > permeability = mu = B/H (or, \Delta B/\Delta H) in fact, the relative permeability was -0.56. it's now 1.39
This commit is contained in:
@@ -759,13 +759,16 @@ mod test {
|
||||
test_same_mb_ferromagnet(0x1234, 10, 5, Index::new(96, 16, 8));
|
||||
}
|
||||
|
||||
// XXX these tests probably failed because they were allowing negative mu_r values
|
||||
// these tests probably failed earlier because they were allowing negative mu_r values.
|
||||
// no (ordinary?) material has a negative permeability.
|
||||
// most materials (except superconductors) have >= 1.0 relative permeability
|
||||
// permeability = mu = B/H (or, \Delta B/\Delta H)
|
||||
#[test]
|
||||
fn mb_ferromagnet_diff_repro() {
|
||||
let size = Index::new(3, 3, 3);
|
||||
let seed = 0; // 0 => 28, 4 => 28
|
||||
let steps = 1000;
|
||||
let mat = mat::MBPgram::new(0e-4.to_r32(), 9.02e-3.to_r32(), 1e4.to_r32());
|
||||
let mat = mat::MBPgram::new(0e-4.to_r32(), 9.02e-3.to_r32(), 1e3.to_r32());
|
||||
let mut ref_state = SpirvSim::<R32, FullyGenericMaterial<R32>, CpuBackend>::new(size, 1e-3);
|
||||
let mut dut_state = SpirvSim::<R32, FullyGenericMaterial<R32>, WgpuBackend>::new(size, 1e-3);
|
||||
ref_state.put_material(Index::new(1, 1, 1), mat.clone());
|
||||
@@ -781,7 +784,7 @@ mod test {
|
||||
let size = Index::new(3, 3, 1);
|
||||
let seed = 0; // 0 => 28, 4 => 28
|
||||
let steps = 1000;
|
||||
let mat = mat::MBPgram::new(0e-4.to_r32(), 9.02e-3.to_r32(), 1e4.to_r32());
|
||||
let mat = mat::MBPgram::new(0e-4.to_r32(), 9.02e-3.to_r32(), 1e3.to_r32());
|
||||
let mut ref_state = SpirvSim::<R32, FullyGenericMaterial<R32>, CpuBackend>::new(size, 1e-3);
|
||||
let mut dut_state = SpirvSim::<R32, FullyGenericMaterial<R32>, WgpuBackend>::new(size, 1e-3);
|
||||
ref_state.put_material(Index::new(1, 1, 0), mat.clone());
|
||||
|
@@ -33,8 +33,9 @@ pub struct MBPgram<R> {
|
||||
pub max_m: R,
|
||||
}
|
||||
|
||||
/// f(x0) = -ymax
|
||||
/// f(x1) = ymax
|
||||
/// evaluate `f(x)` at the provided `x`, where `f` is defined by these constraints:
|
||||
/// 1. f(x0) = -ymax
|
||||
/// 2. f(x1) = ymax
|
||||
fn eval_bounded_line<R: Real>(x: R, x0: R, x1: R, ymax: R) -> R {
|
||||
let x = x - x0;
|
||||
let x1 = x1 - x0;
|
||||
|
Reference in New Issue
Block a user