0
$\begingroup$

Some time ago I posted a question concerning additional graphics for SMTShowMesh[] SMTShowMesh with additional graphics Now I want to include additional graphics in SMTRestart[] session for SMTShowMesh[] generated at each calculated time step using the same approach as in the link above but it doesn't work. The example code is below

<< 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["Output" -> "Log.txt", "DumpInputTo" -> "File1"];
Clear[\[Lambda]]; \[Lambda][t_] := t;
SMTNextStep[0.01, \[Lambda]];
While[
  While[step = 
    SMTConvergence[10^-8, 10, {"Adaptive Time", 8, 0.001, 0.01, 1}],
    SMTNewtonIteration[];];
  If[Not[step[[1]]],
   force = (Plus @@ SMTResidual["X" == 0 (*&& "ID"\[Equal]"D"*)&])[[
     1]];
   SMTPut[SMTRData["Multiplier"], force];];
  If[step[[4]] === "MinBound", 
   Print["Error: \[CapitalDelta]\[Lambda] < \
\[CapitalDelta]\[Lambda]min"];];
  step[[3]] 
  , If[step[[1]], SMTStepBack[];];
  SMTNextStep[step[[2]], \[Lambda]]
  ];

<< AceFEM`;
SMTRestart["File1"];
{allkeys, allpost} = SMTGet[];
ListLinePlot[
 Map[(force = SMTGet[#][[1]]; {SMTRData["Multiplier"], -force}) &, 
  allkeys]]
(*SMSTShowMesh for the last step + additional graphics*)
SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", 
 ViewPoint -> {0, 0, Infinity}]
Show[SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", 
  ViewPoint -> {0, 0, Infinity}], 
 Graphics3D[{{Red, PointSize[0.03], Point[{0.5, 0.5, 1}]}}]]
(*SMSTShowMesh for the first step*)
Map[(SMTGet[#];
    SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", 
     "Show" -> True, ViewPoint -> {0, 0, Infinity}, 
     ImageSize -> 300];
    ) &, {allkeys[[1]]}];
(*SMSTShowMesh for the first step + additional graphics - does not work*)
Show[Map[(SMTGet[#];
    SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", 
     "Show" -> True, ViewPoint -> {0, 0, Infinity}, 
     ImageSize -> 300];
    ) &, {allkeys[[1]]}], 
Graphics3D[{{Red, PointSize[0.03], Point[{0.5, 0.5, 1}]}}]]

I see that the output from Map[(SMTGet...] is {Null} but I have no idea how to solve the problem.

$\endgroup$

1 Answer 1

1
$\begingroup$

You did two errors.

  1. The "Show"->True option creates a new notebook cell, but it does not return the graphics. "Show"->False is correct in your case. See manual: enter image description here

2)You have ended the statement with ; which in MMA results in Null.

$\endgroup$
2
  • $\begingroup$ I have changed "Show"-> False, and added semicolon: Show[Map[(SMTGet[#]; SMTShowMesh["DeformedMesh" -> True, "Field" -> "Sxx", "Show" -> False, ViewPoint -> {0, 0, Infinity}, ImageSize -> 300]; ) &, {allkeys[[1]]}];, Graphics3D[{{Red, PointSize[0.03], Point[{0.5, 0.5, 1}]}}]] but still the output is Show::gcomb: Could not combine the graphics objects in Show[Null,]. $\endgroup$
    – Binka
    Commented Jul 13 at 11:30
  • $\begingroup$ You have to remove the semicolons. It is the way how the Mathematica works. If any statement ends with ";", the result of particular statement is Null. $\endgroup$
    – JozeK
    Commented Jul 16 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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