Welcome to the World of Modelling and Simulation

What is Modelling?

This blog is all about system dynamics modelling and simulation applied in the engineering field, especially mechanical, electrical, and ...

Learning Mathematica, Lesson 2: Solving Euler-Bernoulli Beam Equation

In this lesson, I would like to show the advantages of the Mathematica built-in solver to evaluate the analytical solution of a differential equation. For example, if we want to solve the well-known fourth order Euler-Bernoulli equation to solve a problem of a cantilever beam, the Mathematica code has very user-friendly features to do so. In following figure, we see that the beam has one fixed end and the other end has a concentrated load acting downward.

The following Mathematica program determines the analytical displacement function and plots the result. Most of the lines are commented as explanations for the line of codes to understand the respective operation.

Cantilever beam with a fixed end and concentrated load at free end
Cantilever beam with fixed end

(*Determination of the Exact Solution of an Euler-Bernoulli Beam*)
Clear[y, P, x, EI, L]
y[x]; (*The Final Solution, y*)
(*Defining the constant parameters, just assuming unit values*)
h = 1; (*Beam height*)
P = 1; (*Concentrated load at the end*)
L = 10; (*Beam length*)
b = 1; (*Beam width*)
Ie = 1/ 12; (*Moment of inertia*)
Ee = 10 000; (*Young's Modulus*)
EI = Ee* Ie; (*Flexural Modulus*)
th = D[y[x], x]; (*Slope*)
V = EI* D[y[x], {x, 3}]; (*Shear force*)
M = EI* D[y[x], {x, 2}]; (*Bending moment*)
(*Defining the boundaries of the problem*)
y1 = y[x] /. x → 0;
y2 = y[x] /. x → L;
th1 = th /. x → 0;
th2 = th /. x → L;
M1 = M /. x → 0;
M2 = M /. x → L;
V1 = V /. x → 0;
V2 = V /. x → L;
(*Using DSolve a built-in solver to solve beam equation*)
s = DSolve[{EI* y''''[x] ⩵ 0, y1 ⩵ 0, th1 ⩵ 0, V2 ⩵ P, M2 ⩵ 0}, y, x];
Print["The Exact Displacement Function"]
y = Simplify[y[x] /. s[[1]]]
Plot[y, {x, 0, 5}, PlotStyle → {Green, Thick}]
Print["Displacement at the tip of the beam in Y direction"]

Mathematica generates the analytical solution function which is seen below. This feature is very useful as you may solve any differential equations analytically and get the results symbolically as well like this problem.

analytical solution function

No comments:

Post a Comment