Пример #1
0
 def calc(axis1_vec, axis2_vec, M_vec):
     axis1 = VectorField(mesh); axis1.fill(axis1_vec)
     axis2 = VectorField(mesh); axis2.fill(axis2_vec)
     M = VectorField(mesh); M.fill(M_vec)
     H = VectorField(mesh); H.fill((0,0,0))
     E = magneto.cubic_anisotropy(axis1, axis2, k, Ms, M, H) * mesh.cell_volume
     return H.average(), E
Пример #2
0
 def compute_uniaxial_and_cubic(state, H_aniso):
     tmp = VectorField(self.system.mesh)
     E0 = magneto.uniaxial_anisotropy(axis1, k_uni, Ms, state.M,
                                      tmp)
     E1 = magneto.cubic_anisotropy(axis1, axis2, k_cub, Ms, state.M,
                                   H_aniso)
     state.cache.E_aniso_sum = E0 + E1
     H_aniso.add(tmp)
Пример #3
0
 def calc(axis1_vec, axis2_vec, M_vec):
     axis1 = VectorField(mesh)
     axis1.fill(axis1_vec)
     axis2 = VectorField(mesh)
     axis2.fill(axis2_vec)
     M = VectorField(mesh)
     M.fill(M_vec)
     H = VectorField(mesh)
     H.fill((0, 0, 0))
     E = magneto.cubic_anisotropy(axis1, axis2, k, Ms, M,
                                  H) * mesh.cell_volume
     return H.average(), E
Пример #4
0
  def calculate(self, state, id):
    if id == "H_aniso":
      if hasattr(state.cache, "H_aniso"): return state.cache.H_aniso
      H_aniso = state.cache.H_aniso = VectorField(self.system.mesh)
      
      axis1 = self.axis1
      axis2 = self.axis2
      k_uni = self.k_uniaxial
      k_cub = self.k_cubic
      
      skip_uni = k_uni.isUniform() and k_uni.uniform_value == 0.0
      have_uni = not skip_uni
      skip_cub = k_cub.isUniform() and k_cub.uniform_value == 0.0
      have_cub = not skip_cub
  
      Ms = self.system.Ms    
  
      if   not have_uni and not have_cub:
        H_aniso.fill((0.0, 0.0, 0.0))
        state.cache.E_aniso_sum = 0.0
      elif not have_uni and have_cub:
        state.cache.E_aniso_sum = magneto.cubic_anisotropy(axis1, axis2, k_cub, Ms, state.M, H_aniso)
      elif have_uni and not have_cub:
        state.cache.E_aniso_sum = magneto.uniaxial_anisotropy(axis1, k_uni, Ms, state.M, H_aniso)
      elif have_uni and have_cub:
        tmp = VectorField(self.system.mesh)
        E0 = magneto.uniaxial_anisotropy(axis1, k_uni, Ms, state.M, tmp)
        E1 = magneto.cubic_anisotropy(axis1, axis2, k_cub, Ms, state.M, H_aniso)
        state.cache.E_aniso_sum = E0 + E1
        H_aniso.add(tmp)

      return H_aniso
  
    elif id == "E_aniso":
      if not hasattr(state.cache, "E_aniso"):
        foo = state.H_aniso
      return state.cache.E_aniso_sum * self.system.mesh.cell_volume

    else:
      raise KeyError("AnisotropyField.calculate: Can't calculate %s", id)
Пример #5
0
 def compute_cubic(state, H_aniso):
     return magneto.cubic_anisotropy(axis1, axis2, k_cub, Ms,
                                     state.M, H_aniso)
Пример #6
0
 def compute_uniaxial_and_cubic(state, H_aniso):
     tmp = VectorField(self.system.mesh)
     E0 = magneto.uniaxial_anisotropy(axis1, k_uni, Ms, state.M, tmp)
     E1 = magneto.cubic_anisotropy(axis1, axis2, k_cub, Ms, state.M, H_aniso)
     state.cache.E_aniso_sum = E0 + E1
     H_aniso.add(tmp)
Пример #7
0
 def compute_cubic(state, H_aniso):
     return magneto.cubic_anisotropy(axis1, axis2, k_cub, Ms, state.M, H_aniso)