Got it, thank you! I understand that putting such strong Dirichlet condition on a discontinuous space is not “natural”. Nevertheless it can be useful sometimes.
Dear Frédéric,
Is the following code correct to set strong Dirichlet BC with tgv=-1 on a discontinuous fespace
(following example of examples/tutorial/LapDG2.edp) dg-elliptic-test.edp (3.6 KB)
?
The main lines are
//**** modify matrix and rhs to set the strong Dirichlet BC ****
varf bdryTh(u,v)=int1d(Th,1,2,3,4)(v);
real[int] bdryVhh=bdryTh(0,Vhh);// find the bdry dof
setBC(A,bdryVhh,-1);//tgv=-1
rhs= bdryVhh ? uexh[] : rhs ;
//*************************
There is a problem in my code, now I understand what you said: the location of dof of P1dc are not on the boundary of the triangle, but slightly inside as the small circles in the picture below
It follows that the integral on a boundary will also involve dof out of the boundary (with a small negative weight).
I think then that the correct way should be with two additional lines
//**** modify matrix and rhs to set the strong Dirichlet BC ****
varf bdryTh(u,v)=int1d(Th,1,2,3,4)(v);
real[int] bdryVhh=bdryTh(0,Vhh);// find the bdry dof
real bdryVhhmax=bdryVhh.linfty;
for [i,val : bdryVhh] val=(val>0.01*bdryVhhmax);
setBC(A,bdryVhh,-1);//tgv=-1
rhs= bdryVhh ? uexh[] : rhs ;
//*************************