Exemple #1
0
# The following parameters can be changed:
P_INIT = 2             # Initial polynomial degree of all mesh elements.
INIT_REF_NUM = 4       # Number of initial uniform refinements

# Load the mesh
mesh = Mesh()
mesh.load(get_07_mesh())

# Perform initial mesh refinements.
for i in range(INIT_REF_NUM):
    mesh.refine_all_elements()

# 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 views
sview = ScalarView("Coarse solution", 0, 100, 798, 700)
oview = OrderView("Polynomial orders", 800, 100, 798, 700)

# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(space)

# Assemble and solve the matrix problem
sln = Solution()
Exemple #2
0
mesh = Mesh()
mesh.load(get_sample_mesh())
#mesh.refine_element(0)
#mesh.refine_all_elements()
#mesh.refine_towards_boundary(5, 3)
shapeset = H1Shapeset()
pss = PrecalcShapeset(shapeset)

# create an H1 space
xdisp = H1Space(mesh, shapeset)
ydisp = H1Space(mesh, shapeset)
xdisp.set_uniform_order(8)
ydisp.set_uniform_order(8)

set_bc(xdisp, ydisp)

ndofs = xdisp.assign_dofs(0)
ndofs += ydisp.assign_dofs(ndofs)

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

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

xsln = Solution()
ysln = Solution()
Exemple #3
0
# The following parameters can be changed:
P_INIT = 2  # Initial polynomial degree of all mesh elements.
INIT_REF_NUM = 4  # Number of initial uniform refinements

# Load the mesh
mesh = Mesh()
mesh.load(get_07_mesh())

# Perform initial mesh refinements.
for i in range(INIT_REF_NUM):
    mesh.refine_all_elements()

# 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 views
sview = ScalarView("Coarse solution", 0, 100, 798, 700)
oview = OrderView("Polynomial orders", 800, 100, 798, 700)

# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(space)

# Assemble and solve the matrix problem
sln = Solution()