The Kelly error estimator, proposed by Sean McKee, is a popular a posteriori error estimator used in the field of finite element methods (FEM) to solve partial differential equations (PDEs). The idea behind this method is to provide an estimate of the error in the numerical solution of the problem, allowing for adaptive refinement of the mesh to achieve a more accurate solution.
The Kelly error estimator relies on evaluating the gradients of the solution and is especially suitable for problems involving scalar PDEs such as the Poisson or Laplace equations.
To extend the Kelly error estimator for vector-valued PDE problems, the error calculation needs to be performed component-wise and then summed up. This can be a bit challenging due to the vector nature of the problem.
Here's a basic idea of how you can implement it in Python, using the finite element library FEniCS:
python
from fenics import *
# Assume that u is your computed solution, and V is your function space
V = u.function_space()
mesh = V.mesh()
degree = V.ufl_element().degree()
# Create a cell function marking all cells as 1 (initially every cell is marked for refinement)
markers = MeshFunction("bool", mesh, mesh.topology().dim(), 1)
# Compute error for each cell and mark cells where error is larger than a certain tolerance
for c in cells(mesh):
# Compute cell error based on your vector-valued problem
cell_error = compute_cell_error(c, u) # Replace with your actual error computation
if cell_error > tol:
markers[c] = 1
# Refine the mesh based on the markers
mesh = refine(mesh, markers)
This is a rough sketch. The key part is the compute_cell_error function, which you need to implement based on your specific problem. The implementation of this function will depend on the nature of your vector-valued PDE problem.
Remember that Python and FEniCS both have extensive documentation online, so you can always refer to their official documentation for more detailed information and function descriptions.