本文整理汇总了Python中hermes2d.Mesh.refine_towards_vertex方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.refine_towards_vertex方法的具体用法?Python Mesh.refine_towards_vertex怎么用?Python Mesh.refine_towards_vertex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hermes2d.Mesh
的用法示例。
在下文中一共展示了Mesh.refine_towards_vertex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_example_05
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_towards_vertex [as 别名]
def test_example_05():
from hermes2d.examples.c05 import set_bc
from hermes2d.examples.c05 import set_forms as set_forms_surf
set_verbose(False)
P_INIT = 4 # initial polynomial degree in all elements
CORNER_REF_LEVEL = 12 # number of mesh refinements towards the re-entrant corner
# Load the mesh file
mesh = Mesh()
mesh.load(get_example_mesh())
# Perform initial mesh refinements.
mesh.refine_towards_vertex(3, CORNER_REF_LEVEL)
# Create an H1 space with default shapeset
space = H1Space(mesh, P_INIT)
set_bc(space)
# Initialize the weak formulation
wf = WeakForm()
set_forms(wf)
# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(space)
# Assemble and solve the matrix problem
sln = Solution()
ls.assemble()
ls.solve_system(sln)
示例2: test_example_06
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_towards_vertex [as 别名]
def test_example_06():
from hermes2d.examples.c06 import set_bc, set_forms
set_verbose(False)
# The following parameters can be changed:
UNIFORM_REF_LEVEL = 2; # Number of initial uniform mesh refinements.
CORNER_REF_LEVEL = 12; # Number of mesh refinements towards the re-entrant corner.
P_INIT = 6; # Uniform polynomial degree of all mesh elements.
# Boundary markers
NEWTON_BDY = 1
# Load the mesh file
mesh = Mesh()
mesh.load(get_example_mesh())
# Perform initial mesh refinements.
for i in range(UNIFORM_REF_LEVEL):
mesh.refine_all_elements()
mesh.refine_towards_vertex(3, CORNER_REF_LEVEL)
# Create an H1 space with default shapeset
space = H1Space(mesh, P_INIT)
set_bc(space)
# Initialize the weak formulation
wf = WeakForm()
set_forms(wf)
# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(space)
# Assemble and solve the matrix problem
sln = Solution()
ls.assemble()
ls.solve_system(sln)
示例3: test_example_05
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_towards_vertex [as 别名]
def test_example_05():
from hermes2d.examples.c05 import set_bc
from hermes2d.examples.c05 import set_forms as set_forms_surf
set_verbose(False)
mesh = Mesh()
mesh.load(domain_mesh)
mesh.refine_towards_vertex(3, 12)
shapeset = H1Shapeset()
pss = PrecalcShapeset(shapeset)
# create an H1 space
space = H1Space(mesh, shapeset)
space.set_uniform_order(4)
set_bc(space)
space.assign_dofs()
xprev = Solution()
yprev = Solution()
# initialize the discrete problem
wf = WeakForm(1)
set_forms(wf, -1)
set_forms_surf(wf)
sln = Solution()
solver = DummySolver()
sys = LinSystem(wf, solver)
sys.set_spaces(space)
sys.set_pss(pss)
sys.assemble()
sys.solve_system(sln)
assert abs(sln.l2_norm() - 0.535833) < 1e-4
assert abs(sln.h1_norm() - 1.332908) < 1e-4
示例4: Mesh
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_towards_vertex [as 别名]
#! /usr/bin/env python
from hermes2d import Mesh, MeshView, H1Shapeset, PrecalcShapeset, H1Space, \
LinSystem, Solution, ScalarView, WeakForm, DummySolver
from hermes2d.examples.c05 import set_bc, set_forms
from hermes2d.examples.c05 import set_forms as set_forms_surf
from hermes2d.forms import set_forms
from hermes2d.examples import get_example_mesh
mesh = Mesh()
mesh.load(get_example_mesh())
#mesh.refine_element(0)
#mesh.refine_all_elements()
mesh.refine_towards_vertex(3, 12)
shapeset = H1Shapeset()
pss = PrecalcShapeset(shapeset)
# create an H1 space
space = H1Space(mesh, shapeset)
space.set_uniform_order(4)
set_bc(space)
space.assign_dofs()
xprev = Solution()
yprev = Solution()
# initialize the discrete problem
wf = WeakForm(1)
示例5: Mesh
# 需要导入模块: from hermes2d import Mesh [as 别名]
# 或者: from hermes2d.Mesh import refine_towards_vertex [as 别名]
UNIFORM_REF_LEVEL = 2; # Number of initial uniform mesh refinements.
CORNER_REF_LEVEL = 12; # Number of mesh refinements towards the re-entrant corner.
P_INIT = 6; # Uniform polynomial degree of all mesh elements.
# Boundary markers
NEWTON_BDY = 1
# Load the mesh file
mesh = Mesh()
mesh.load(get_example_mesh())
# Perform initial mesh refinements.
for i in range(UNIFORM_REF_LEVEL):
mesh.refine_all_elements()
mesh.refine_towards_vertex(3, CORNER_REF_LEVEL)
# Create an H1 space with default shapeset
space = H1Space(mesh, P_INIT)
set_bc(space)
# Initialize the weak formulation
wf = WeakForm()
set_forms(wf)
# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(space)
# Assemble and solve the matrix problem
sln = Solution()