本文整理汇总了Python中fidimag.atomistic.Sim.pins方法的典型用法代码示例。如果您正苦于以下问题:Python Sim.pins方法的具体用法?Python Sim.pins怎么用?Python Sim.pins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fidimag.atomistic.Sim
的用法示例。
在下文中一共展示了Sim.pins方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: relax_system
# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import pins [as 别名]
def relax_system(mesh, Dx=0.005, Dp=0.01):
mat = UnitMaterial()
sim = Sim(mesh, name='test_energy')
print('Created sim')
sim.driver.set_tols(rtol=1e-10, atol=1e-12)
sim.alpha = mat.alpha
sim.driver.gamma = mat.gamma
sim.pins = pin_fun
exch = UniformExchange(mat.J)
sim.add(exch)
print('Added UniformExchange')
anis = Anisotropy(Dx, axis=[1, 0, 0], name='Dx')
sim.add(anis)
print('Added Anisotropy')
anis2 = Anisotropy([0, 0, -Dp], name='Dp')
sim.add(anis2)
print('Added Anisotropy 2')
sim.set_m((1, 1, 1))
T = 100
ts = np.linspace(0, T, 201)
for t in ts:
# sim.save_vtk()
sim.driver.run_until(t)
print(('Running -', t))
# sim.save_vtk()
np.save('m0.npy', sim.spin)
示例2: test_sim_pin
# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import pins [as 别名]
def test_sim_pin():
mesh = CuboidMesh(nx=3, ny=2, nz=1)
sim = Sim(mesh)
sim.set_m((0, 0.8, 0.6))
sim.alpha = 0.1
sim.gamma = 1.0
sim.pins = pin_fun
anis = Anisotropy(Ku=1.0, axis=[0, 0, 1], name='Dx')
sim.add(anis)
sim.run_until(1.0)
assert sim.spin[0] == 0
assert sim.spin[2] != 0