Download NMAG User Manual (0.1 Beta version)

Transcript
sim.load_mesh("periodic.nmesh", [("periodic-film", Py)], unit_length=SI(1e-9,"m") )
print ocaml.mesh_plotinfo_periodic_points_indices( sim.mesh.raw_mesh )
# function to set the magnetisation
def perturbed_magnetisation(pos):
x,y,z = pos
newx = x*1e9
newy = y*1e9
if 8<newx<14 and -3<newy<3:
# the magnetisation is twisted a bit
return [1.0, 5.*(math.cos(math.pi*((newx-11)/6.)))**3 *\
(math.cos(math.pi*(newy/6.)))**3, 0.0]
else:
return [1.0, 0.0, 0.0]
# set initial magnetisation
sim.set_m(perturbed_magnetisation)
# let the system relax generating spin waves
s = SI(1,"s")
from nsim.when import every, at
sim.relax(save=[(’averages’,’fields’, every(’time’,0.05e-12*s) | at(’convergence’))])
To execute this script, we call the nsim executable, for example (on linux):
$ nsim spinwaves.py
As in the previous examples, we first need to import the modules necessary for the simulation, define the material
of the magnetic object, load the mesh and set the initial configuration of the magnetisation. Here, we start from a
spatially non-homogeneous configuration in order to excite spin waves. Nmag allows us to provide a function to be
sampled on the mesh that defines a particular magnetisation configuration.
In our case, we use the function
def perturbed_magnetisation(pos):
x,y,z = pos
newx = x*1e9
newy = y*1e9
if 8<newx<14 and -3<newy<3:
75