3
$\begingroup$

I make some simulations in AceGen and AceFEM using H1 finite elements. After computations I want to present results, in particular, deformed (or undeformed) mesh with some map (e.g. stress component) and red circle which denotes some chosen point. How can I combine SMTShowMesh with Graphics[Disc[]] located at certain point?

<< AceFEM`;   
SMTInputData[];
SMTAddDomain["Domain1", "OL:SED3H1DFHYH1NeoHooke", {}];
SMTAddEssentialBoundary[{"X" == 0 &, 1 -> 0, 2 -> 0, 3 -> 0}];
SMTAddEssentialBoundary[{"X" == 1 &, 1 -> 1}];
SMTMesh["Domain1", "H1", {5, 5, 5}, {{{{0, 0, 0}, {1, 0, 0}}, {{0, 1, 0}, {1, 1, 0}}}, {{{0, 0, 1}, {1, 0, 1}}, {{0, 1, 1}, {1, 1, 1}}}}];
SMTAnalysis[];
SMTNextStep[1, 1];
SMTNewtonIteration[];

For this example I want to obtain a figure with deformed mesh in planar view xy with small red disk situated at point x=0.5, y=0.5 (in the same coordinate system as deformed mesh)

SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", ViewPoint -> {0,0,Infinity}]
Graphics[Disk[{0.5, 0.5}, 0.1]]

I tried to use Show[] and Rasterize[], as below, but it does not work (there is no red disc)

Show[Rasterize[
  SMTShowMesh["DeformedMesh" -> True,"Field"->"Sxx", ViewPoint -> {0, 0, Infinity}]],
 Graphics[{Red, Disk[{0.5, 0.5}, 0.1]}]]

I will be grateful for help.

$\endgroup$

1 Answer 1

4
$\begingroup$

The problem is that you tried to combine expressions with different Head in Show command and that doesn't work. SMTShowMesh produces either Graphics or Graphics3D, depending on number of FEM model dimensions and Rasterize command returns Image.

(* ... evaluate this after running the original analysis in the OP's question *)    
Head[Rasterize[SMTShowMesh[]]]
(* Image *)

Head[SMTShowMesh[]]
(* Graphics3D *)

This is one of many possible solutions. I used Point object, because Disk doesn't exist in 3 dimensions.

Show[
 SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", ViewPoint -> {0, 0, Infinity}],
 Graphics3D[{
   {Red, PointSize[0.03], Point[{0.5, 0.5, 1}]}
   }]
 ]

mesh1

You mentioned something about plotting this point in deformed coordinate system. This is how you plot the same point in initial and deformed configuration.

initialPt = {0.9, 0.9, 0.5};
displacement = SMTPostData[{"u", "v", "w"}, initialPt];
deformedPt = initialPt + displacement;

Show[
 SMTShowMesh["DeformedMesh" -> False, "Mesh" -> Black, "FillElements" -> False],
 SMTShowMesh["DeformedMesh" -> True, "Mesh" -> Blue, "FillElements" -> False],
 Graphics3D[{
   {Black, PointSize[0.02], Point[initialPt]},
   {Blue, PointSize[0.02], Point[deformedPt]}
   }],
 ViewPoint -> {0, 0, Infinity}
 ]

mesh2

$\endgroup$
3
  • $\begingroup$ Thank you very much for your help, it works! $\endgroup$
    – Binka
    Sep 21, 2017 at 7:54
  • $\begingroup$ @Binka I'm glad to help. I suggest that you upvote the answers you like and accept the one that you like the most or the one that works for you. Please, take the quick tour to see how this site works. $\endgroup$
    – Pinti
    Sep 21, 2017 at 8:02
  • $\begingroup$ thanks for useful advice, now I'm much more familiar with rules working on stackexchange website. $\endgroup$
    – Binka
    Sep 22, 2017 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.