# When I refine mesh my error do not improves

Hello, there I am trying to perform an analysis error in fenics. I am refining my mesh intervals: 4, 8, 16, 32, and 64 intervales in the unit square. However, my error never improves. The analytical solution of my problem is 1+x^2 +2y^3.This is my code.

import numpy as np meshInteger = [4,8,16,32,64]
meshInteger = np.array(meshInteger)
errorVector = []
for i in meshInteger:  from fenics import *  # Create mesh and define function space
 mesh = UnitSquareMesh(i, i)
 V = FunctionSpace(mesh, 'Lagrange', 2)  # Define boundary condition
 u_D = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]*x[1]', degree=3)  def boundary(x, on_boundary):
 return on_boundary  bc = DirichletBC(V, u_D, boundary)  # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
 f = Expression('2+12*x[1]', degree=3)
 a = dot(grad(u), grad(v))*dx
 L = f*v*dx  # Compute solution
 u = Function(V)
 solve(a == L, u, bc)  # Plot solution and mesh
 plot(u)
 plot(mesh)  # Save solution to file in VTK format
 vtkfile = File('poisson/solutionPolynomial3.pvd')
 vtkfile << u  # Compute error in L2 norm  error= errornorm(u_D, u, 'L2')  # Compute maximum error at vertices
 vertex_values_u_D = u_D.compute_vertex_values(mesh)
 vertex_values_u = u.compute_vertex_values(mesh)
 import numpy as np
 error_max = np.max(np.abs(vertex_values_u_D - vertex_values_u)) 
 errorVector.append(error) print(errorVector)#the error do not decrease

Any help and orientation of why my error is constant is highly appreciated

Please encapsulate your code with 3x instead of the current formatting, as the current code cannot be copy-pasted and executed without modification.

And as a side-note, shouldn’t your f be multiplied by -1, as you are solving
-\nabla^2u= -\frac{\partial^2 u}{\partial^2x}-\frac{\partial^2 u}{\partial^2y}=-2-12y=f

Dear, Dokken. what do you mean by encapsulating with 3x?

Three times the backtick  as explained at

or