Exemple #1
0
    r[0] = ca*x - sa*y
    r[1] = sa*x + ca*y
    return r

# Calculate the size of the container: we make it extra big, for now we don't
# care (there is also a bug now which make it preferable)
container_size = pb.sx*1.5 #(pb.sx*pb.sx + pb.sy*pb.sy)**0.5
container_discr = int(float(container_size/pb.dx_dy))

mat_Py = MagMaterial(name='Py',
                     Ms=SI(0.86e6, 'A/m'),
                     exchange_coupling=SI(13.0e-12, 'J/m'),
                     llg_damping=0.2,
                     do_precession=True)

s = FDSimulation()
s.set_params(stopping_dm_dt=1*degrees_per_ns,
             ts_rel_tol=1e-1, ts_abs_tol=1e-1)

m = SI('m')
half_sx_m = 0.5*float(pb.sx/m)
half_sy_m = 0.5*float(pb.sy/m)
def film(pos):
    x, y, _ = rotate(pos, -pb.angle)
    if (x >= -half_sx_m and x <= half_sx_m and
        y >= -half_sy_m and y <= half_sy_m):
        return 'magnetic'

    else:
        return None
Exemple #2
0
import nmag, nsim
from nmag import SI, at, every
from nmag.fdsimulation import FDSimulation, MagMaterial
from nmag.constants import degrees_per_ns
import os

mat_Py = MagMaterial(name='Py',
                     Ms=SI(0.86e6, 'A/m'),
                     exchange_coupling=SI(13.0e-12, 'J/m'))

s = FDSimulation(do_demag=True)
s.set_params(stopping_dm_dt=20*degrees_per_ns)

nm = SI(1e-9, "m")
def rectangle(pos):
#    if (pos[0] >=10e-9 and pos[0] <= 20e-9 and 
#       pos[1] >=10e-9 and pos[1] <= 20e-9):
        return 'magnetic' 
#    else:
#        return None

s.create_mesh([5, 5, 1], [5.0*nm, 5.0*nm, 3.0*nm], mat_Py,regions=rectangle)
    
s.set_m([1, 1, 1])

Hs = nmag.vector_set(direction=[1.0, 1.0, 1.0],
                     norm_list=[1.00, 0.95, [], 0.1, 0.09, [],
                                -0.1, -0.15, [], -1.00],
                     units=1e6*SI('A/m'))

s.hysteresis(Hs, save=[('field_m', at('time', SI(0, 's')) | at('convergence'))])