I am changing initial positions of nodes after the analysis has been initialized (after the SMTAnalysis[...]) and this procedure works fine, but the problem is that change is not shown in postprocessing. How can I get SMTShowMesh to plot modified version of initial configuration?

The following is a small example to illustrate the problem.

<< AceFEM`;
(* A small test analysis with 1 element. *)
Clear[testAnalysis]

testAnalysis[] := (
  SMTInputData[];
  SMTAddDomain["test","OL:SEPEQ1DFHYQ1NeoHooke",{"E *"->1000.,"\[Nu] *"->0.3}];
  SMTAddMesh[{{0,0}, {1,0}, {0,1}, {1,1}},{"test" ->{{1,2,4,3}}}];
  SMTAddEssentialBoundary[{{1, 1 -> 0, 2 -> 0}, {2, 2 -> 0}}];
  SMTAddNaturalBoundary[{4, 2 -> -1}];
  SMTAnalysis[];
  );

We call the analysis function, see the initial configuration and print initial coordinates of all 4 nodes.

testAnalysis[]
SMTNodeData["X"]
SMTShowMesh[ImageSize->100,"BoundaryConditions"->True,"Marks"->"NodeNumber"]
(*{{0., 0.}, {1., 0.}, {0., 1.}, {1., 1.}}*)

one element

New values of initial coordinates are calculated (rotation of domain for 45 degrees).

newCoordinates = RotationTransform[Pi/4, {0.5, 0.5}] /@ SMTNodeData["X"]
(* {{0.5, -0.207107}, {1.20711, 0.5}, {-0.207107, 0.5}, {0.5, 1.20711}} *)

New coordinates are assigned to nodes and print of coordinates reflects that.

SMTNodeData["X", newCoordinates];
SMTNodeData["X"]
(* {{0.5, -0.207107}, {1.20711, 0.5}, {-0.207107, 0.5}, {0.5, 1.20711}} *)

Plotting of mesh does not show the change of initial coordinates. I expect to see element rotated for 45 degrees.

SMTShowMesh[ImageSize->100,"BoundaryConditions"->True,"Marks"->"NodeNumber"]

one element problem

up vote 4 down vote accepted

AceFEM stores and uses also listSMTNodes which is constructed after SMTAnalysis[] command. It seems to not be changed automaticaly when you assign new coordinates to SMTNodeData["X", newCoordinates]. If you assign the coordinates to SMTNodes manualy (2nd and 3rd positions store X and Y coordinates of each point, so do not overwrite the 1st and 4th positions) as

SMTNodes[[;; , 2 ;; 3]] = newCoordinates;

then SMTShowMesh takes the required coordinates:

SMTShowMesh[ImageSize -> 100, "BoundaryConditions" -> True, "Marks" -> "NodeNumber"]

enter image description here

I have found an alternative solution with the undocumented function SMTUpdatePostData. Apparently it works according to its name, it updates postprocessing data that has been modified after calling SMTAnalysis.

SMTUpdatePostData[]
SMTShowMesh[ImageSize -> 100, "BoundaryConditions" -> True]

rotated element

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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