def setup_domain_wall_cobalt(node_count=NODE_COUNT, A=A_Co, Ms=Ms_Co, K1=K1_Co, length=LENGTH, do_precession=True, unit_length=UNIT_LENGTH): a = length / node_count # cell size mesh = CuboidMesh(dx=a, dy=a, dz=a, nx=node_count, ny=1, nz=1, unit_length=unit_length) sim = Sim(mesh, "dw_cobalt") sim.Ms = Ms sim.set_m(lambda r: initial_m(r, length)) sim.do_precession = do_precession sim.add(UniformExchange(A)) sim.add(UniaxialAnisotropy(K1, (0, 0, 1))) sim.pins = lambda r: 1 if (r[0] < a or r[0] > LENGTH - a) else 0 return sim
def test_sim_pin(): mesh = CuboidMesh(nx=3, ny=2, nz=1) sim = Sim(mesh) sim.set_m((0, 0.8, 0.6)) sim.alpha = 0.1 sim.gamma = 1.0 sim.pins = pin_fun anis = UniaxialAnisotropy(Ku=1, axis=[0, 0, 1], name='Dx') sim.add(anis) sim.run_until(1.0) print sim.spin assert sim.spin[0] == 0 assert sim.spin[2] != 0
def test_sim_pin(): mesh = CuboidMesh(nx=3, ny=2, nz=1) sim = Sim(mesh, integrator='sundials_openmp') sim.set_m((0, 0.8, 0.6)) sim.alpha = 0.1 sim.driver.gamma = 1.0 sim.pins = pin_fun anis = UniaxialAnisotropy(Ku=1, axis=[0, 0, 1], name='Dx') sim.add(anis) sim.driver.run_until(1.0) print(sim.spin) assert sim.spin[0] == 0 assert sim.spin[2] != 0