I would like to have a GUI with a button that starts AceFEM analysis and then some results appear. I have taken one example from the documentation on boundary condition specification and I wrapped it into a function. It works and returns graphics of the deformed mesh
<< AceFEM`
buttonContent[load_?NumberQ] := Module[{H = 50, A = 100, B = 75},
SMTInputData[];
SMTAddDomain["A","OL:SED3H1DFHYH1NeoHooke", {"E *" -> 1000., "ν *" -> .49}];
SMTAddMesh[
Hexahedron[{{0, 0, 0}, {A, 0, 0}, {A, B, 0}, {0, B, 0}, {0, 0, H}, {A, 0, H}, {A, B, H}, {0, B, H}}],
"A", "H1", {20, 15, 10}
];
SMTAddEssentialBoundary[
Polygon[{{0, 0, 0}, {0, B, 0}, {0, B, H}, {0, 0, H}}],
1 -> 0, 2 -> 0, 3 -> 0
];
SMTAddNaturalBoundary[
Polygon[{{0, B/2, H}, {A/2, B/2, H}, {A/2, B, H}, {0, B, H}}],
3 -> Polygon[{load}]
];
SMTAnalysis[];
Do[
SMTNextStep["Δλ" -> 0.1];
While[SMTConvergence[10^-8, 12], SMTNewtonIteration[];];,
{i, 1, 10}];
SMTShowMesh["DeformedMesh"->True,"BoundaryConditions"->True,"Field"->"u"]
]
buttonContent[-100]
When I use this function as the Button
action it seems that analysis is initialized, but there are no results. Why is this happening? Is not possible to use AceFEM functions in Dynamic
expressions and other GUI elements?
Column[{
InputField[Dynamic[load], Number, FieldSize -> 8],
Row[{"Load= ", Dynamic[load]}],
Row[{
Button["Calculate", gr = buttonContent[load]],
Button["Clear", gr = ""]
}],
Dynamic[gr]
}, Frame -> True]
Method->"Queued"
option toButton
it aborts after ~6 seconds. $\endgroup$