firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
482 stars 157 forks source link

superconvergence #3622

Closed qk11853 closed 2 weeks ago

qk11853 commented 2 weeks ago

from firedrake import *

nx = 4 mesh = UnitSquareMesh(nx, nx, diagonal="right") Uspace = FunctionSpace(mesh, "CG", 2) u = TrialFunction(Uspace) v = TestFunction(Uspace) n = FacetNormal(mesh) x, y = SpatialCoordinate(mesh)

bcs = DirichletBC(Uspace, cos(pi x) sin(pi * y), (1, 2, 3, 4))

u_ex = Function(Uspace).interpolate(cos(pi x) sin(pi y)) f = Function(Uspace).interpolate(2 pi * 2 cos(pi x) sin(pi * y))

a = inner(grad(u), grad(v)) dx l = f v * dx

uu = Function(Uspace)

solve(a == l, uu, bcs)

Why do I get superconvergent results when calculating poisson problems?

colinjcotter commented 2 weeks ago

Probably symmetric cancellations on the structured grid (perhaps combined with symmetric solution). Try breaking some of the symmetries.

qk11853 commented 2 weeks ago

Probably symmetric cancellations on the structured grid (perhaps combined with symmetric solution). Try breaking some of the symmetries.

I'm not quite sure what you mean. How can I solve it? Thank you very much for your reply!

colinjcotter commented 2 weeks ago

There is nothing to solve? Error analysis provides an upper bound in the general case. Sometimes we are lucky.

qk11853 commented 2 weeks ago

There is nothing to solve? Error analysis provides an upper bound in the general case. Sometimes we are lucky. For the finite element, P1 polynomial space, we get second-order convergence in the L2 sense and first-order convergence in the H1 sense. Now what I get with firedrake is second order and second order, how do I fix it?

colinjcotter commented 2 weeks ago

This is not inconsistent with the theory

qk11853 commented 2 weeks ago

This is not inconsistent with the theory

But this superconvergent result, how can I get a result that's not superconvergent?

colinjcotter commented 2 weeks ago

Try a less symmetric case

On 9 Jun 2024, at 10:58, qk11853 @.***> wrote:



This is not inconsistent with the theory

But this superconvergent result, how can I get a result that's not superconvergent?

— Reply to this email directly, view it on GitHubhttps://github.com/firedrakeproject/firedrake/issues/3622#issuecomment-2156421838, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABOSV4R2SWHII5VV3TNEMF3ZGQRKNAVCNFSM6AAAAABJATO7ASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGQZDCOBTHA. You are receiving this because you commented.Message ID: @.***>