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

    sys.exit(0)

initial_m_file = "m0.h5"
main_done_file = "main_done"
preliminary_done_file = "preliminary_done"

all_done = True
for geom, j in values_of_geom_and_j:
    dn = directory_name(geom, j)
    this_main_done_file = os.path.join(dn, main_done_file)
    this_preliminary_done_file = os.path.join(dn, preliminary_done_file)
    this_initial_m_file = os.path.join(dn, initial_m_file)
    main_done = os.path.exists(this_main_done_file)
    preliminary_done = os.path.exists(this_preliminary_done_file)
Ejemplo n.º 4
0
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):
  c = float(nm/SI('m'))
  def setter(sim):
    def H_ext(r):