The problem is that the space Vh
you give in matrix A = avar(Vh, Vh, tgv = -1)
has not the right size, since varf avar([ur, uz], [vr, vz])
has two unknowns ur,uz
.
You have to set
fespace Vh2(Th,[P1,P1]);
Vh2 [u1,u2];
The space Vh2
has the right size. Then you correct your system resolution by
matrix A = avar(Vh2, Vh2, tgv = -1); // System matrix
real[int] b = Lrhs(0, Vh2); // Right-hand side vector
set(A, solver = sparsesolver);
real[int] sol = A^-1 * b;
u1[]=sol;// distribute the solution to [u1,u2], that belongs to Vh2
ur=u1;
uz=u2;