/* Test if the stepper cache buffers are flushed when starting a new run */ setgridsize(1,1,1) setcellsize(1,1,1) msat = 1000e3 alpha = 0.1 aex=10e-12 B_ext = vector(0, 0, 0.05) setsolver(5) // This steppers uses a cache buffer fixdt = 1e-12 m = uniform(1,0,0) t=0 step=0 //uncomment these to force single step if using unmodified minimize.go //Minimizerstop=1; //Minimizersamples=1; Minimize() print(t, step, Torque,m.average()) rotation_wanted := acos( vector(1,0,0).dot(m.average()) ) print(rotation_wanted) print(neval) m = uniform(-1,0,0) t=0 step=0 //uncomment these to force single step if using unmodified minimize.go //Minimizerstop=1; //Minimizersamples=1; Minimize() print(t, step, Torque,m.average()) rotation := acos( vector(-1,0,0).dot(m.average()) ) print(rotation) print(neval) // Note that the rotation angle should be the same for the two cases for symmetry reasons. // However, if the cache buffers are not removed, this will lead to an erroneous result in // the second case. expect("m rotation angle", rotation, rotation_wanted, 1e-5)