Initialisation in different regions

Dear all,


mesh Th;
int fluid=Th(x0,y0).region, solid=Th(x1,y1).region; 
fespace Vh(Th,P1);
Vh phi;

How can we initialise phi=0 in the fluid region, while phi=1 in the solid region?

phi = 0*(region == fluid) + 1*(region == solid);

Does this meet your expectations?

@henkel thank you, this looks nice. i will have a try.