This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Extract a surface from a 3D mesh and save as a 2D .xml / .pvd with function values applied.

0 votes

I need to plot a Function over just the surface of my problem. I have a FacetFunction which defines the surfaces, and am using the python interface.

Thanks!

asked Nov 3, 2013 by pf4d FEniCS User (2,970 points)
edited Nov 19, 2013 by pf4d

BUMP

1 Answer

+2 votes
 
Best answer

Hi,

you can create the mesh function on facet. Then write out the mesh function on facet to pvd file, which is used in Paraview. Then in Paraview, you can extract the surface easily according to the value of mesh function on the surface facet.

answered Nov 3, 2013 by jying FEniCS User (2,020 points)
selected Nov 27, 2013 by pf4d

So I have the FacetFunction object and have written it out to ff.pvd.

This gives me a nice file with the surfaces highlighted. However, I need to extract the values of a different function over these surfaces.

Ideally, I would like to output this subset of the function directly with Fenics, independent of ParaView.

Is this possible?

Yes, if i understand correctly.

I would do the following:

u is the function type
facet_domains is the meshfunction type with value on the surface

then get the value on "the facet" by returning an array by the following segment:

u_sub = u.vector().array()[facet_domains==value]

Now you extract the value on the surface and can do what you want to

...