A FreeFEM++ code uses the Modified Weak Galerkin Finite Element Method to solve the Poisson Problem

Hello everyone,
I wrote a FreeFEM++ code to solve the Poisson Problem -∆u=f in Ω u=g on ∂Ω using the Modified Weak Galerkin Finite Element Method based on the paper:

[1] “A modified weak Galerkin finite element method”. X. Wang, N.S. Malluwawadu, F. Gao, T.C. McMillan.

https://www.sciencedirect.com/science/article/pii/S0377042714002131 3.

I modified a FreeFEM++ code for the Discontinuous Galerkin FEM to solve this problem to fit the Modified Weak Galerkin FEM, but the results are not the same as in the paper. I am wondering what’s wrong with my code.
MWGFEM.edp (1.4 KB)

1 Like

hello!! Can your code run with a crrect results now? I have the same problem with the MWG method on this paper >.<

The weak gradient was not defined correctly in this code (it must not be the usual gradient). Here is a code with the weak gradient
mwgfem.edp (1.4 KB)
However still it does not give the numerical values listed in the paper (Table 1). The results in Table 1 are doubtful because the error cannot be so small (even the L2 projection of uex gives an error to uex larger that stated!).

Respected sir, I have not so much idea about weak gradient but results coming if take a penaltity parameter 1000 in the intalledges term of the formulation using P1 element. I don’t know why it is happening. But i have not found any thing about penaltity parameter in the paper.
Here, is the Code>
My Code_wgm.edp (2.2 KB)

The weak gradient is defined in the paper mentioned above.
If we put a large penalty parameter I agree that the method becomes second order, indeed it approaches the conforming P1 framework, which is known.
Here the paper claims that with P1 discontinuous it is better than classical, with the penalty parameter 1/h. We don’t get it.

Yes Sir. I have also observed that. Thank you.

Respected sir, I wrote a freefem code with the weak gradient, and the error can be small enough like the paper mentioned.
MWG.edp (2.4 KB)
But When I try to change the exact solution’s boundary condition
u=0
to
u = u_{ex}, \partial_n u = (u_x, u_y)\cdot n ,
it doesn’t work. I don’t know why. TT
MWG_2.edp (2.6 KB)

Hello Dear orange, your code is giving very good results. But which formulation you used in the code??. Why you are defining two spaces??.
Do you used the formulation in the following:


(equation: 3)
I have not understand your problem formulation: you have not taken (dxx(sigma1)+dyy(sigma2)) term still you have used others.

Blockquote
problem WGM([sigma1, sigma2, uh], [tau1, tau2, vh], solver=UMFPACK)
= -int2d(Th)( vh*(dx(sigma1)+dy(sigma2)) )
+intalledges(Th)( (1-nTonEdge)( mean(vh)(jump(sigma1)N.x + jump(sigma2)N.y) )/nTonEdge )
+intalledges(Th)((jump(uh)jump(vh))/lenEdge)
+int2d(Th)(sigma1
tau1 + sigma2
tau2)
+int2d(Th)( uh
(dx(tau1)+dy(tau2)) )
-intalledges(Th)( (1-nTonEdge)( mean(uh)(jump(tau1)N.x + jump(tau2)N.y) )/nTonEdge )
//+int2d(Th)(gh
vh)
-int2d(Th)(f
vh)// linear form
+on(1,2,3,4,uh=0)
Blockquote

Does you taken the formulation of the following paper or anything else:
J Comp and app math 2014.pdf (377.6 KB)

Specifically, why you taken the following term:

Blockquote
+int2d(Th)(sigma1tau1 + sigma2tau2)
+int2d(Th)( uh*(dx(tau1)+dy(tau2)) )
-intalledges(Th)( (1-nTonEdge)( mean(uh)(jump(tau1)*N.x + jump(tau2)N.y) )/nTonEdge )
//+int2d(Th)(gh
vh)
Blockquote

I have not found like any term in the above paper. Can you share your formulation pls??

Also, I have observed :

Blockquote
fespace Vh(Th,P2dc); // Discontinous P2 finite element
Vh uh,vh;

Blockquote
fespace Wh(Th,P1dc);
Wh sigma1,sigma2;
Wh tau1, tau2;

This two spaces Vh and Wh should be such that Wh has one less polynomial degree. Why you taken like this ??.
I need your clarification brother.
In the paper still they define with same degree>

Regarding boundary condition: +on(1,2,3,4,uh=0) . You have to take it as you used uex=sin(pi*x)sin(piy) which is zero on boundary of the domain D=[0,1]^2.

I have checked your code with P1, P2, and P3. All gives good results.

Thanks in advance.