I'm solving a linear elasticity problem and trying to plot a displacement/stress fields over the deformed mesh instead of the undeformed one. The deformed (red) and undeformed (black) meshes look like:
I tried the following:
Plot over undeformed mesh with
ContourPlot[vfun[x, y], {x, y} \[Element] mesh,
AspectRatio -> Automatic, PlotRange -> All,
ColorFunction -> ColorData["LightTemperatureMap"], Contours -> 50,
ContourLines -> False, ImageSize -> 200, PlotLegends -> Automatic]
and get
Plot over deformed mesh with
deformedMesh = ElementMeshDeformation[mesh, {ufun, vfun}];
ContourPlot[vfun[x, y], {x, y} \[Element] deformedMesh,
AspectRatio -> Automatic, PlotRange -> All,
ColorFunction -> ColorData["LightTemperatureMap"], Contours -> 50,
ContourLines -> False, ImageSize -> 200, PlotLegends -> Automatic]
and get
Since the domain of the deformed and undeformed meshes are differents, we are plot the interpolation function of the displacement over two different domains, hence the two contour plots are different. That is, the displacement values over the deformed mesh is not the one I want. I need keep displacement values unchanged but plotted over the deformed mesh.
This maybe a simple question. But I need help on this.
The minimum code is as follows.
ClearAll["Global`*"]
Needs["NDSolve`FEM`"]
op = {Inactive[
Div][({{0, -((Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu])))}, {-(Y/(
2 (1 + \[Nu]))), 0}}.Inactive[Grad][v[x, y], {x, y}]), {x,
y}] + Inactive[
Div][({{-((Y (1 - \[Nu]))/((1 - 2 \[Nu]) (1 + \[Nu]))),
0}, {0, -(Y/(2 (1 + \[Nu])))}}.Inactive[Grad][
u[x, y], {x, y}]), {x, y}],
Inactive[
Div][({{0, -(Y/(2 (1 + \[Nu])))}, {-((
Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu]))), 0}}.Inactive[Grad][
u[x, y], {x, y}]), {x, y}] +
Inactive[
Div][({{-(Y/(2 (1 + \[Nu]))),
0}, {0, -((
Y (1 - \[Nu]))/((1 - 2 \[Nu]) (1 + \[Nu])))}}.Inactive[
Grad][v[x, y], {x, y}]), {x, y}]} /. {Y -> 2.5, \[Nu] ->
1/4};(*note the negative sign in the expressions*)
Subscript[\[CapitalGamma],
D] = {DirichletCondition[{u[x, y] == 0.}, x == 0],
DirichletCondition[{v[x, y] == 0.}, y == 0]};
{ufun, vfun} =
NDSolveValue[{op == {0, -1}, Subscript[\[CapitalGamma], D]}, {u,
v}, {x, 0, 1}, {y, 0, 2}];
(*\[Del]\[CenterDot]\[Sigma]+Overscript[b, \[RightVector]]=0, given \
Overscript[b, \[RightVector]]={0,-1}*)
mesh = ufun["ElementMesh"];
Show[{
mesh["Wireframe"[ "MeshElement" -> "BoundaryElements"]],
ElementMeshDeformation[mesh, {ufun, vfun}][
"Wireframe"[
"ElementMeshDirective" -> Directive[EdgeForm[Red], FaceForm[]]]]}]
ContourPlot[vfun[x, y], {x, y} \[Element] mesh,
AspectRatio -> Automatic, PlotRange -> All,
ColorFunction -> ColorData["LightTemperatureMap"], Contours -> 50,
ContourLines -> False, ImageSize -> 200, PlotLegends -> Automatic]
deformedMesh = ElementMeshDeformation[mesh, {ufun, vfun}];
Show[{mesh["Wireframe"],
deformedMesh[
"Wireframe"[
"ElementMeshDirective" ->
Directive[EdgeForm[{Thin, Red}], FaceForm[]]]]}]
ContourPlot[vfun[x, y], {x, y} \[Element] deformedMesh,
AspectRatio -> Automatic, PlotRange -> All,
ColorFunction -> ColorData["LightTemperatureMap"], Contours -> 50,
ContourLines -> False, ImageSize -> 200, PlotLegends -> Automatic]