Indicator Function for 3d Mesh


I have a three dimensional geometry with different subdomains. To implement my weak form including the region boundaries, I was following the approach recommended in this thread.

My confusion now is that the indicator function is not acting as expected since it is indicating some sides of the domain (see the attached example adapted from the tutorials). I checked the current tutorials and the difference from the working examples appears to be that this is a three dimensional mesh. I’m not sure if I have to adapt my example somehow or if the CoefficientFunction does not have this information like it doesn’t have the boundary region information?

I also tried setting GridFunctions as a workaround but these are interpolating into neighboring subdomains – maybe there is a way to prevent this?

Please let me know and thanks in advance,


Hi Josie,

the CoefficientFunction( list ) has one value per material, or one value per boundary, depending on the context. Drawing the surface mesh interprets it as one value per boundary.

If you clip and visualize L in the clipping plane, it looks as you expect.

You can also say:

cf = BoundaryFromVolumeCF(CoefficientFunction(values_list))
Draw(cf, mesh, "L")

Then the surface visualization evaluates the CF inside the volume elements next to the surface.


I see, so it was just the visualization and the indicator function was defined one value per material as I expected it to be. I also just verified this with vtk out.
Thank you for the explanation!