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


Python Sim.relax方法代码示例

本文整理汇总了Python中fidimag.micro.Sim.relax方法的典型用法代码示例。如果您正苦于以下问题:Python Sim.relax方法的具体用法?Python Sim.relax怎么用?Python Sim.relax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fidimag.micro.Sim的用法示例。


在下文中一共展示了Sim.relax方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: relax_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, chi=1e-3, name='relax', driver='llbar_full')

    sim.driver.set_tols(rtol=1e-7, atol=1e-7)
    sim.Ms = 8.0e5
    sim.driver.alpha = 0.1
    sim.beta = 0
    sim.driver.gamma = 2.211e5

    sim.set_m((1, 0.25, 0.1))
    # sim.set_m(np.load('m0.npy'))

    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

    mT = 795.7747154594767
    zeeman = Zeeman([-100 * mT, 4.3 * mT, 0], name='H')
    sim.add(zeeman, save_field=True)

    demag = Demag()
    sim.add(demag)

    ONE_DEGREE_PER_NS = 17453292.52

    sim.relax(dt=1e-12, stopping_dmdt=0.01,
              max_steps=5000, save_m_steps=100, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:32,代码来源:relax_system.py

示例2: relax_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, name='relax')

    sim.driver.set_tols(rtol=1e-6, atol=1e-6)
    sim.driver.alpha = 0.5
    sim.driver.gamma = 2.211e5
    sim.Ms = 8.6e5
    sim.do_precession = False

    sim.set_m(init_m)

    exch = UniformExchange(A=1.3e-11)
    sim.add(exch)

    dmi = DMI(D=-4e-3)
    sim.add(dmi)

    zeeman = Zeeman((0, 0, 4e5))
    sim.add(zeeman, save_field=True)

    sim.relax(dt=1e-13, stopping_dmdt=1e-2,
              save_m_steps=None, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:27,代码来源:main.py

示例3: relax_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, name="relax")

    sim.driver.set_tols(rtol=1e-10, atol=1e-14)
    sim.driver.alpha = 0.5
    sim.driver.gamma = 2.211e5
    sim.Ms = 8.6e5
    sim.do_precession = False

    sim.set_m(init_m)
    # sim.set_m(np.load('m0.npy'))

    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

    dmi = DMI(D=1e-3)
    sim.add(dmi)

    zeeman = Zeeman((0, 0, 2e4))
    sim.add(zeeman, save_field=True)

    sim.relax(dt=1e-13, stopping_dmdt=0.01, max_steps=5000, save_m_steps=None, save_vtk_steps=50)

    np.save("m0.npy", sim.spin)
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:28,代码来源:main.py

示例4: test_dw_dmi

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def test_dw_dmi(mesh=mesh, do_plot=False):

    Ms = 8.0e5
    sim = Sim(mesh, name='relax')

    sim.set_m(m_init_dw)

    sim.set_tols(rtol=1e-8, atol=1e-12)
    sim.Ms = Ms
    sim.alpha = 0.5
    sim.do_procession = False

    A = 1.3e-11
    D = 4e-4
    Kx = 8e4
    Kp = -6e5

    sim.add(UniformExchange(A))
    sim.add(DMI(D))
    sim.add(UniaxialAnisotropy(Kx, axis=[1, 0, 0], name='Kx'))

    sim.relax(stopping_dmdt=0.01)

    xs = np.array([p[0] for p in mesh.coordinates])
    mx, my, mz = analytical(xs, A=A, D=D, K=Kx)
    mxyz = sim.spin.copy()
    mxyz = mxyz.reshape(-1, 3)

    assert max(abs(mxyz[:, 0] - mx)) < 0.002
    assert max(abs(mxyz[:, 1] - my)) < 0.002
    assert max(abs(mxyz[:, 2] - mz)) < 0.0006

    if do_plot:

        save_plot(mxyz, mx, my, mz)
开发者ID:River315,项目名称:fidimag,代码行数:37,代码来源:test_dw_dmi.py

示例5: relax_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, name='relax')

    sim.set_tols(rtol=1e-6, atol=1e-6)
    sim.alpha = 0.5
    sim.gamma = 2.211e5
    sim.Ms = 8.6e5
    sim.do_precession = False

    sim.set_m(init_m)
    #sim.set_m((0,0.1,1))
    #sim.set_m(np.load('m0.npy'))

    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

    dmi = DMI(D=1.3e-3)
    sim.add(dmi)

    anis = UniaxialAnisotropy(-3.25e4, axis=(0, 0, 1))
    sim.add(anis)

    zeeman = Zeeman((0, 0, 6.014576e4))
    sim.add(zeeman, save_field=True)

    sim.relax(dt=1e-13, stopping_dmdt=0.5, max_steps=5000,
              save_m_steps=None, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:fangohr,项目名称:fidimag,代码行数:33,代码来源:main.py

示例6: run_fidimag

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def run_fidimag(mesh):

    mu0 = 4 * np.pi * 1e-7

    Ms = 8.6e5
    A = 16e-12
    D = -3.6e-3
    K = 510e3

    sim = Sim(mesh)

    sim.set_tols(rtol=1e-10, atol=1e-10)

    sim.alpha = 0.5
    sim.gamma = 2.211e5
    sim.Ms = Ms
    sim.do_precession = False

    sim.set_m((0, 0, 1))

    sim.add(UniformExchange(A))
    sim.add(DMI(D, dmi_type='interfacial'))
    sim.add(UniaxialAnisotropy(K, axis=(0, 0, 1)))

    sim.relax(dt=1e-13, stopping_dmdt=0.01, max_steps=5000,
              save_m_steps=None, save_vtk_steps=50)

    m = sim.spin
    return m.copy()
开发者ID:fangohr,项目名称:fidimag,代码行数:31,代码来源:test_prb88_184422.py

示例7: relax_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system(mesh):

    # Only relaxation
    sim = Sim(mesh, name='relax')

    # Simulation parameters
    sim.driver.set_tols(rtol=1e-8, atol=1e-10)
    sim.driver.alpha = 0.5
    sim.driver.gamma = 2.211e5
    sim.Ms = 8.6e5
    sim.do_precession = False

    # The initial state passed as a function
    sim.set_m(init_m)
    # sim.set_m(np.load('m0.npy'))

    # Energies
    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

    anis = UniaxialAnisotropy(5e4)
    sim.add(anis)

    # Start relaxation and save the state in m0.npy
    sim.relax(dt=1e-14, stopping_dmdt=0.00001, max_steps=5000,
              save_m_steps=None, save_vtk_steps=None)

    np.save('m0.npy', sim.spin)
开发者ID:logicabrity,项目名称:fidimag,代码行数:31,代码来源:main.py

示例8: relax_system_only_exchange

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system_only_exchange(mesh):

    sim = Sim(mesh, name='relax_exchange_only')

    sim.set_tols(rtol=1e-6, atol=1e-6)
    sim.alpha = 0.5
    sim.gamma = 2.211e5
    sim.Ms = 8.6e5
    sim.do_precession = False

    sim.set_m(init_m_BP)

    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

    sim.relax(dt=1e-13, stopping_dmdt=0.5, max_steps=5000,
              save_m_steps=None, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:fangohr,项目名称:fidimag,代码行数:22,代码来源:main.py

示例9: relax_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, name='relax')

    sim.set_tols(rtol=1e-10, atol=1e-10)
    sim.alpha = 0.5
    sim.gamma = 2.211e5
    sim.Ms = 8.0e5
    sim.do_precession = False

    sim.set_m((1, 0.25, 0.1))
    # sim.set_m(np.load('m0.npy'))

    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

    demag = Demag()
    sim.add(demag)

    sim.relax(dt=1e-13, stopping_dmdt=0.01, max_steps=5000,
              save_m_steps=100, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:fangohr,项目名称:fidimag,代码行数:26,代码来源:main.py

示例10: Sim

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
# Prepare simulation

# We define the cylinder with the Magnetisation function
sim = Sim(mesh, name='skyrmion')
sim.Ms = cylinder

# To get a faster relaxation, we tune the LLG equation parameters
sim.do_precession = False
sim.alpha = 0.5

# Initial magnetisation:
sim.set_m(init_m)

# Energies:

# Exchange
sim.add(UniformExchange(A=A))

# Bulk DMI
sim.add(DMI(D=D))

# Relax the system
sim.relax(dt=1e-12, stopping_dmdt=0.0001, max_steps=5000,
          save_m_steps=None,
          save_vtk_steps=None
          )

# Save the final relaxed state and a vtk file
np.save('sk_up.npy', sim.spin)
sim.save_vtk()
开发者ID:fangohr,项目名称:fidimag,代码行数:32,代码来源:skyrmion_relax.py

示例11: return

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
    if x < 450:
        return (1, 0, 0)
    elif 450 <= x < 550:
        return (0, 1, 1)
    else:
        return (-1, 0, 0)


sim = Sim(mesh)
sim.alpha = alpha
sim.gamma = gamma
sim.Ms = Ms
sim.add(UniformExchange(A))
sim.add(UniaxialAnisotropy(K))
sim.set_m(init_m)
sim.relax(dt=1e-13, stopping_dmdt=0.001, max_steps=5000)

# Magnetisation x component.
mx_simulation = sim.spin.reshape((len(sim.spin) / 3, 3))[:, 0]

###################
# Analytic solution
###################
d = 1000e-9  # sample length (nm)
n_points = 500
mx_analytic = domain_wall_analytic_solution(A, K, d, n_points)

###################
# Plot solutions
###################
plt.figure(figsize=(8, 5))
开发者ID:fangohr,项目名称:micromagnetics,代码行数:33,代码来源:domain_wall.py

示例12:

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import relax [as 别名]
        # reshape rows, transpose and filter according to top layer
        m = m.reshape(3, -1).T[top_z]
        quiv.set_UVC(m[:, 0], m[:, 1], m[:, 2])

        # Update title
        ttime.set_text('Time: {:.4f} ns'.format(time * 1e9))
        tenergy.set_text('Energy: {:.6e} ns'.format(sim.compute_energy()))

        # fig.show()
        fig.canvas.draw()

else:
    # Fidimag automatically saves the last state
    sim.do_precession = False
    sim.relax(dt=1e-13, stopping_dmdt=args.stopping_dmdt,
              max_steps=args.max_steps,
              save_m_steps=args.save_files,
              save_vtk_steps=args.save_files)

    # Save final states
    sim.save_m()
    sim.save_vtk()


# -------------------------------------------------------------------------
# Files -------------------------------------------------------------------
# -------------------------------------------------------------------------

npy_dir = 'npys/'
vtk_dir = 'vtks/'
txt_dir = 'txts/'
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:33,代码来源:box_sim_fidimag.py


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