# Plotting a 3D FEA solution on the mesh

I have obtained solution to a 3D FEA problem and would like to plot it on the mesh. The geometry has holes in it. For example, if u[x,y,z] is an interpolation function, obtained from a FEA solution, then is there an equivalent command to contourplot and contourplot3D such that i can plot the solution on the mesh. If i directly use the commands contourplot and contourplot3D, then the plot does not show the holes in the mesh (or geometry).

Contourplot3D[U[x,y,z],{x,y,z}\[Element]mesh]


However, this function does not work because you cannot give a mesh as the domain data. I would also like to know how could i plot a 2D contour at a surface. For example something like this,

Block[{z=0.1},Contourplot2D[U[x,y,z],{x,y,z}\[Element]mesh]]


Is there any alternative to this plotting function? I would appreciate any help in this regard.

• provide a sample code with specific problem. Mar 22, 2018 at 21:33
• @NavidRajil I have updated the question, thanks. Mar 23, 2018 at 14:50
• @KVK318, typically this means that you should give a complete copy and past-able code to reproduce the issue you want to illustrate. Next time. Mar 23, 2018 at 15:24
• @user21 I am sorry about that, I will do that next time. Mar 25, 2018 at 0:24

Needs["NDSolveFEM"]
r = RegionDifference[Cuboid[{-2, -2, -2}, {2, 2, 2}], Ball[]];
mesh = ToElementMesh[r];
mesh["Wireframe"] SliceContourPlot3D[x^3 + y^2 - z^2, Element[{x, y, z}, mesh]] Or:

SliceContourPlot3D[x^3 + y^2 - z^2, MeshRegion[mesh],
Element[{x, y, z}, mesh]] • @user21Thanks. This function works but i would also like to plot the solution over the entire domain instead of slices. I have updated my question top explain better what i am trying to do. Mar 23, 2018 at 14:52
• @user21Thanks. I just figured out that the SliceContourPlot3D solves one of my problems which is I can plot a contour on a slice which is equivalent to ContourPlot in 2D. However, i would also like to plot the solution over the entire domain instead of slices. Mar 23, 2018 at 15:05
• @KVK318, see update. Also have a look at the documentation of SliceContourPlot3D Mar 23, 2018 at 15:23
• @user21Thanks, this is exactly what i was looking for. Mar 25, 2018 at 0:26