Пример #1
0
  def setup(self):
    nf = self.norm_factor

    # Create the material for Fe2 in DyFe2 and YFe2
    # A unique material can be used because the iron moment per unit volume
    # in DyFe2 and YFe2 are the same.
    # NOTE: The demagnetising field acts as a shape anisotropy in the 1D model:
    # H_demag = -M_x which can be expressed as an uniaxial anisotropy
    #   H_demag = (2 K_1 m*u) / (mu0*M_sat)
    # where the axis u = (1, 0, 0) and K_1 = -mu0*M_sat^2/2
    # NOTE: Strictly this is wrong
    demag_Fe2 = \
      nmag.uniaxial_anisotropy(axis=[1, 0, 0],
                               K1=-self.enable_demag*0.5*mu0*self.Ms_Fe2**2)
    mat_Fe2 = \
      nmag.MagMaterial(name="Fe2",
                       Ms=self.Ms_Fe2,
                       exchange_coupling=self.A_Fe2,
                       anisotropy=demag_Fe2,
                       llg_normalisationfactor=SI(nf, "1/s"),
                       llg_damping=SI(self.damping),
                       llg_polarisation=SI(self.P),
		       llg_xi=SI(self.xi))

    # Create the material
    # the sum comes from taking the data from Jurgen's simulations
    # where the total moment in DyFe2 is given Ms_DyFe2 = Ms_Dy - Ms_Fe2
    cubic_Dy = \
      nmag.cubic_anisotropy(axis1=[1, -1, 0],
                            axis2=[1,  1, 0],
                            K1=SI(33.853774961e6, "J/m^3"),
                            K2=SI(-16.1710504363e6, "J/m^3"),
                            K3=SI(16.3584237059e6, "J/m^3"))

    demag_Dy = \
      nmag.uniaxial_anisotropy(axis=[1, 0, 0],
                               K1=-self.enable_demag*0.5*mu0*self.Ms_Dy**2)
    mat_Dy = \
      nmag.MagMaterial(name="Dy",
                       Ms=self.Ms_Dy,
                       exchange_coupling=SI(0.0e-12, "J/m"),
                       anisotropy=demag_Dy + cubic_Dy,
                       llg_normalisationfactor=SI(nf, "1/s"),
                       llg_damping=SI(self.damping),
		       llg_polarisation=0.0)

    #--------------------------------------------
    ## Here we set up the simulation

    # Create the simulation object
    sim = nmag.Simulation(self.sim_name, do_demag=False,
                          adjust_tolerances=False)

    # Set the coupling between the two magnetisations
    #sim.set_local_magnetic_coupling(mat_Fe2, mat_Dy, SI(-2.2337e-4, "N/A^2"))
    sim.set_local_magnetic_coupling(mat_Fe2, mat_Dy, self.A_lc)

    x0 = self.width_soft*0.5
    x1 = x0 + self.width_hard
    layers = [(-x1, -x0), (-x0, x0), (x0, x1)]
    mat_allocation = [("DyFe2_up", [mat_Dy, mat_Fe2]),
                      ("YFe2", mat_Fe2),
                      ("DyFe2_down", [mat_Dy, mat_Fe2])]

    # Creates the mesh from the layer structure
    if not os.path.exists(self.mesh_file_name) or self.new_mesh:
        print "Creating the mesh"
        mesh_lists = unidmesher.mesh_1d(layers, self.discretization)
        unidmesher.write_mesh(mesh_lists, out=self.mesh_file_name)
    sim.load_mesh(self.mesh_file_name, mat_allocation, unit_length=SI(1e-9, "m"))

    self.sim = sim
    return sim
Пример #2
0
    # Create the simulation object
    sim = nmag.Simulation(name, do_demag=False)

    # Load the mesh
    sim.load_mesh("bar.nmesh.h5", [("Py", mat_Py)], unit_length=SI(1e-9, "m"))

    # Set the initial magnetisation
    sim.set_m(lambda r: m_gen(np.array(r) * 1e9))
    #sim.advance_time(SI(1e-12, 's') )

    # Save the exchange field and the magnetisation once at the beginning
    # of the simulation for comparison with finmag
    np.savetxt("H_%s_nmag.txt" % name, sim.get_subfield("H_anis_Py"))
    np.savetxt("m0_nmag.txt", sim.get_subfield("m_Py"))


if __name__ == "__main__":
    # define uniaxial_anisotropy
    anis = nmag.uniaxial_anisotropy(axis=[1, 0, 0],
                                    K1=SI(520e3, "J/m^3"),
                                    K2=SI(230e3, "J/m^3"))
    generate_anisotropy_data(anis)

    cubic = nmag.cubic_anisotropy(axis1=[1, 0, 0],
                                  axis2=[0, 1, 0],
                                  K1=SI(520e3, "J/m^3"),
                                  K2=SI(230e3, "J/m^3"),
                                  K3=SI(123e3, "J/m^3"))
    generate_anisotropy_data(cubic, name='cubic_anis')
Пример #3
0
import nmag
from nmag import SI, si

# Create the simulation object
sim = nmag.Simulation()

# Define the magnetic material (data from OOMMF materials file)
Fe = nmag.MagMaterial(name="Fe",
                      Ms=SI(1700e3, "A/m"),
                      exchange_coupling=SI(21e-12, "J/m"),
                      anisotropy=nmag.cubic_anisotropy(axis1=[1, 0, 0],
                                                       axis2=[0, 1, 0],
                                                       K1=SI(48e3, "J/m^3")))

# Load the mesh
sim.load_mesh("cube.nmesh", [("cube", Fe)], unit_length=SI(1e-9, "m"))

# Set the initial magnetisation
sim.set_m([0, 0, 1])

# Launch the hysteresis loop
Hs = nmag.vector_set(direction=[1.0, 0, 0.0001],
                     norm_list=[0, 1, [], 19, 19.1, [], 21, 22, [], 50],
                     units=0.001*si.Tesla/si.mu0)
sim.hysteresis(Hs)
Пример #4
0
                   Ms=Ms_Fe2,
                   exchange_coupling=SI(14.6e-12, "J/m"),
                   anisotropy=uni_anis,
                   llg_normalisationfactor=SI(0.001e12, "1/s"),
                   llg_damping=llg_damping,
                   llg_polarisation=SI(1.0))

# Create the material
Ms_DyFe2 = SI(1.18085121013e6, "A/m")
Ms_Dy = Ms_DyFe2 + Ms_Fe2
# the sum comes from taking the data from Jurgen's simulations
# where the total moment in DyFe2 is given Ms_DyFe2 = Ms_Dy - Ms_Fe2
cubic_Dy = \
  nmag.cubic_anisotropy(axis1=[1,0,-1],
                        axis2=[1,0,1],
                        K1=SI(33.853774961e6, "J/m^3"),
                        K2=SI(-16.1710504363e6, "J/m^3"),
                        K3=SI(16.3584237059e6, "J/m^3"))

demag_Dy = nmag.uniaxial_anisotropy(axis=[1, 0, 0], K1=-0.5*mu0*Ms_Dy**2)
mat_Dy = \
  nmag.MagMaterial(name="Dy",
                   Ms=Ms_Dy,
                   exchange_coupling=SI(0.0e-12, "J/m"),
                   anisotropy=demag_Dy + cubic_Dy,
                   llg_normalisationfactor=SI(0.001e12, "1/s"),
                   llg_damping=llg_damping)

#This is the expression returned by the sampler:
#E_anis_Dy=
#    4.23260765 m_Dy(1)^8