Is there an example to solve the Laplace equantion with Neumann boundary conditions using lagrange multipliers but in a scenario that it’s not 1D? I did the follwing but I’m getting errors.
fespace VhK(Th[i], Pk);
fespace V0K(Th[i], P0);
VhK etaK, etaf, phiK, varphi;
V0K vj, vf;
int ndofVhK = VhK.ndof;
int ndofV0K = V0K.ndof;
varf ah(etaf,varphi)
= int2d(Th[i])(kappa*grad(etaf)'*grad(varphi));
varf fh(etaf,varphi)
= int2d(Th[i])(f * varphi);
varf bh(vf, varphi)
= int2d(Th[i])(1.*varphi);
matrix A = ah(VhK,VhK); //stiffness matrix
//real[int] B = bh(0,VhK);
matrix B = bh(V0K,VhK);
real[int] F(ndofVhK);
F = fh(0,VhK);
//the block matrix
matrix AA = [ [ A , B ] ,
[ B', 0 ] ] ;
real[int] bb(ndofVhK+ndofV0K),xx(ndofVhK+ndofV0K),b1(ndofV0K),l(ndofV0K);
b1=0;
// build the block rhs
bb = [ F, b1];
set(AA,solver=UMFPACK);
xx = AA^-1*bb; // solve the linear system
[etaf[],l] = xx; // set the value
plot(etaf,wait=1, fill=1);