I am interested to see how to create a simple example of dynamic FEM analysis implemented with AceFEM package. Dynamic analysis means that inertial effects are taken into account. The package documentation includes just one (rather complex) example of snooker balls colliding with each other and I think that it is not really helpful for beginners.

I have seen that somebody has already asked a similar (but poorly phrased) question on this site about dynamic analysis with AceFEM, but their question was later deleted. Maybe this could help them.


This is my try to create some simple example of vibrating cantilever beam, loaded by impulse force. I am not an expert in this field, so any comments on the quality of solution are welcome.

Below is the picture of the mesh, nodes on the left are constrained and nodes on the right edge have time dependent prescribed force.

setup[1000, 1]
SMTShowMesh["BoundaryConditions" -> True, ImageSize -> 300]


I have chosen that force will be prescribed as short impulse (half of sinusoidal curve). It could also be some other continuous curve, starting from 0.

λf = createLoadFunction[0.5];
Plot[λf[t], {t, 0, 5}, AxesLabel -> {"time", "force"}]



First we create a function for setting up the problem. The source code for dynamic element subroutine "ExamplesHypersolidDynNewmark" is given in the AceFEM documentation. The Newmark method is used for time integration, damping is neglected and large strain theory is assumed.

Options[setup] = {"NoElements" -> 5};
setup[elasticModulus_: 1000, density_: 0.1, opts : OptionsPattern[]] := Module[
  {n, a = 10, b = 1},
  n = Round@Clip[OptionValue["NoElements"], {1, 100}];
  SMTAddDomain["test", "ExamplesHypersolidDynNewmark",
   {"E *" -> elasticModulus, "ν *" -> 0.3, "ρ0*" -> density}
  SMTMesh["test","Q1", {5 n, n}, {{{0, 0}, {a, 0}}, {{0, b}, {a, b}}}];
  SMTAddEssentialBoundary[{ "X" == 0 &, 1 -> 0, 2 -> 0}];
  SMTAddNaturalBoundary[{Line[{{a, 0}, {a, b}}], 2 -> Line[{1}]}];

Helper functions to define loading function (force vs. time) and collect analysis results.

createLoadFunction[impulseTime_] := Function[{t},
  Piecewise[{{Sin[t*Pi/impulseTime], t < impulseTime}}, 0]

makePicture[name_String] := SMTShowMesh[
   "DeformedMesh" -> True,
   "BoundaryConditions" -> True,
   "Field" -> "v",
   "Contour" -> {False, -1, 1, 5},
   "Show" ->(*"Window"|*){"Animation", name, ImageSize -> 450},
   "Legend" -> False,
   PlotRange -> {{-0.5, 11}, {-2, 3}}

getResults[pt_] := {SMTRData["Time"], SMTPostData["v", pt]}

Analysis function with constant time step.

Options[analysis] = {"AnimationQ" -> False, "ImpulseTime" -> 0.5, "TotalTime" -> 5};
analysis[elasticModulus_, density_, opts : OptionsPattern[]] := 
 Module[{tMax, Δt, steps, λf, results = {}},

  Δt = 0.05;(* fixed size time step *)
  tMax = OptionValue["TotalTime"];
  steps = Round[tMax/Δt];(* calculated number of steps *)

  setup[elasticModulus, density];
  λf = createLoadFunction[OptionValue["ImpulseTime"]];
   SMTNextStep["Δt" -> Δt, 
    "λ[t]" -> λf];
   (* Collect displacement in bottom right corner in every time step.  *)
   AppendTo[results, getResults[{10, 0}]];
   If[TrueQ@OptionValue["AnimationQ"], makePicture["beam"]];
    SMTConvergence[10^-8, 10],
   {i, 1, steps}];


Example of how the displacement of the right side bottom node changes with time and material density. Arguments of the main function analysis are material elastic modulus and material density. Besides domain geometry these are parameters affecting the vibration behavior of a structure.

With[{list = {0.02, 0.05, 0.1}},
  Table[analysis[1000, i], {i, list}],
  Joined -> True,
  PlotLegends -> LineLegend[
    ColorData[97, "ColorList"],
    LegendLabel -> "material \n density"
  AxesLabel -> {"time", "displacement"},
  LabelStyle -> 14


Animation of cantilever beam vibrations.

results = analysis[1000, 0.1, "AnimationQ" -> True, "TotalTime" -> 10];
ListPlot[results, Joined -> True, AxesLabel -> {"time", "displacement"}]




| improve this answer | |

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.