Example #1
0
def setup_simulation(name, damping, demag_tol=1.0, pc_tol=1.0):
    '''Script to create the simulation object (to be used both for relaxation
    and for the dynamics).'''
    mat_Py = MagMaterial(name="Py",
                         Ms=SI(0.8e6,"A/m"),
                         exchange_coupling=SI(13.0e-12, "J/m"),
                         llg_damping=damping,
                         llg_gamma_G=SI(0.221e6, "m/A s")) 

    ksp_tols = {"DBC.rtol":1e-5*demag_tol,
                "DBC.atol":1e-5*demag_tol,
                "DBC.maxits":1000000,
                "NBC.rtol":1e-5*demag_tol,
                "NBC.atol":1e-5*demag_tol,
                "NBC.maxits":1000000,
                "PC.rtol":1e-2*pc_tol,
                "PC.atol":1e-7*pc_tol,
                "PC.maxits":1000000}
    sim = Simulation(name, ksp_tolerances=ksp_tols,
                     phi_BEM=default_hmatrix_setup)

    sim.load_mesh("disk.nmesh.h5", [("Py", mat_Py)], unit_length=1*nm)
    return sim
Example #2
0
import nmag, nsim
from nmag import SI, at, every
from nmag import Simulation, MagMaterial
from nmag.constants import degrees_per_ns

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

s = Simulation(do_demag=True)
s.set_params(stopping_dm_dt=1 * degrees_per_ns)

s.load_mesh("film.nmesh.h5", [('Py', mat_Py)], unit_length=SI(1e-9, 'm'))

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=[('averages', at('convergence'))])
Example #3
0
    cos_alpha = math.cos(alpha)
    return [sin_alpha, -cos_alpha*sin_theta, cos_alpha*cos_theta]

# Pinning at the borders
def pinning(p):
    x = float(SI(p[0], "m")/(hl*unit_length))
    if abs(x) >= 0.999:
        return 0.0
    else:
        return 1.0

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

s = Simulation()

s.load_mesh(run.get_mesh_file_name(),
            [('region1', mat_Py)],
            unit_length=unit_length)

s.set_m(m0)

s.set_pinning(pinning)

s.relax(save=[('fields', at('time', SI(0, 's')) | at('convergence'))])

s.set_m(m1)
s.relax(save=[('fields', at('stage_time', SI(0, 's'))
                         | at('convergence'))])
Example #4
0
import nmag, nsim
from nmag import SI, at, every
from nmag import Simulation, MagMaterial
from nmag.constants import degrees_per_ns

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

s = Simulation(do_demag=True)
s.set_params(stopping_dm_dt=1*degrees_per_ns)

s.load_mesh("film.nmesh.h5", [('Py', mat_Py)], unit_length=SI(1e-9, 'm'))

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=[('averages', at('convergence'))])