mat_Py = nmag.MagMaterial(name="Py", Ms=SI(1e6,"A/m"), exchange_coupling=SI(13.0e-12, "J/m") ) #sim = nmag.Simulation() sim = nmag.Simulation(ddd_use_linalg_machine=True) sim.set_H_ext([0,0,0],SI(1,"A/m")) meshfile = os.path.join("barmini.nmesh.h5") if os.path.exists(meshfile): sim.load_mesh(meshfile, [("PyX", mat_Py)],unit_length=SI(1e-9,"m")) else: sim.defregion("Py", mesh.box([0.0,0.0,0.0], [20, 20, 80]), mat_Py) mesh = sim.generate_mesh(([0.0,0.0,0.0],[20.0,20.0,80.0]), # bounding box a0=4.0, max_steps=10, unit_length=SI(1e-9,"m") ) mesh.save(meshfile) def initial_magnetization(xyz, mag_type): import math return [math.cos(xyz[2]),math.sin(xyz[2]),0.0] sim.set_magnetization(initial_magnetization) for i in range(1,100):
mesh_length = SI(1e-9, "m") raw_mesh = None mat_Py = nmag.MagMaterial(name="Py", Ms=SI(1e6, "A/m"), exchange_coupling=SI(13.0e-12, "J/m")) sim = nmag.Simulation(ddd_use_linalg_machine=True) meshfile = os.path.join("barmini.nmesh.h5") if os.path.exists(meshfile): sim.load_mesh(meshfile, [("PyX", mat_Py)], unit_length=SI(1e-9, "m")) else: sim.defregion("Py", mesh.box([0.0, 0.0, 0.0], [5, 5, 10]), mat_Py) mesh = sim.generate_mesh( ([-0.0, -0, -0.0], [5.0, 5.0, 10.0]), # bounding box a0=2, max_steps=2000, unit_length=mesh_length) mesh.save(meshfile) if ocaml.petsc_mpi_nr_nodes() > 1: raw_mesh = sim.mesh.raw_mesh print "*** RAW MESH *** ", raw_mesh ocaml.mesh_set_vertex_distribution(raw_mesh, [100, 69]) sim._init_postmesh() sim.set_H_ext([0, 0, 0], SI(1, "A/m"))
mat_Py = nmag.MagMaterial(name="Py", Ms=SI(1e6, "A/m"), exchange_coupling=SI(13.0e-12, "J/m")) #sim = nmag.Simulation() sim = nmag.Simulation(ddd_use_linalg_machine=True) sim.set_H_ext([0, 0, 0], SI(1, "A/m")) meshfile = os.path.join("barmini.nmesh.h5") if os.path.exists(meshfile): sim.load_mesh(meshfile, [("PyX", mat_Py)], unit_length=SI(1e-9, "m")) else: sim.defregion("Py", mesh.box([0.0, 0.0, 0.0], [20, 20, 80]), mat_Py) mesh = sim.generate_mesh( ([0.0, 0.0, 0.0], [20.0, 20.0, 80.0]), # bounding box a0=4.0, max_steps=10, unit_length=SI(1e-9, "m")) mesh.save(meshfile) def initial_magnetization(xyz, mag_type): import math return [math.cos(xyz[2]), math.sin(xyz[2]), 0.0] sim.set_magnetization(initial_magnetization)
raw_mesh=None mat_Py = nmag.MagMaterial(name="Py", Ms=SI(1e6,"A/m"), exchange_coupling=SI(13.0e-12, "J/m") ) sim = nmag.Simulation(ddd_use_linalg_machine=True) meshfile = os.path.join("barmini.nmesh.h5") if os.path.exists(meshfile): sim.load_mesh(meshfile, [("PyX", mat_Py)],unit_length=SI(1e-9,"m")) else: sim.defregion("Py", mesh.box([0.0,0.0,0.0], [5, 5, 10]), mat_Py) mesh = sim.generate_mesh(([-0.0,-0,-0.0],[5.0,5.0,10.0]), # bounding box a0=2, max_steps=2000, unit_length=mesh_length ) mesh.save(meshfile) if ocaml.petsc_mpi_nr_nodes()>1: raw_mesh=sim.mesh.raw_mesh print "*** RAW MESH *** ",raw_mesh ocaml.mesh_set_vertex_distribution(raw_mesh,[100,69]) sim._init_postmesh() sim.set_H_ext([0,0,0],SI(1,"A/m"))