CG2 for poisson equation should be 3rd order L2 convergence but for some reason I am getting near 4th order convergence. If I use DG2 elements, I get the 3rd order convergence as theory suggests. Why is this happening? Below is the snippet of my code mesh = UnitSquareMesh(20,20,quadrilateral=False) Q = FunctionSpace(mesh,CG,2) ... x = SpatialCoordinate(Q.mesh()) u_exact = interpolate(sin(2*x[0]**2*math.pi)*sin(2*x[1]**2*math.pi),Q) f = interpolate( 16*math.pi**2*sin(2*math.pi*x[0]**2)*sin(2*math.pi*x[1]**2 )*(x[0]**2+x[1]**2) - 4*math.pi*(cos(2*math.pi*x[0]**2)*sin(2*math.pi*x[1]**2) + sin(2 *math.pi*x[0]**2)*cos(2*math.pi*x[1]**2)),Q) ... L2_error = errornorm(u_exact,u_h) I never had this "problem" earlier this year when I ran CG2 experiments (though I didn't use the UFL format, but I don't think that's the problem here). Justin
Probably super-convergence due to the regular mesh conforming with symmetries of the exact solution. Either that or Firedrake is magic :) all the best --cjc On 4 October 2017 at 22:07, Justin Chang <jychang48@gmail.com> wrote:
CG2 for poisson equation should be 3rd order L2 convergence but for some reason I am getting near 4th order convergence. If I use DG2 elements, I get the 3rd order convergence as theory suggests.
Why is this happening? Below is the snippet of my code
mesh = UnitSquareMesh(20,20,quadrilateral=False)
Q = FunctionSpace(mesh,CG,2)
...
x = SpatialCoordinate(Q.mesh())
u_exact = interpolate(sin(2*x[0]**2*math.pi)*sin(2*x[1]**2*math.pi),Q)
f = interpolate( 16*math.pi**2*sin(2*math.pi*x[0]**2)*sin(2*math.pi*x[1]** 2)*(x[0]**2+x[1]**2)
- 4*math.pi*(cos(2*math.pi*x[0]**2)*sin(2*math.pi*x[1]**2) + sin(2 *math.pi*x[0]**2)*cos(2*math.pi*x[1]**2)),Q)
...
L2_error = errornorm(u_exact,u_h)
I never had this "problem" earlier this year when I ran CG2 experiments (though I didn't use the UFL format, but I don't think that's the problem here).
Justin
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916
In your code, you are comparing your solution with the interpolated analytic solution in the same FE space as your approximation. What happens if you interpolate your exact solution into a higher order finite element space, like CG3 or CG4? I suspect you may get the rate you're expecting after that (if not, then some magic is happening...) Best regards, - Thomas ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Justin Chang <jychang48@gmail.com> Sent: 04 October 2017 22:07:15 To: firedrake Subject: [firedrake] CG2 giving me 4th order L2 convergence CG2 for poisson equation should be 3rd order L2 convergence but for some reason I am getting near 4th order convergence. If I use DG2 elements, I get the 3rd order convergence as theory suggests. Why is this happening? Below is the snippet of my code mesh = UnitSquareMesh(20,20,quadrilateral=False) Q = FunctionSpace(mesh,CG,2) ... x = SpatialCoordinate(Q.mesh()) u_exact = interpolate(sin(2*x[0]**2*math.pi)*sin(2*x[1]**2*math.pi),Q) f = interpolate( 16*math.pi**2*sin(2*math.pi*x[0]**2)*sin(2*math.pi*x[1]**2)*(x[0]**2+x[1]**2) - 4*math.pi*(cos(2*math.pi*x[0]**2)*sin(2*math.pi*x[1]**2) + sin(2*math.pi*x[0]**2)*cos(2*math.pi*x[1]**2)),Q) ... L2_error = errornorm(u_exact,u_h) I never had this "problem" earlier this year when I ran CG2 experiments (though I didn't use the UFL format, but I don't think that's the problem here). Justin
Ah yes, that is precisely the problem. Back then, I think the errornorm() function automatically did some degree_rise=3 or whatever. If I now interpolate the exact solution onto a CG3 or CG4, I do in fact get the convergence rate I would expect. Thanks
participants (3)
- 
                
                Colin Cotter
- 
                
                Gibson, Thomas
- 
                
                Justin Chang