def test_compute_skyrmion_number_2d_pbc(): mesh = df.RectangleMesh(df.Point(0, 0), df.Point(100, 100), 40, 40) Ms = 8.6e5 sim = Simulation(mesh, Ms, pbc='2d', unit_length=1e-9) sim.set_m(init_skx_down) sim.add(Exchange(1.3e-11)) sim.add(DMI(D=4e-3)) sim.add(Zeeman((0, 0, 0.45 * Ms))) sim.do_precession = False sim.relax(stopping_dmdt=1, dt_limit=1e-9) #df.plot(sim.m_field.f) #df.interactive() print np.max(sim.m_field.as_array()) sky_num = compute_skyrmion_number_2d(sim.m_field.f) print 'sky_num = %g' % sky_num assert sky_num < -0.95 and sky_num > -1.0
def run_simulation(do_precession): Ms = 0.86e6 mesh = df.BoxMesh(df.Point(0, 0, 0), df.Point(30e-9, 30e-9, 100e-9), 6, 6, 20) sim = Simulation(mesh, Ms) sim.set_m((1, 0, 1)) sim.do_precession = do_precession sim.add(Demag()) sim.add(Exchange(13.0e-12)) averages = [] for t in ts: sim.run_until(t) averages.append(sim.m_average) return np.array(averages)
def compute_skyrmion_number_2d_example(): mesh = df.CircleMesh(df.Point(0, 0), 20, 4) Ms = 3.84e5 mu0 = 4 * np.pi * 1e-7 Hz = 0.2 sim = Simulation(mesh, Ms, unit_length=1e-9, name='sim') sim.do_precession = False sim.set_m(init_skx_down) sim.add(Exchange(8.78e-12)) sim.add(DMI(-1.58e-3)) sim.add(Zeeman((0, 0, Hz / mu0))) sim.relax(stopping_dmdt=1, dt_limit=1e-9) #sim.m_field.plot_with_dolfin(interactive=True) print compute_skyrmion_number_2d(sim.m_field.f)
return (np.sin(k * r) * np.cos(phi), np.sin(k * r) * np.sin(phi), -np.cos(k * r)) else: return (0, 0, 1) sim.set_m(m_init) # ----------------------------------------------------------------------------- # Exchange Energy sim.add(Exchange(A)) # DMI sim.add(DMI(D, dmi_type='bulk')) # Add the corresponding Zeeman field sim.add(Zeeman((0, 0, B / mu0))) # ----------------------------------------------------------------------------- sim.do_precession = False sim.alpha = 0.9 if os.path.exists('vtks'): shutil.rmtree('vtks') os.mkdir('vtks') sim.save_vtk(filename='vtks/m.pvd'.format(0)) sim.relax() sim.save_vtk(filename='vtks/m.pvd'.format(1)) sim.save_field('m', 'm_relaxed.npy', overwrite=True)