def test_example_07(): from hermes2d.examples.c07 import set_bc, set_forms set_verbose(False) # 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 the linear system. ls = LinSystem(wf) ls.set_spaces(space) # Assemble and solve the matrix problem sln = Solution() ls.assemble() ls.solve_system(sln)
def test_example_07(): from hermes2d.examples.c07 import set_bc, set_forms set_verbose(False) P_INIT = 2 # Initial polynomial degree of all mesh elements. mesh = Mesh() mesh.load(get_07_mesh()) # Initialize the shapeset and the cache shapeset = H1Shapeset() pss = PrecalcShapeset(shapeset) # create finite element space space = H1Space(mesh, shapeset) space.set_uniform_order(P_INIT) set_bc(space) # Enumerate basis functions space.assign_dofs() # weak formulation wf = WeakForm(1) set_forms(wf) # matrix solver solver = DummySolver() # Solve the problem sln = Solution() ls = LinSystem(wf, solver) ls.set_spaces(space) ls.set_pss(pss) ls.assemble() ls.solve_system(sln)
# Import modules from hermes2d import Mesh, MeshView, OrderView, H1Shapeset, PrecalcShapeset, H1Space, \ LinSystem, WeakForm, DummySolver, Solution, ScalarView, VonMisesFilter, \ OrderView from hermes2d.examples.c07 import set_bc, set_forms from hermes2d.examples import get_07_mesh # 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)