Hey everyone, I’m trying to adapt a mesh regarding the a posteriori error but it seems the mesh is no refined. Could someone tell me what I did wrong in this code
//RHS
func f = 8*pi*pi*sin(2*pi*x)*sin(2*pi*y);
//exact solution
func uex = sin(2*pi*x)*sin(2*pi*y);
func dxu = 2*pi*cos(2*pi*x)*sin(2*pi*y);
func dyu = 2*pi*sin(2*pi*x)*cos(2*pi*y);
//f integration order
int forder = 25;
// Mesh
include "getARGV.idp"
int coarseMesh = getARGV("-cM", 0);
mesh Th = square(2^coarseMesh, 2^coarseMesh);
// Macro
macro grad(A) [dx(A), dy(A)] //
// Fespace
func Pk = P1;
real eta = 50;
while(eta > 10){
fespace Uh(Th, Pk);
Uh u;
// Problem
varf vPoisson (u, uh)
= int2d(Th)(grad(u)' * grad(uh)) + int2d(Th)(f * uh) + on(1, 2, 3, 4, u=0);
matrix<real> Poisson = vPoisson(Uh, Uh, solver=sparsesolver);
real[int] PoissonBoundary = vPoisson(0, Uh);
u[] = Poisson^-1 * PoissonBoundary;
// Plot
// plot(u, nbiso=30, fill=true, value=true);
real L2error = int2d(Th)((uex - u)^2);
real H1error = L2error + int2d(Th)((dxu - dx(u))^2 + (dyu - dy(u))^2);
fespace Nh(Th, P0); // the space function constant / triangle
Nh etak;
Nh hT = hTriangle;
varf vetaK (unused, chiK)
= intalledges(Th)(chiK*lenEdge*square(jump(N.x*dx(u) + N.y*dy(u)))) + int2d(Th)(chiK*square(hTriangle*(f)));
etak[] = vetaK(0, Nh);
eta = sqrt(etak[].sum);
real hmesh = hT[].max;
cout << "h - eta - ||u-uh||_1" << "\n";
cout << hmesh << " " << eta << " " << H1error << "\n";
plot(Th, u, wait=1);
Th = adaptmesh(Th, eta);
u = u;
cout << "h - eta - ||u-uh||_1" << "\n";
cout << hmesh << " " << eta << " " << H1error << "\n";
// cout << L2error << "\n";
}