def excite_system_K(mesh, Hx=2000): A = 1.3e-11 Ms = 8.6e5 mu0 = 4 * np.pi * 1e-7 G = A / (mu0 * Ms**2) Nx = 0 Ny = 0.4 Nz = 0.6 K = 0.5 * (Ny - Nx) * mu0 * Ms**2 Kp = -0.5 * (Nz - Ny) * mu0 * Ms**2 sim = Sim(mesh, name='dyn_K') sim.set_tols(rtol=1e-8, atol=1e-8) sim.gamma = 2.211e5 sim.Ms = Ms sim.alpha = 0.005 sim.set_m(np.load('m0.npy')) exch = UniformExchange(A=A) sim.add(exch) kx = UniaxialAnisotropy(K, axis=(1, 0, 0)) sim.add(kx) kp = UniaxialAnisotropy(Kp, axis=(0, 0, 1)) sim.add(kp) hx = Zeeman((Hx, 0, 0), name='Hx') sim.add(hx, save_field=True) ts = np.linspace(0, 5e-9, 501) for t in ts: print 'time', t sim.run_until(t)
def relax_system(mesh): A = 1.3e-11 Ms = 8.6e5 mu0 = 4 * np.pi * 1e-7 Nx = 0 Ny = 0.4 Nz = 0.6 K = 0.5 * (Ny - Nx) * mu0 * Ms**2 Kp = -0.5 * (Nz - Ny) * mu0 * Ms**2 sim = Sim(mesh, name='relax') sim.set_tols(rtol=1e-8, atol=1e-8) sim.gamma = 2.211e5 sim.Ms = Ms sim.alpha = 0.5 sim.do_procession = False sim.set_m(init_dw) exch = UniformExchange(A=A) sim.add(exch) kx = UniaxialAnisotropy(K, axis=(1, 0, 0)) sim.add(kx) kp = UniaxialAnisotropy(Kp, axis=(0, 0, 1)) sim.add(kp) sim.relax(dt=1e-14, stopping_dmdt=0.01, max_steps=5000, save_m_steps=None, save_vtk_steps=None) np.save('m0.npy', sim.spin)