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


Python Sim.save_vtk方法代码示例

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


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

示例1: excite_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import save_vtk [as 别名]
def excite_system(mesh, beta=0.0):

    # Specify the stt dynamics in the simulation
    sim = Sim(mesh, name='dyn_%g'%beta, driver='llg_stt_cpp')

    sim.driver.set_tols(rtol=1e-12, atol=1e-12)
    sim.driver.alpha = 0.1
    sim.driver.gamma = 2.211e5
    sim.Ms = 8.6e5

    # 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)

    # beta is the parameter in the STT torque
    sim.a_J = global_const*1e11
    sim.p = (1,0,0)
    sim.beta = beta

    # The simulation will run for 5 ns and save
    # 500 snapshots of the system in the process
    ts = np.linspace(0, 0.5e-9, 21)

    xs=[]
    thetas=[]

    for t in ts:
        print('time', t)
        sim.run_until(t)
        spin = sim.spin.copy()
        x, theta = extract_dw(spin)
        xs.append(x)
        thetas.append(theta)
        sim.save_vtk()

    np.savetxt('dw_%g.txt'%beta,np.transpose(np.array([ts, xs,thetas])))
开发者ID:logicabrity,项目名称:fidimag,代码行数:45,代码来源:main.py

示例2: excite_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import save_vtk [as 别名]
def excite_system(mesh, time=5, snaps=501):

    # Specify the stt dynamics in the simulation
    sim = Sim(mesh, name='dyn', driver='llg_stt')

    # Set the simulation parameters
    sim.driver.set_tols(rtol=1e-12, atol=1e-14)
    sim.driver.alpha = 0.05
    sim.gamma = 2.211e5
    sim.Ms = 8.6e5

    # Load the initial state from the npy file saved
    # in the realxation
    sim.set_m(np.load('m0.npy'))

    # Add the energies
    A = 1.3e-11
    exch = UniformExchange(A=A)
    sim.add(exch)

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

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

    # Set the current in the x direction, in A / m
    # beta is the parameter in the STT torque
    sim.driver.jx = -1e12
    sim.driver.beta = 1

    # The simulation will run for x ns and save
    # 'snaps' snapshots of the system in the process
    ts = np.linspace(0, time * 1e-9, snaps)

    for t in ts:
        print('time', t)
        sim.driver.run_until(t)
        sim.save_vtk()
        sim.save_m()
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:42,代码来源:test_stt_dw.py

示例3: excite_system

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import save_vtk [as 别名]
def excite_system(mesh):
    sim = Sim(mesh, name='dyn', driver='llg_stt')
    sim.set_tols(rtol=1e-8, atol=1e-10)
    sim.alpha = 0.5
    sim.gamma = 2.211e5
    sim.Ms = 8.6e5

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

    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.jx = -5e12
    sim.beta = 0

    ts = np.linspace(0, 0.5e-9, 101)
    for t in ts:
        print 'time', t
        sim.run_until(t)
        sim.save_vtk()
开发者ID:fangohr,项目名称:fidimag,代码行数:26,代码来源:main.py

示例4: Sim

# 需要导入模块: from fidimag.micro import Sim [as 别名]
# 或者: from fidimag.micro.Sim import save_vtk [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


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