本文整理汇总了Python中fidimag.atomistic.Sim.set_tols方法的典型用法代码示例。如果您正苦于以下问题:Python Sim.set_tols方法的具体用法?Python Sim.set_tols怎么用?Python Sim.set_tols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fidimag.atomistic.Sim
的用法示例。
在下文中一共展示了Sim.set_tols方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_skx_num
# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_tols [as 别名]
def test_skx_num():
mesh = CuboidMesh(nx=120, ny=120, nz=1, periodicity=(True, True, False))
sim = Sim(mesh, name='skx_num')
sim.set_tols(rtol=1e-6, atol=1e-6)
sim.alpha = 1.0
sim.gamma = 1.0
sim.mu_s = 1.0
sim.set_m(init_m)
sim.do_procession = False
J = 1.0
exch = UniformExchange(J)
sim.add(exch)
D = 0.09
dmi = DMI(D)
sim.add(dmi)
zeeman = Zeeman([0, 0, 5e-3])
sim.add(zeeman)
sim.relax(dt=2.0, stopping_dmdt=1e-2, max_steps=1000,
save_m_steps=None, save_vtk_steps=None)
skn = sim.skyrmion_number()
print 'skx_number', skn
assert skn > -1 and skn < -0.99
示例2: relax_system
# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_tols [as 别名]
def relax_system(mesh, Dx=0.005, Dp=0.01):
mat = UnitMaterial()
sim = Sim(mesh, name='test_energy')
print('Created sim')
sim.set_tols(rtol=1e-10, atol=1e-12)
sim.alpha = mat.alpha
sim.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.run_until(t)
print('Running -', t)
# sim.save_vtk()
np.save('m0.npy', sim.spin)
示例3: test_skx_num_atomistic
# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_tols [as 别名]
def test_skx_num_atomistic():
"""
Test the *finite spin chirality* or skyrmion number for
a discrete spins simulation in a two dimensional lattice
The expression is (PRL 108, 017601 (2012)) :
Q = S_i \dot ( S_{i+1} X S_{j+1} )
+ S_i \dot ( S_{i-1} X S_{j-1} )
which measures the chirality taking two triangles of spins
per lattice site i:
S_{i} , S_{i + x} , S_{i + y} and
S_{i} , S_{i - x} , S_{i - y}
The area of the two triangles cover a unit cell, thus the sum
cover the whole area of the atomic lattice
This test generate a skyrmion pointing down with unrealistic
paremeters.
"""
mesh = CuboidMesh(nx=120, ny=120, nz=1,
periodicity=(True, True, False))
sim = Sim(mesh, name='skx_num')
sim.set_tols(rtol=1e-6, atol=1e-6)
sim.alpha = 1.0
sim.gamma = 1.0
sim.mu_s = 1.0
sim.set_m(lambda pos: init_m(pos, 60, 60, 20))
sim.do_precession = False
J = 1.0
exch = UniformExchange(J)
sim.add(exch)
D = 0.09
dmi = DMI(D)
sim.add(dmi)
zeeman = Zeeman([0, 0, 5e-3])
sim.add(zeeman)
sim.relax(dt=2.0, stopping_dmdt=1e-2, max_steps=1000,
save_m_steps=None, save_vtk_steps=None)
skn = sim.skyrmion_number()
print('skx_number', skn)
assert skn > -1 and skn < -0.99
示例4: Constant
# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_tols [as 别名]
from fidimag.atomistic import Sim
from fidimag.common.cuboid_mesh import CuboidMesh
from fidimag.atomistic import UniformExchange, Zeeman
from fidimag.atomistic import Constant
# Import physical constants from fidimag
const = Constant()
mesh = CuboidMesh(nx=1, ny=1, dx=1, dy=1)
sim = Sim(mesh, name='relax_sk')
sim.gamma = const.gamma
sim.set_m((1, 0, 0))
sim.add(Zeeman((0, 0, 25.)))
sim.run_until(1e-11)
sim.set_tols(rtol=1e-10, atol=1e-12)
sim.run_until(2e-11)