Example #1
0
                     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'))])

# Process the results
NCOL=os.path.join(os.path.dirname(os.path.abspath(nmag.__file__)), "../../bin/ncol")
os.system(NCOL + " run_fdsimulation H_ext_0 H_ext_1 H_ext_2   M_Py_0 M_Py_1 M_Py_2 > fd.dat")
os.system("gnuplot plot.gnp")

Example #2
0
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

s.create_mesh([container_discr, container_discr, pb.nz],
              [pb.dx_dy, pb.dx_dy, pb.dz],
              mat_Py, regions=film,
              origin=(pb.sx*0.5, pb.sy*0.5, pb.sz*0.5))

s.set_m(pb.m0)

Hs = nmag.vector_set(direction=rotate([0.0, 1.0, 0.0], pb.angle),
                     norm_list=[0.0, 0.0015, 0.003, 0.004,
                                0.0045, 0.0001, 0.0065],
                     units=1e6*SI('A/m'))

reference_mz = []
def check_switching_field(s):
    m = s.get_subfield_average('m')
    mz = abs(m[2])
    if len(reference_mz) == 0:
        reference_mz.append(mz)

    else:
        (mz0, ) = reference_mz
Example #3
0
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"))])

# Process the results
NCOL = os.path.join(os.path.dirname(os.path.abspath(nmag.__file__)), "../../bin/ncol")
os.system(NCOL + " run_fdsimulation H_ext_0 H_ext_1 H_ext_2   M_Py_0 M_Py_1 M_Py_2 > fd.dat")
os.system("gnuplot plot.gnp")