Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High error in interior domain when solving Poisson equation using Least-Squares FEM #912

Closed
heitorvitorc opened this issue Jun 29, 2023 · 3 comments

Comments

@heitorvitorc
Copy link

heitorvitorc commented Jun 29, 2023

Hello everyone,

I have been working on a project where I am using the Least-Squares Finite Element Method (LS-FEM) to solve the Poisson equation and I've come across an issue that I can't seem to resolve.

In my current approach, I am adding an extra equation to reduce the order of the system (i.e., h = - ∇u). I then compare my numerical results with an exact solution obtained via the Method of Manufactured Solutions (MMS), which is also used in the Gridap tutorial for the Poisson equation using a Discontinuous Galerkin (DG) formulation (https://gridap.github.io/Tutorials/dev/pages/t006_dg_discretization/).

However, I've noticed that the error is quite high inside the domain, while the results at the boundary elements align well with the exact solution. Below is the Julia code I've been using:

`using Gridap

ue(x) = 3x[1] + x[2]^2 + 2x[3]^3 + x[1]*x[2]x[3]
f(x) = -2 - 12
x[3]
g(x) = ue(x)

L = 1.0
n = 5

domain = (0.0, L, 0.0, L, 0.0, L)
partition = (n,n,n)
model = CartesianDiscreteModel(domain,partition)

dim = length(partition)
order = 3

reff_h = ReferenceFE(lagrangian, VectorValue{dim,Float64}, order)
reff_u = ReferenceFE(lagrangian, Float64, order-1;space=:P)
W = TestFESpace(model, reff_h, conformity=:H1)
V = TestFESpace(model, reff_u, conformity=:L2)
H = TrialFESpace(W)
U = TrialFESpace(V, g)

X = MultiFieldFESpace([H, U])
Y = MultiFieldFESpace([W,V])

Ω = Triangulation(model)
Γ = BoundaryTriangulation(model)

degree = 2*order
dΩ = Measure(Ω, degree)
dΓ = Measure(Γ, degree)
n_Γ = get_normal_vector(Γ)

Ao((h,u),(q,v)) =∫( (∇⋅h)⊙(∇⋅q) )dΩ+ ∫( (h + ∇(u))⋅(q + ∇(v)) )dΩ+ ∫(v*u)dΓ
Lo((q,v)) = ∫( (∇⋅q)f )dΩ + ∫( gv )dΓ

OP= AffineFEOperator(Ao, Lo, X, Y)
hh, uh = solve(OP)`

I am trying to understand what could be causing this issue. The high error inside the domain seems to suggest that the interior elements are not being solved correctly, but I am not sure why this is happening. I am particularly interested in

I am reaching out to see if anyone has any insights into what could be causing this discrepancy, or any suggestions on what I could try to resolve this issue. Any advice would be greatly appreciated.

Thank you in advance for your help.

@JordiManyer
Copy link
Member

I am not an expert on LS_FEM, but you are solving for u in L2. Are you sure you don't need any jump terms in the interior? You can have a look at the tutorial we have on Poisson using DG methods.

@heitorvitorc
Copy link
Author

I am not an expert on LS_FEM, but you are solving for u in L2. Are you sure you don't need any jump terms in the interior? You can have a look at the tutorial we have on Poisson using DG methods.

Thanks for the reply! In fact you just solved my issue. The solution space for u should be H1. I just made the changes here and the error inside the mesh decrease completely. I should be more careful when I reuse my codes.

@JordiManyer
Copy link
Member

Ok, no worries. I'm glad it's solved. Next time use the gitter for this minor issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants