def EvalValue(self, x): return -pFunc_exact(x) order = 1 static_cond = False meshfile = expanduser(join(path, 'data', 'star.mesh')) mesh = mfem.Mesh(meshfile, 1, 1) dim = mesh.Dimension() ref_levels = int(np.floor(np.log(10000. / mesh.GetNE()) / np.log(2.) / dim)) for x in range(ref_levels): mesh.UniformRefinement() hdiv_coll = mfem.RT_FECollection(order, dim) l2_coll = mfem.L2_FECollection(order, dim) R_space = mfem.FiniteElementSpace(mesh, hdiv_coll) W_space = mfem.FiniteElementSpace(mesh, l2_coll) dimR = R_space.GetVSize() dimW = W_space.GetVSize() print("***********************************************************") print("dim(R) = " + str(dimR)) print("dim(W) = " + str(dimW)) print("dim(R+W) = " + str(dimR + dimW)) print("***********************************************************") block_offsets = intArray([0, dimR, dimW])
y = p[1] temp = 1 + 2 * kappa * kappa F0 = temp * cos(kappa * x) * sin(kappa * y) F1 = temp * cos(kappa * y) * sin(kappa * x) if dim == 3: return (F0, F1, 0.0) else: return (F0, F1) ref_levels = int(np.floor(np.log(25000. / mesh.GetNE()) / np.log(2.) / dim)) for x in range(ref_levels): mesh.UniformRefinement() fec = mfem.RT_FECollection(order - 1, dim) fespace = mfem.FiniteElementSpace(mesh, fec) print("Number of finite element unknows : " + str(fespace.GetTrueVSize())) ess_tdof_list = intArray() if mesh.bdr_attributes.Size(): ess_bdr = intArray(mesh.bdr_attributes.Max()) if set_bc: ess_bdr.Assign(1) else: ess_bdr.Assign(0) fespace.GetEssentialTrueDofs(ess_bdr, ess_tdof_list) b = mfem.LinearForm(fespace) f = f_exact() dd = mfem.VectorFEDomainLFIntegrator(f) b.AddDomainIntegrator(dd)