I am trying to represent 2D deformations on a rectangular grid. In Mathematica 10, there is a method to solve the elastic differential equations and then represent the deformation as presented here:
Now I only want to visualize a deformation I actually have an analytic functional form for, i.e. I do have the functions u[x_,y_] and v[x_,y_] which represent the deformation in the x and y directions, however I cannot get it working. I thought that the PDE solver NDSolveValue returns some InterpolatingFunction so I tried to use an InterpolatingFunction type of object for u and v (which, I know it sounds stupid), but even doing so, the u["ElementMesh"] returns None so I'm completely stuck in here. Any help would be appreciated!
Bonus question: is it possible to color the mesh according to the deformation (by defining some color scale, for instance)?



nm = ElementMeshDeformation[mesh, {uif, vif}]will give you a new mesh. You could then useGraphics[ElementMeshToGraphicsComplex[nm, All, VertexColors -> (ColorData["Rainbow"] /@ Rescale[Norm[{u @@ #, v @@ #}] & /@ nm["Coordinates"]])]]to make the conversion. – user21 Dec 16 '14 at 14:04mesh["Coordinates"]instead of the deformed onesnm["Coordinates"]. It makes an imperceptible difference, but doesn't usingmeshseem the correct way to you? – Michael E2 Dec 16 '14 at 14:25mesh["Coordinates"]. – user21 Dec 16 '14 at 15:35ElementMeshToGraphoicsComplexand a variation of this example. It's going to be available in a future version. Thanks! – user21 Dec 16 '14 at 15:55{x, y}; the function of the coordinates is a function of two arguments, each a number,xandy. Look closely at the form of the definition ofcolorscalarin the two examples. The first matches theepin your comment; the second is basically like the function in my example. That's why I showed both. The curious can also ponder whyApply(@@@) andMap(/@) are the appropriate operations for each respective case. – Michael E2 Dec 16 '14 at 16:01LegendedandBarLegendwill do it. I'm in a field where legending is unimportant, unlike many others, judging by the many questions on this site about issues with legends. You might search the site, if my suggestion doesn't work. – Michael E2 Dec 31 '14 at 16:41