Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 3
0
        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$;

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

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

        tlo hl;
	tlo sl;
	tlo hc;
	tlo sr;
	tlo hr;
        """)
        print "Creating mesh file '%s'" % mesh_name
        nm.save(mesh_name)
Ejemplo n.º 4
0
######

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])


s = nmag.Simulation(['rlx', 'dyn'][relaxed])

s.load_mesh(mesh_filename, [('bar', permalloy)], unit_length=1*nm)

def set_disturbance(is_on):