def relax_system(): mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.set_tols(rtol=1e-10, atol=1e-10) sim.alpha = 0.1 sim.set_m((0, 0, 1)) sim.add(Zeeman((0, 0, 1e5))) w0 = 2 * np.pi * 1e9 def sin_fun(t): return np.sin(w0 * t) h0 = 1e3 theta = np.pi / 20 hx = h0 * np.sin(theta) hz = h0 * np.cos(theta) hx = TimeZeeman([hx, 0, hz], sin_fun, name='h') sim.add(hx, save_field=True) ts = np.linspace(0, 5e-9, 5001) for t in ts: sim.run_until(t)
def apply_field1(mesh): sim = Sim(mesh, name='dyn') sim.set_tols(rtol=1e-10, atol=1e-10) sim.alpha = 0.02 sim.gamma = 2.211e5 sim.Ms = 8.0e5 sim.set_m(np.load('m0.npy')) A = 1.3e-11 exch = UniformExchange(A=A) sim.add(exch) demag = Demag() sim.add(demag) mT = 0.001 / mu0 print mT zeeman = Zeeman([-24.6 * mT, 4.3 * mT, 0], name='H') sim.add(zeeman, save_field=True) ts = np.linspace(0, 1e-9, 201) for t in ts: sim.run_until(t) print 'sim t=%g' % t
def relax_system(): mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.driver.set_tols(rtol=1e-10, atol=1e-10) sim.driver.alpha = 0.1 sim.set_m((0, 0, 1)) sim.add(Zeeman((0, 0, 1e5))) w0 = 2 * np.pi * 1e9 def sin_fun(t): return np.sin(w0 * t) h0 = 1e3 theta = np.pi / 20 hx = h0 * np.sin(theta) hz = h0 * np.cos(theta) hx = TimeZeeman([hx, 0, hz], sin_fun, name='h') sim.add(hx, save_field=True) ts = np.linspace(0, 5e-9, 5001) for t in ts: sim.run_until(t)
def apply_field1(mesh): sim = Sim(mesh, name="dyn") sim.set_tols(rtol=1e-10, atol=1e-10) sim.alpha = 0.02 sim.gamma = 2.211e5 sim.Ms = 8.0e5 sim.set_m(np.load("m0.npy")) A = 1.3e-11 exch = UniformExchange(A=A) sim.add(exch) demag = Demag() sim.add(demag) mT = 0.001 / mu0 print mT zeeman = Zeeman([-24.6 * mT, 4.3 * mT, 0], name="H") sim.add(zeeman, save_field=True) ts = np.linspace(0, 1e-9, 201) for t in ts: sim.run_until(t) print "sim t=%g" % t
def relax_system(): mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.set_tols(rtol=1e-10, atol=1e-10) sim.alpha = 0.5 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(): mesh = CuboidMesh(nx=1, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.driver.set_tols(rtol=1e-10, atol=1e-10) sim.driver.alpha = 0.5 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 excite_system(mesh): # Specify the stt dynamics in the simulation sim = Sim(mesh, name='dyn', driver='llg_stt') sim.set_tols(rtol=1e-12, atol=1e-14) sim.alpha = 0.05 sim.gamma = 2.211e5 sim.Ms = 8.6e5 # sim.set_m(init_m) sim.set_m(np.load('m0.npy')) # Energies A = 1.3e-11 exch = UniformExchange(A=A) sim.add(exch) anis = UniaxialAnisotropy(5e4) sim.add(anis) # dmi = DMI(D=8e-4) # sim.add(dmi) # Set the current in the x direction, in A / m # beta is the parameter in the STT torque sim.jx = -1e12 sim.beta = 1 # The simulation will run for 5 ns and save # 500 snapshots of the system in the process ts = np.linspace(0, 5e-9, 501) for t in ts: print 'time', t sim.run_until(t) sim.save_vtk() sim.save_m()
def excite_system(mesh): sim = Sim(mesh, name='dyn') sim.set_tols(rtol=1e-10, atol=1e-14) sim.alpha = 0.01 sim.gamma = 2.211e5 sim.Ms = spatial_Ms # sim.set_m(init_m) sim.set_m(np.load('m0.npy')) A = 1.3e-11 exch = UniformExchange(A=A) sim.add(exch) demag = Demag() sim.add(demag) mT = 795.7747154594767 sigma = 0.08e-9 def gaussian_fun(t): return np.exp(-0.5 * (t / sigma)**2) zeeman = TimeZeeman((80 * mT, 0, 0), time_fun=gaussian_fun, name='hx') #zeeman = Zeeman((100*mT,0,0), name='hx') sim.add(zeeman, save_field=True) ts = np.linspace(0, 1e-9, 501) for t in ts: print 'time', t print 'length:', sim.spin_length()[0:200] sim.run_until(t) sim.save_vtk()