本文整理汇总了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")
示例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
示例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()