当前位置: 首页>>代码示例>>Python>>正文


Python Sim.set_tols方法代码示例

本文整理汇总了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
开发者ID:River315,项目名称:fidimag,代码行数:33,代码来源:test_sky_number.py

示例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)
开发者ID:River315,项目名称:fidimag,代码行数:37,代码来源:test_energy.py

示例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
开发者ID:fangohr,项目名称:fidimag,代码行数:55,代码来源:test_skyrmion_number.py

示例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)
开发者ID:River315,项目名称:fidimag,代码行数:20,代码来源:skyrmion.py


注:本文中的fidimag.atomistic.Sim.set_tols方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。