本文整理汇总了Python中fidimag.micro.Sim.pins方法的典型用法代码示例。如果您正苦于以下问题:Python Sim.pins方法的具体用法?Python Sim.pins怎么用?Python Sim.pins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fidimag.micro.Sim
的用法示例。
在下文中一共展示了Sim.pins方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_domain_wall_cobalt
# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import pins [as 别名]
def setup_domain_wall_cobalt(node_count=NODE_COUNT, A=A_Co, Ms=Ms_Co, K1=K1_Co, length=LENGTH, do_precession=True, unit_length=UNIT_LENGTH):
a = length / node_count # cell size
mesh = CuboidMesh(dx=a, dy=a, dz=a, nx=node_count, ny=1, nz=1, unit_length=unit_length)
sim = Sim(mesh, "dw_cobalt")
sim.Ms = Ms
sim.set_m(lambda r: initial_m(r, length))
sim.do_precession = do_precession
sim.add(UniformExchange(A))
sim.add(UniaxialAnisotropy(K1, (0, 0, 1)))
sim.pins = lambda r: 1 if (r[0] < a or r[0] > LENGTH - a) else 0
return sim
示例2: test_sim_pin
# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.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 = UniaxialAnisotropy(Ku=1, axis=[0, 0, 1], name='Dx')
sim.add(anis)
sim.run_until(1.0)
print sim.spin
assert sim.spin[0] == 0
assert sim.spin[2] != 0
示例3: test_sim_pin
# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import pins [as 别名]
def test_sim_pin():
mesh = CuboidMesh(nx=3, ny=2, nz=1)
sim = Sim(mesh, integrator='sundials_openmp')
sim.set_m((0, 0.8, 0.6))
sim.alpha = 0.1
sim.driver.gamma = 1.0
sim.pins = pin_fun
anis = UniaxialAnisotropy(Ku=1, axis=[0, 0, 1], name='Dx')
sim.add(anis)
sim.driver.run_until(1.0)
print(sim.spin)
assert sim.spin[0] == 0
assert sim.spin[2] != 0