Confirming functional superconvergence
Hi,
First: remarkable piece of software engineering.
Now my problem. I am trying to confirm functional superconvergence where the solution comes from a Galerkin approximation to a simple 1-D Poisson problem. For a given polynomial order p, it is my understanding that an integral functional should be 2p order accurate for this problem. I obtain this rate for p = 1 and p = 2, but not for higher-order polynomials.
The function below can be used to reproduce the effect: e.g., run with (num=20, p = 3) and (num=40, p=3) and then estimate the convergence rate using log(Error_
Any insights would be appreciated.
Jason
_______
from dolfin import *
import numpy
def solve(num, p):
"""Solves a 1-D BVP and returns the L2 error, the functional and its error
*Inputs*
num: number of finite-elements
p: polynomial order
*Output*
functional error
functional error estimate
correct functional error
"""
# Create mesh and define function space
mesh = UnitInterval(num)
V = FunctionSpace(mesh, "CG", p)
# Define Dirichlet boundary (x = 0 or x = 1)
def boundary(x):
return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
def u0_boundary(x, on_boundary):
return on_boundary
# Define exact solution, source, and boundary conditions
u0 = Expression("1.0 + x[0]*sin(pi*x[0])")
f = Expression(
bc = DirichletBC(V, u0, u0_boundary)
# define the bilinear form a and linear form L
v = TestFunction(V)
u = TrialFunction(V)
a = -inner(grad(u), grad(v))*dx
L = f*v*dx
# Solve variational problem and print L2 solution error
u = Function(V)
problem = LinearVariation
solver = LinearVariation
solver.solve()
print "L2 solution error:", errornorm(u0, u)
# Compute functional and its error
energy = u*dx
E = assemble(energy)
E_e = 1.0/pi + 1.0
print "Functional value:", E
print "Functional error:", E_e - E
return [E, E_e - E]
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Garth Wells
- Solved:
- Last query:
- Last reply: