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


Python LinSystem.get_rhs方法代码示例

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


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

示例1: test_ScalarView_mpl_unknown

# 需要导入模块: from hermes2d import LinSystem [as 别名]
# 或者: from hermes2d.LinSystem import get_rhs [as 别名]
def test_ScalarView_mpl_unknown():
    mesh = Mesh()
    mesh.load(domain_mesh)
    mesh.refine_element(0)
    shapeset = H1Shapeset()
    pss = PrecalcShapeset(shapeset)

    # create an H1 space
    space = H1Space(mesh, shapeset)
    space.set_uniform_order(5)
    space.assign_dofs()

    # initialize the discrete problem
    wf = WeakForm(1)
    set_forms(wf)

    solver = DummySolver()
    sys = LinSystem(wf, solver)
    sys.set_spaces(space)
    sys.set_pss(pss)

    # assemble the stiffness matrix and solve the system
    sys.assemble()
    A = sys.get_matrix()
    b = sys.get_rhs()
    from scipy.sparse.linalg import cg

    x, res = cg(A, b)
    sln = Solution()
    sln.set_fe_solution(space, pss, x)

    view = ScalarView("Solution")
开发者ID:hpfem,项目名称:hermes2d,代码行数:34,代码来源:test_plots.py

示例2: poisson_solver

# 需要导入模块: from hermes2d import LinSystem [as 别名]
# 或者: from hermes2d.LinSystem import get_rhs [as 别名]
def poisson_solver(mesh_tuple):
    """
    Poisson solver.

    mesh_tuple ... a tuple of (nodes, elements, boundary, nurbs)
    """
    set_verbose(False)
    mesh = Mesh()
    mesh.create(*mesh_tuple)
    mesh.refine_element(0)
    shapeset = H1Shapeset()
    pss = PrecalcShapeset(shapeset)

    # create an H1 space
    space = H1Space(mesh, shapeset)
    space.set_uniform_order(5)
    space.assign_dofs()

    # initialize the discrete problem
    wf = WeakForm(1)
    set_forms(wf)

    solver = DummySolver()
    sys = LinSystem(wf, solver)
    sys.set_spaces(space)
    sys.set_pss(pss)

    # assemble the stiffness matrix and solve the system
    sys.assemble()
    A = sys.get_matrix()
    b = sys.get_rhs()
    from scipy.sparse.linalg import cg
    x, res = cg(A, b)
    sln = Solution()
    sln.set_fe_solution(space, pss, x)
    return sln
开发者ID:adam-urbanczyk,项目名称:hermes-gui,代码行数:38,代码来源:handle_hermes.py

示例3: H1Space

# 需要导入模块: from hermes2d import LinSystem [as 别名]
# 或者: from hermes2d.LinSystem import get_rhs [as 别名]
# create an H1 space
space = H1Space(mesh, shapeset)
space.set_uniform_order(5)
space.assign_dofs()

# initialize the discrete problem
wf = WeakForm(1)
set_forms(wf)

solver = DummySolver()
sys = LinSystem(wf, solver)
sys.set_spaces(space)
sys.set_pss(pss)

# assemble the stiffness matrix and solve the system
sys.assemble()
A = sys.get_matrix()
b = sys.get_rhs()
from scipy.sparse.linalg import cg
x, res = cg(A, b)
sln = Solution()
sln.set_fe_solution(space, pss, x)

view = ScalarView("Solution")
view.show(sln, lib="mayavi")
# view.wait()

mview = MeshView("Hello world!", 100, 100, 500, 500)
mview.show(mesh, lib="mpl", method="orders", notebook=False)
mview.wait()
开发者ID:davidquantum,项目名称:hermes2dold,代码行数:32,代码来源:03.py


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