How to find Shear Force and Bending Moment in Finite Element Method for a cantilever beam with many elements

I have a cantilever beam with lots of elements. I am trying to find the sheer force and bending moment diagrams of the beam.

EVERY SINGLE TUTORIAL AND EXAMPLE I SAW ONLINE SHOWS HOW TO DO IT FOR A CANTILEVER BEAM WITH 2 ELEMENTS

But I want it for multiple elements.

I am taking n elements in my beam. I have calculated the global stiffness matrix = K and global mass matrix = M each of size (2n, 2n)

I was able to find the deformation by passing the static loads as a vecor of size (2n, 1) in the form

F = [f1, m1, f2, m2, f3, m3 ... ]

Where

fn is the point load at nth node and mn is the moment at the nth node

I find the transverse deflection and angular displacement at each node by

X = inv(K).F


Is there any such way to find the shear force and bending moment values for this case? Where n is very large (600 in my case)

I am doing it in python.

Thanks


Unfortunately space derivatives of displacement are not continuous the boundaries between two finite elements, so that you can't get a continuous distribution of strain, stress and internal actions across the beam simply evaluating the space derivatives of the FEM solutions.

Euler Beam - bending. On the other hand, it's possible to evaluate stress and internal actions in a structure using other methods. Here, I'll show you a way to recover reactions at constraints and internal actions for a cantilever Euler beam, of length $$\ell$$, clamped in $$x=0$$, with free end in $$x=\ell$$, whose transverse displacement $$w(x,t)$$ is governed

$$m \ddot{w} - T' = f(x,t) \quad , \qquad x \in [0,\ell]$$
$$M' + T =0$$
$$w(0,t) = 0, \quad w'(0,t) = 0, \quad M(\ell,t) = 0, \quad T(\ell,t) = 0$$

being $$M(x,t) = (EJ(x,t)w(x,t))''$$ the constitutive law for the bending moment, so that you can write the indefinite equilibrium equation and the boundary conditions at the free ends as

$$m \ddot{w} + (EJ w'')'' = f(x,t) \quad , \qquad x \in [0,\ell]$$
$$EJw''(\ell,t) = 0, \quad (EJw''(\ell,t))' = 0$$

Euler Beam - bending: Weak formulation. Now we can write the weak form of the equations

• dynamical equation in terms of $$w(x,t)$$ only:

$$\displaystyle \int_0^\ell \delta w m \ddot{w} + \int_0^\ell \delta w'' EJ w'' = \int_0^\ell \delta w f$$

• equations for internal actions (I'm not 100% that integration by part is needed here, but you can try): $$\displaystyle \int_0^\ell \delta \phi m \ddot{w} -\int_0^\ell \delta \phi T' = \int_0^\ell \delta \phi f \qquad \rightarrow \qquad \displaystyle \int_0^\ell \delta \phi m \ddot{w} - \underbrace{\delta \phi(\ell) T(\ell,t)}_{=0, \quad b.c.} + \delta \phi(0) T(0,t) + \int_0^\ell \delta \phi' T = \int_0^\ell \delta \phi f$$
$$\displaystyle \int_0^\ell \delta \varphi M' + \int_0^\ell \delta \varphi T = 0 \qquad \rightarrow \qquad \underbrace{\delta \varphi(\ell)M(\ell,t)}_{=0, \quad b.c.} - \delta \varphi(0)M(0,t) -\displaystyle \int_0^\ell \delta \varphi' M + \int_0^\ell \delta \varphi T = 0$$

having introduced test functions $$\delta \phi$$, $$\delta \varphi$$ for the equations of the internal actions.

Finite element problem. The equation for the displacement $$w(x,t)$$ can be solved introducing the finite element approximation $$w(x,t) = \mathbf{N}_w^T(x) \mathbf{w}(t)$$ and using the same test functions as the base functions $$\mathbf{N}_w(x)$$, i.e. the equation

$$\displaystyle \int_0^\ell \mathbf{N}_w(x) m(x) \mathbf{N}_w^T(x) \mathbf{\ddot{w}}(t) + \int_0^\ell \mathbf{N}^{''}_w(x) EJ(x) \mathbf{N}_w^{''T}(x) \mathbf{w}(t) = \int_0^\ell \mathbf{N}_w f(x,t)$$

$$\mathbf{M} \mathbf{\ddot{w}} + \mathbf{K} \mathbf{w} = \mathbf{f}$$

We can solve the equations of the internal actions introducing the approximation of the internal actions
$$T(x,t) = \mathbf{N}^T_T(x) \mathbf{t}(t)$$,
$$M(x,t) = \mathbf{N}^T_M(x) \mathbf{m}(t)$$

to get the discrete version of the weak formulation of the problem writeen above, that can be written as

$$\mathbf{M}_\phi \mathbf{\ddot{w}} + \mathbf{C}_\phi \mathbf{t} = \mathbf{f}_\phi$$
$$\mathbf{M}_\varphi \mathbf{t} + \mathbf{C}_\varphi \mathbf{m} = \mathbf{0}$$,

being matrices with the subscripts $$\phi$$ or $$\varphi$$ the finite element matrices computed using test functions $$\phi$$, $$\varphi$$.

These two equations, that should be the equations you need to evaluate internal actions, can be solved after the evaluation of the displacement field $$w$$, to recover internal actions.

Pay attention that $$\mathbf{C}_\phi$$ and $$\mathbf{C}_\varphi$$ must be invertible, to solve the system formally as

$$\mathbf{t} = \mathbf{C}_\phi ^{-1} \left[ \mathbf{f}_\phi - \mathbf{M}_\phi \mathbf{\ddot{w}} \right] \qquad$$ and thus
$$\mathbf{m} = - \mathbf{C}^{-1} _\varphi\mathbf{M}_\varphi \mathbf{t}$$,