Hello Fréderic,
Regarding the last example that you have mentioned:
load "distance"
int[int] lb=labels(Th);:
varf vb(u,v) = on(lb,u=1):
Vh ub= vb(0,Vh,tgv=1);// 1 on all arder and zero inside
ub[] = ub[] ? 0 : 1; // 0 on border and 1 inside
Vh dist;
distance(Th,ub,dist);
plot(ub,wait=1);
By applying it initially to a square domain in the following form:
load “iovtk”
load “distance”
//mesh Th=readmesh(“Square2d.mesh”);
mesh Th=square(10,10);
int[int] lb=labels(Th);
fespace Vh(Th,P1);
Vh u,v;
varf vb(u,v) = on(lb,u=0);
//+on(2,3,4, u=-1);
Vh ub = vb(0,Vh, tgv=1);
plot(ub, wait=1, value=1);
ub = ub ? 0:1;
plot(ub,wait=1,value=1);
Vh dist;
distance(Th,ub,dist,distmax=100);
plot(dist,wait=1,value=1,nbiso=100);
savevtk(“distance.vtk”,Th,dist,dataname=“distance”);
When i plot the distance filed i get:
[image]
The representation I get is above. Could you give me a hint of what’s faling or missing in the code in order to obtain the desired distribution? The idea is to reproduce this method in a ficticious domain which embeds a smaller square domain and compute a lavel set phi function:
[image]
Thank you in avance.
Best Regards
Jacob