Problem with creating vector with scalar function components

This command assembles (integrates) the function Sn[2] over the boundary ds.
If you want to visualize Sn[2] on your mesh, you need to project Sn[2] into a suitable function space (usually a discontinuous space of one lower degree than the displacement). As you are using the normal vector, which is only defined on facets, you need to do a custom projection of Sn[2], see for instance How to plot normal unit vector of faces in a 2D mesh? - #2 by dokken
where you should change l to be l = inner(Sn[2], v)*ds.
As the stress is a discontinuous function if you follow my suggestion of appropriate function space, you should use XDMFFile.write_checkpoint so that you visualize the actual function and not a CG-` interpolation. See for instance: Read mesh from XDMF file (write_checkpoint) - #2 by WeiOng

1 Like