Exemplo n.º 1
0
def mesh_from_state(state, mesh_file_name):
    state["hl"]  = 0.5*state["nanopillar_length"]
    state["hsy"] = 0.5*state["nanopillar_side_y"]
    state["hsz"] = 0.5*state["nanopillar_side_z"]
    geo = """
    algebraic3d

    solid nanopillar = orthobrick (-$hl$, -$hsy$, -$hsz$; $hl$, $hsy$, $hsz$)
                       -maxh=$discretization$;
    tlo nanopillar;
    """

    from nsim.netgen import NetgenMesh
    nm = NetgenMesh()
    nm.set_vars(state)
    nm.geo(geo)
    nm.save(mesh_file_name)
Exemplo n.º 2
0
def mesh_from_state(state, mesh_file_name):
    state["hl"] = 0.5 * state["nanopillar_length"]
    geo = """
    algebraic3d
    solid nanopillar = cylinder (-$hl$, 0, 0; $hl$, 0, 0; $nanopillar_radius$)
                       and plane (-$hl$, 0, 0; -1, 0, 0)
                       and plane ( $hl$, 0, 0;  1, 0, 0)
                       -maxh=$discretization$;
    tlo nanopillar;
    """

    from nsim.netgen import NetgenMesh

    nm = NetgenMesh()
    nm.set_vars(state)
    nm.geo(geo)
    nm.save(mesh_file_name)
Exemplo n.º 3
0
    mn = mesh_name(geom)
    if not os.path.exists(os.path.join(mesh_directory, mn)):
        required_meshes[geom] = mn

if len(required_meshes) != 0:
    print "Some meshes need to be created..."
    from nsim.netgen import NetgenMesh
    os.chdir(mesh_directory)
    for geom in required_meshes:
        mesh_name = required_meshes[geom]
        sl, hl, hc, r = geom
        w = 2*sl + 2*hl + hc
        x2 = 0.5*w
        x1 = x2 - hl
        x0 = x1 - sl
        nm = NetgenMesh()
        nm.set_vars({'x0': x0, 'x1':x1, 'x2':x2, 'r':r, 'maxh':discretization})
        nm.geo("""
        algebraic3d
        solid hc = cylinder (-$x0$, 0, 0; $x0$, 0, 0; $r$)
                   and plane (-$x0$, 0, 0; -1, 0, 0)
                   and plane ( $x0$, 0, 0;  1, 0, 0) -maxh=$maxh$;

        solid hl = cylinder (-$x1$, 0, 0; -$x2$, 0, 0; $r$)
                   and plane (-$x2$, 0, 0; -1, 0, 0)
                   and plane (-$x1$, 0, 0;  1, 0, 0) -maxh=$maxh$;

        solid hr = cylinder ($x1$, 0, 0; $x2$, 0, 0; $r$)
                   and plane ($x1$, 0, 0; -1, 0, 0)
                   and plane ($x2$, 0, 0;  1, 0, 0) -maxh=$maxh$;
Exemplo n.º 4
0
disturb_duration = 1*ps

# Name of the file which will contain the relaxed magnetisation
m0_filename = 'm0.h5'

######

relaxed = os.path.exists(m0_filename)
if not os.path.exists(mesh_filename):
  relaxed = False
  vars = {'bar_length': bar_length, 
          'bar_crossec1': bar_crossec1, 
          'bar_crossec2': bar_crossec2,
          'discretisation': discretisation}

  m = NetgenMesh()
  m.set_vars(vars)
  m.geo("""
algebraic3d
solid bar = orthobrick (0, 0, 0; $bar_length$, $bar_crossec1$, $bar_crossec2$)
            -maxh = $discretisation$;
tlo bar;
  """)
  m.save(mesh_filename)

permalloy = nmag.MagMaterial('Py',
                             Ms=SI(0.86e6, 'A/m'),
                             exchange_coupling=SI(13e-12, 'J/m'),
                             llg_damping=[0.5, 0.02][relaxed])