示例#1
0
文件: 08.py 项目: Richardma/hermes2d
mesh.load(get_cylinder_mesh())
#mesh.refine_element(0)
#mesh.refine_all_elements()
mesh.refine_towards_boundary(5, 3)
shapeset = H1Shapeset()
pss = PrecalcShapeset(shapeset)

# create an H1 space
xvel = H1Space(mesh, shapeset)
yvel = H1Space(mesh, shapeset)
press = H1Space(mesh, shapeset)
xvel.set_uniform_order(2)
yvel.set_uniform_order(2)
press.set_uniform_order(1)

set_bc(xvel, yvel, press)

ndofs = 0
ndofs += xvel.assign_dofs(ndofs)
ndofs += yvel.assign_dofs(ndofs)
ndofs += press.assign_dofs(ndofs)

xprev = Solution()
yprev = Solution()

xprev.set_zero(mesh)
yprev.set_zero(mesh)

# initialize the discrete problem
wf = WeakForm(3)
set_forms(wf, xprev, yprev)
示例#2
0
from hermes2d.examples import get_sample_mesh

# The following parameter can be changed:
P_INIT = 4

# Load the mesh file
mesh = Mesh()
mesh.load(get_sample_mesh())

# Perform uniform mesh refinement
mesh.refine_all_elements()

# Create the x- and y- displacement space using the default H1 shapeset
xdisp = H1Space(mesh, P_INIT)
ydisp = H1Space(mesh, P_INIT)
set_bc(xdisp, ydisp)

# Initialize the weak formulation
wf = WeakForm(2)
set_forms(wf)

# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(xdisp, ydisp)

# Assemble and solve the matrix problem
xsln = Solution()
ysln = Solution()
ls.assemble()
ls.solve_system(xsln, ysln, lib="scipy")
示例#3
0
from hermes2d.examples import get_sample_mesh

# The following parameter can be changed:
P_INIT = 4

# Load the mesh file
mesh = Mesh()
mesh.load(get_sample_mesh())

# Perform uniform mesh refinement
mesh.refine_all_elements()

# Create the x- and y- displacement space using the default H1 shapeset
xdisp = H1Space(mesh, P_INIT)
ydisp = H1Space(mesh, P_INIT)
set_bc(xdisp, ydisp)

# Initialize the weak formulation
wf = WeakForm(2)
set_forms(wf)

# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(xdisp, ydisp)

# Assemble and solve the matrix problem
xsln = Solution()
ysln = Solution()
ls.assemble()
ls.solve_system(xsln, ysln, lib="scipy")