def excite_system(mesh): sim = Sim(mesh, name='dyn', driver='sllg') sim.set_options(dt=1e-14, gamma=const.gamma, k_B=const.k_B) sim.alpha = 0.1 sim.mu_s = const.mu_s_1 sim.T = temperature_gradient sim.set_m(np.load("m0.npy")) J = 50.0 * const.k_B exch = UniformExchange(J) sim.add(exch) D = 0.5 * J dmi = DMI(D) sim.add(dmi) Hz = 0.2 * J / const.mu_s_1 zeeman = Zeeman([0, 0, Hz]) sim.add(zeeman) dt = 2e-14 * 50 # 1e-12 ts = np.linspace(0, 1000 * dt, 501) for t in ts: sim.run_until(t) sim.save_vtk() sim.save_m() print 'sim t=%g' % t
def relax_system(mesh): sim=Sim(mesh,name='relax') sim.set_options(rtol=1e-12,atol=1e-14) sim.do_precession = False sim.alpha = 0.5 sim.gamma = 1.0 sim.mu_s = 1.0 sim.set_m(init_m) J = 1.0 exch = UniformExchange(J) sim.add(exch) D = 0.18 dmi = DMI(D) sim.add(dmi) zeeman = Zeeman([0,0e-3,2e-2],name='H') sim.add(zeeman) sim.relax(dt=2.0, stopping_dmdt=1e-8, max_steps=10000, save_m_steps=None, save_vtk_steps=100) np.save('m0.npy',sim.spin)
def excite_system(mesh): sim = Sim(mesh, name='dyn', driver='sllg') sim.set_options(dt=1e-14, gamma=const.gamma, k_B=const.k_B) sim.driver.alpha = 0.1 sim.mu_s = const.mu_s_1 sim.T = temperature_gradient sim.set_m(np.load("m0.npy")) J = 50.0 * const.k_B exch = UniformExchange(J) sim.add(exch) D = 0.5 * J dmi = DMI(D) sim.add(dmi) Hz = 0.2 * J / const.mu_s_1 zeeman = Zeeman([0, 0, Hz]) sim.add(zeeman) dt = 2e-14 * 50 # 1e-12 ts = np.linspace(0, 1000 * dt, 501) for t in ts: sim.run_until(t) sim.save_vtk() sim.save_m() print 'sim t=%g' % t
def relax_system(mesh, Hy=0): sim = Sim(mesh, name="relax") sim.set_options(rtol=1e-10, atol=1e-12) sim.alpha = 0.5 sim.gamma = 1.0 sim.mu_s = 1.0 sim.do_precession = False sim.set_m(init_m) # sim.set_m(random_m) # sim.set_m(np.load('m_10000.npy')) J = 1.0 exch = UniformExchange(J) sim.add(exch) D = 0.18 dmi = DMI(D) sim.add(dmi) zeeman = Zeeman([0, Hy, 2e-2], name="H") sim.add(zeeman) sim.relax(dt=2.0, stopping_dmdt=1e-8, max_steps=10000, save_m_steps=100, save_vtk_steps=50) np.save("m0.npy", sim.spin)
def excite_system(mesh, Hy=0): sim = Sim(mesh, name="dyn") sim.set_options(rtol=1e-10, atol=1e-12) sim.alpha = 0.04 sim.gamma = 1.0 sim.mu_s = 1.0 sim.set_m(np.load("m0.npy")) J = 1.0 exch = UniformExchange(J) sim.add(exch) D = 0.18 dmi = DMI(D) sim.add(dmi) zeeman = Zeeman([0, Hy, 2e-2], name="H") sim.add(zeeman) hx = TimeZeeman([0, 0, 1e-5], sinc_fun, name="h") sim.add(hx, save_field=True) dt = 5 steps = 2001 for i in range(steps): sim.run_until(i * dt)
def relax_system(mesh): sim = Sim(mesh, name='relax') sim.set_options(rtol=1e-12, atol=1e-14) sim.do_procession = False sim.alpha = 0.5 sim.gamma = 1.0 sim.mu_s = 1.0 sim.set_m(init_m) J = 1.0 exch = UniformExchange(J) sim.add(exch) D = 0.18 dmi = DMI(D) sim.add(dmi) zeeman = Zeeman([0, 0e-3, 2e-2], name='H') sim.add(zeeman) sim.relax(dt=2.0, stopping_dmdt=1e-8, max_steps=10000, save_m_steps=None, save_vtk_steps=100) np.save('m0.npy', sim.spin)
def excite_system(T=0.1, H=0.15): mesh = CuboidMesh(nx=28 * 3, ny=16 * 5, nz=1, pbc='2d') sim = Sim(mesh, name='dyn', driver='sllg') sim.set_options(dt=1e-14, gamma=const.gamma, k_B=const.k_B) sim.alpha = 0.1 sim.mu_s = const.mu_s_1 sim.set_m(random_m) J = 50 * const.k_B exch = UniformExchange(J) sim.add(exch) D = 0.5 * J dmi = DMI(D) sim.add(dmi) Hz = H * J / const.mu_s_1 zeeman = Zeeman([0, 0, Hz]) sim.add(zeeman) sim.T = J / const.k_B * T ts = np.linspace(0, 5e-11, 51) for t in ts: sim.run_until(t) # sim.save_vtk() np.save('m.npy', sim.spin) plot_m(mesh, 'm.npy', comp='z')
def excite_system(mesh, Hy=0): sim=Sim(mesh,name='dyn') sim.set_options(rtol=1e-10,atol=1e-12) sim.driver.alpha = 0.04 sim.driver.gamma = 1.0 sim.mu_s = 1.0 sim.set_m(np.load('m0.npy')) J = 1.0 exch = UniformExchange(J) sim.add(exch) D = 0.18 dmi = DMI(D) sim.add(dmi) zeeman = Zeeman([0,Hy,2e-2],name='H') sim.add(zeeman) hx = TimeZeeman([0,0,1e-5], sinc_fun, name='h') sim.add(hx, save_field=True) dt = 5 steps = 2001 for i in range(steps): sim.run_until(i*dt)
def relax_system(mesh, Hy=0): sim=Sim(mesh,name='relax') sim.set_options(rtol=1e-10,atol=1e-12) sim.driver.alpha = 0.5 sim.driver.gamma = 1.0 sim.mu_s = 1.0 sim.do_precession = False sim.set_m(init_m) #sim.set_m(random_m) #sim.set_m(np.load('m_10000.npy')) J = 1.0 exch = UniformExchange(J) sim.add(exch) D = 0.18 dmi = DMI(D) sim.add(dmi) zeeman = Zeeman([0,Hy,2e-2],name='H') sim.add(zeeman) sim.relax(dt=2.0, stopping_dmdt=1e-8, max_steps=10000, save_m_steps=100, save_vtk_steps=50) np.save('m0.npy',sim.spin)
def test_sim_single_spin_sllg(do_plot=False): mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='spin', driver='sllg') alpha = 0.1 gamma = 2.21e5 sim.set_options(dt=5e-15, gamma=gamma) sim.alpha = alpha sim.mu_s = 1.0 sim.set_m((1, 0, 0)) H0 = 1e5 sim.add(Zeeman((0, 0, H0))) ts = np.linspace(0, 1e-10, 101) mx = [] my = [] mz = [] real_ts = [] for t in ts: sim.run_until(t) real_ts.append(sim.t) print(sim.t, abs(sim.spin_length()[0] - 1)) mx.append(sim.spin[0]) my.append(sim.spin[1]) mz.append(sim.spin[2]) mz = np.array(mz) a_mx, a_my, a_mz = single_spin(alpha, gamma, H0, ts) if do_plot: plot(real_ts, mx, my, mz, a_mx, a_my, a_mz, name='spin_sllg.pdf', title='integrating a spin') print(("Max Deviation = {0}".format(np.max(np.abs(mz - a_mz))))) assert np.max(np.abs(mz - a_mz)) < 1e-8
def relax_system(rtol=1e-10, atol=1e-12): """numerical solution""" mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name="relax") sim.set_options(rtol=rtol, atol=atol) sim.alpha = 0.5 sim.gamma = 2.21e5 sim.mu_s = 1.0 sim.set_m((1.0, 0, 0)) sim.add(Zeeman((0, 0, 1e5))) ts = np.linspace(0, 1e-9, 1001) for t in ts: sim.run_until(t)
def relax_system(rtol=1e-10, atol=1e-12): """numerical solution""" mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.set_options(rtol=rtol, atol=atol) sim.alpha = 0.5 sim.gamma = 2.21e5 sim.mu_s = 1.0 sim.set_m((1.0, 0, 0)) sim.add(Zeeman((0, 0, 1e5))) ts = np.linspace(0, 1e-9, 1001) for t in ts: sim.run_until(t)
def test_sim_single_spin_sllg(do_plot=False): mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='spin', driver='sllg') alpha = 0.1 gamma = 2.21e5 sim.set_options(dt=5e-15, gamma=gamma) sim.alpha = alpha sim.mu_s = 1.0 sim.set_m((1, 0, 0)) H0 = 1e5 sim.add(Zeeman((0, 0, H0))) ts = np.linspace(0, 1e-10, 101) mx = [] my = [] mz = [] real_ts = [] for t in ts: sim.run_until(t) real_ts.append(sim.t) print(sim.t, abs(sim.spin_length()[0] - 1)) mx.append(sim.spin[0]) my.append(sim.spin[1]) mz.append(sim.spin[2]) mz = np.array(mz) a_mx, a_my, a_mz = single_spin(alpha, gamma, H0, ts) if do_plot: plot(real_ts, mx, my, mz, a_mx, a_my, a_mz, name='spin_sllg.pdf', title='integrating a spin') print(("Max Deviation = {0}".format( np.max(np.abs(mz - a_mz))))) assert np.max(np.abs(mz - a_mz)) < 1e-8