Introduction to the Finite Element Method(F.E.M): A Practical Application Using Python

Written by kamalsamaila | Published 2023/08/10
Tech Story Tags: python | python-programming | structural-engineering | finite-element-method | python-tutorials | blogging-fellowship | digital-transformation | engineering

TLDRThe behavior of many engineering structures, excited from external stresses, is governed by differential equations. We can solve most of these differential equations analytically as long as we oversimplify or idealize the structure in consideration. But unfortunately, the design geometry, material properties, and loadings of these structures are complex in reality. The need to break the structural problem into subproblems, get the solution of each individual subproblem and assemble the various solutions into a global solution can be achieved using a numerical technique called finite element method.via the TL;DR App

The behavior of many engineering structures, excited from external stresses, is governed by differential equations. We can solve most of these differential equations analytically as long as we oversimplify or idealize the structure in consideration. But unfortunately, the design geometry, material properties, and loadings of these structures are complex in reality and idealization may not give the correct response due to external loads, hence the need to break the structural problem into subproblems, get the solution of each individual subproblem and assemble the various solutions into a global solution can be achieved using a numerical technique called finite element method.

Content Outline

  • Introduction
  • What is the finite element method?
  • Principles of the finite element method
  • Types of elements used in finite element analyses
  • Steps for conducting finite element analyses
  • Implementation of finite element method on a cantilever beam using python
  • Presentation of results from post-processing
  • Concusion

What is the finite element method?

The finite element method(FEM) is a numerical method for solving differential equations of boundary value problems(also known as field problems). The field normally represents a physical structure constrained by boundary conditions.

It is worth remembering that studying or analyzing an engineering structure or phenomenon with a finite element method is what is referred to as finite element analysis.

Basic principles of the finite element method

The finite element method (FEM) is a computational technique used to solve boundary value problems in engineering. Boundary value problems are also called field problems. The field is the domain of interest and most often represents a physical structure. The field variables are the dependent variables of interest governed by the differential equation. The boundary conditions are the specified values of the field variables (or related variables such as derivatives) on the boundaries of the field. The point in the finite element in which field variables are calculated is called a node. The values of the field variable computed at the nodes are used to approximate the values at non-nodal points by interpolation of the nodal values.

Interpolation function(shape function)

These are functions that describe the variations of the field variables(dependent variables) in the finite element. They are normally polynomial forms of the independent variables, derived to satisfy certain required conditions at the nodes.

Stiffness matrix

The stiffness matrix encodes the characteristic of a finite element. Considering engineering structure finite elements, the stiffness matrix will contain information relating to the geometry and material behavior of the structure. This is like the data representing the structural system. This information can indicate the resistance of the element to deformation when subjected to loading. Such deformation may include axial, bending, shear, and torsional response.

Types of elements used in the finite element method

  1. 1d element

  1. 2d element

3. 3d element

General Steps For Conducting Finite Element Analysis

  1. Preprocessing stage

In this stage, we define the following:

  • Geometry of the structure
  • Elements that make the structure
  • Define the material properties of the element
  • Define the length, area, e.t.c. of the elements(geometric properties)
  • Define the boundary condition of the structural system i.e. support conditions
  • Define the loadings acting on the structures

  1. Solution stage

In this stage, we:

  • Compute values of the field variables
  • Compute values of the field variables are then used to compute additional, derived variables, such as reaction forces, element stresses and displacement.

  1. Post-processing stage
  • In this stage, we plot the responses of the engineering structure from the solution of our finite element analysis.


Implementation of finite element method using python

We are going to analyze a cantilever beam of length 5m. It has fixed support at point A and it's free at the other end. A uniformly distributed load of 10kN/m is acting throughout the span.

This is easily implemented using a Python finite element library called anastruct.

  • At the preprocessing stage, we define:
from anastruct import SystemElements
ss = SystemElements()

ss.add_element(location=[[0, 0], [5, 0]])

ss.add_support_fixed(node_id=1)



ss.q_load(element_id=1, q=-10)
ss.show_structure()

  • At the computation stage:

ss.solve()

  • At the post-processing stage:

ss.show_shear_force()
ss.show_bending_moment()
ss.show_displacement()

Presentation of results from post-processing

  • Reaction forces due to boundary conditions

  • Bending moment

  • Shear force

  • Displacement

Conclusion

The ability of an engineer to have the skills of finite element methods in his/her toolbox will help in analyzing complex structures that analytical methods can not easily solve due to assumptions and oversimplification. And with computers becoming more powerful, the practice of utilizing finite element methods will continue to increase.


Written by kamalsamaila | A technology advocate with passion in writing programs related to finite element method for engineering analysis
Published by HackerNoon on 2023/08/10