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) # Visualize the approximation sln.plot() # Visualize the mesh mesh.plot(space=space)
# 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() ls.assemble() ls.solve_system(sln) # View the solution sln.plot() # View the mesh mesh.plot(space=space)