本文整理汇总了Python中hermes2d.Mesh.refine_element_id方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.refine_element_id方法的具体用法?Python Mesh.refine_element_id怎么用?Python Mesh.refine_element_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hermes2d.Mesh
的用法示例。
在下文中一共展示了Mesh.refine_element_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ScalarView_mpl_unknown
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_element_id [as 别名]
def test_ScalarView_mpl_unknown():
mesh = Mesh()
mesh.load(domain_mesh)
mesh.refine_element_id(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: test_plot_mesh2
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_element_id [as 别名]
def test_plot_mesh2():
mesh = Mesh()
mesh.load(domain_mesh)
mesh.refine_element_id(0)
view = MeshView("Solution")
view.show(mesh, lib="mpl", method="simple", show=False)
plot_mesh_mpl(mesh.nodes_dict, mesh.elements)
plot_mesh_mpl(mesh.nodes_dict, mesh.elements, plot_nodes=False)
view.show(mesh, lib="mpl", method="orders", show=False)
plot_mesh_mpl(mesh.nodes_dict, mesh.elements)
示例3: test_matrix
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_element_id [as 别名]
def test_matrix():
set_verbose(False)
mesh = Mesh()
mesh.load(domain_mesh)
mesh.refine_element_id(0)
# create an H1 space with default shapeset
space = H1Space(mesh, 1)
# initialize the discrete problem
wf = WeakForm(1)
set_forms(wf)
sys = LinSystem(wf)
sys.set_spaces(space)
# assemble the stiffness matrix and solve the system
sln = Solution()
sys.assemble()
A = sys.get_matrix()