if meshtype == 6: mesh = meshzoo.lshape_mesh(n=3) else: n = 20 for i in range(maxit): if meshtype == 1: mesh = meshzoo.regular(box, n=n) elif meshtype == 2: mesh = meshzoo.rice_mesh(box, n=n) elif meshtype == 3: mesh = meshzoo.cross_mesh(box, n=n) elif meshtype == 4: mesh = meshzoo.fishbone(box, n=n) elif meshtype == 5: mesh = load_mat_mesh('../data/square' + str(i + 2) + '.mat') elif meshtype == 6: mesh.uniform_refine() if meshtype != 6: n *= 2 fem = BiharmonicRecoveryFEMModel(mesh, pde, 1, 5, rtype=rtype) fem.solve(4) Ndof[i] = fem.space.number_of_global_dofs() e0, e1, e2, e3, e4 = fem.get_error() eta0 = fem.grad_recover_estimate() eta1 = fem.laplace_recover_estimate(etype=1) e5 = np.sqrt(np.sum(eta0**2))
degree = 1 Ndof = np.zeros((maxit, ), dtype=np.int) errorType = [ '$\| u - u_h\|$', '$\|\\nabla u - \\nabla u_h\|$', '$\|\\nabla u_h - G(\\nabla u_h) \|$', '$\|\\nabla u - G(\\nabla u_h)\|$', '$\|\Delta u - \\nabla\cdot G(\\nabla u_h)\|$', '$\|\Delta u - G(\\nabla\cdot G(\\nabla u_h))\|$', '$\|G(\\nabla\cdot G(\\nabla u_h)) - \\nabla\cdot G(\\nabla u_h)\|$' ] errorMatrix = np.zeros((len(errorType), maxit), dtype=np.float) h0 = 0.025 if (meshtype == 3): mesh = load_mat_mesh('../data/square' + str(1) + '.mat') for i in range(maxit): if meshtype == 1: # uniform mesh n = 20 * 2**i mesh = rectangledomainmesh(box, nx=n, ny=n) elif meshtype == 2: # CVT mesh mesh = load_mat_mesh('../data/square' + str(i + 2) + '.mat') elif meshtype == 3: # Delaunay uniform refine mesh mesh.uniform_refine() elif meshtype == 4: # Delaunay mesh mesh = triangle(box, h0 / 2**i) elif meshtype == 5: mesh = load_mat_mesh('../data/sqaureperturb' + str(i + 2) + '.' + str(0.5) + '.mat')