Sometimes (implicit) finite element analysis with AceFEM diverges and solution procedure is aborted before reaching the final time/load step. I have followed the method shown in documentation for collecting results in the analysis loop. If analysis successfully finishes completely the list of results is returned and if it diverges nothing is returned. How can I get results for all successful steps before divergence occurred? The following small example illustrates the problem.
<< AceFEM`
(* Function to collect results (residual force and displacement in X direction) *)
getResults[] := {Total[SMTResidual["X" == 1 &]][[1]],
SMTPostData["u", {1, 0, 0}]}
(* Setup of compression test of hyperelastic material with prescribed force. *)
setup[force_?NumberQ] := Module[{n = 5},
SMTInputData[];
SMTAddDomain["test", "OL:SED3H1DFHYH1NeoHooke", {"E *" -> 1}];
SMTAddMesh[
Hexahedron[{{0,0,0},{0,1,0},{0,1,1},{0,0,1},{1,0,0},{1,1,0},{1,1,1},{1,0,1}}],
"test", "H1", {n, n, n}
];
SMTAddEssentialBoundary[{ "X" == 0 &, 1 -> 0, 2 -> 0, 3 -> 0}];
SMTAddNaturalBoundary[
Polygon[{{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}}],
1 -> Polygon[{force}]];
SMTAnalysis[];
]
(* Analysis loop with constant load step. *)
analysis[force_?NumberQ, nstep_Integer] := Module[{results = {}},
setup[force];
AppendTo[results, getResults[]];
Do[
SMTNextStep["Δλ" -> 1./nstep];
While[SMTConvergence[10^-8, 15], SMTNewtonIteration[]];
(* Collect results in converged step. *)
AppendTo[results, getResults[]],
{i, 1, nstep}
];
results
]
Analysis finishes successfully and a list is returned.
analysis[-0.1, 10]
(*{{0., 0.}, {-0.01, -0.00964376}, {-0.02, -0.0191696}, {-0.03,-0.0285796}, {-0.04, -0.0378759}, {-0.05, -0.0470607}, {-0.06, -0.0561361}, {-0.07, -0.0651046}, {-0.08, -0.0739684}, {-0.09, -0.0827299}, {-0.1, -0.0913916}}*)
Analysis diverges in 5. step and nothing is returned (actually symbol $Aborted
is returned).
analysis[-1, 10]