Updated 7 September 2024
Reading time: 20 mins

Machine Learning in Civil Engineering - Sensitivity Analysis

Part 1 - Sensitivity analysis - using the adjoint method to iteratively optimise a truss structure
[object Object]
by Ehsan Es'haghi
Download the complete Jupyter Notebook for this tutorial.

Download the complete Jupyter Notebook for this tutorial.

A quick introduction from Seán

Welcome to our first tutorial on machine learning in civil engineering! In this series, Ehsan Es'haghi will explore how machine learning can be used to solve complex engineering problems.

We'll start by learning how to define a simple optimisation objective function, such as minimising compliance in a structure. From there, we'll explore the concept of sensitivity analysis and its crucial role in optimisation problems. Then, we’ll focus on the adjoint method, a clever and widely used technique in industrial optimisation software. To tie everything together, we'll implement these concepts from scratch in Python, working through an example where we iteratively modify the size of elements in a truss structure.

By the end of this tutorial, you'll have a solid understanding of sensitivity analysis and be ready to tackle more advanced topics in machine learning and structural optimisation.

📂 Make sure to download the Jupyter Notebook (linked above) to run locally as you read through the tutorial.

Now, over to Ehsan!

Dr Sean Carroll
Dr Seán Carroll CEng MIEI
Founder of EngineeringSkills.com

In this tutorial, our goal is to redistribute a fixed amount of material among the elements of a truss in order to minimise the total deformation of the structure.

Our case-study structure for this exercise is the 2D truss shown in Fig 1. below. For the purpose of this discussion, let’s assume that 100kg100 \:kg of steel has been used to construct the truss.

Essentially, by removing some elements and increasing the size of others, we can reduce the deformation while maintaining the same overall weight. Our task now is to establish a systematic way of achieving this goal.

Case-study 2D truss consisting of a fixed quantity of steel | EngineeringSkills.com

Fig 1. Case-study 2D truss consisting of a fixed quantity of steel (100kg100\:kg).

1.0 The constrained optimisation problem

In the field of layout optimisation, global compliance is a commonly used optimisation objective. It refers to the sum of the work done on the structure's nodes and is equivalent to the total strain energy stored in the structure.

This measure reflects the structure's flexibility; thus, minimising compliance ensures the structure is as stiff as possible, reducing deformations under load and enhancing structural performance.

Mathematically, in terms of the applied force vector F\mathbf{F}, the stiffness matrix K\mathbf{K}, and the displacement vector U\mathbf{U}, the compliance CC is given by:

C=FTUC = \mathbf{F}^T \mathbf{U}

Our aim is to solve the following constrained optimisation problem:

Minimise FTU\mathbf{F}^T \mathbf{U} by modifying the size of the elements
subject to: the weight of the structure remaining 100kg100 \:kg
where: KU=F\mathbf{K} \mathbf{U} = \mathbf{F}

Note that F\mathbf{F} and U\mathbf{U} are vectors, so their dot product is given by,

FU=i=1NFiUi\mathbf{F} \cdot \mathbf{U} = \sum_{i=1}^{N} F_{i} \cdot U_i

which represents the total work done on the structure's nodes by the external force.

In this specific example (Fig. 1), the external force is constant and applied only at one node, making global compliance dependent solely on the displacement of that node. Therefore, we seek a truss structure that minimises the displacement of the upper right node.

Given KU=F\mathbf{K} \mathbf{U} = \mathbf{F}, the displacement vector U\mathbf{U} can be derived by solving the system of linear equations involving the stiffness matrix K\mathbf{K} and the force vector F\mathbf{F}.

1.1 Sensitivity of global compliance

To redistribute material by removing some elements and reallocating their mass to others, we need to rank the elements based on their contribution to compliance minimisation (minimising the displacement of the upper right node in this specific problem).

The naive approach is to remove the element with the least impact on compliance and distribute its mass among the remaining elements.

However, to determine this ranking, we need to perturb the size of each element and measure the resulting change in node displacement. This defines the sensitivity of global compliance to the size of each element, which is essentially the derivative of compliance with respect to the size of each element.

We repeat this process iteratively until no further reduction in global compliance can be achieved by removing another element. This procedure is an iterative optimisation algorithm, depicted in the following flowchart.

Flowchart showing the iterative optimisation algorithm. | EngineeringSkills.com

Fig 2. Flowchart showing the iterative optimisation algorithm.

Performing sensitivity analysis can be computationally intensive. In the next section, we will delve into the mathematical formulation of global compliance and sensitivity analysis to better understand the complexity of this problem.

We will introduce and compare various approaches for sensitivity analysis, evaluating their complexities. Subsequently, we will implement an efficient sensitivity analysis approach and the algorithm outlined in the flowchart.

Although these methods have been demonstrated with a simple case-study, they are extensively applied in industry. For further insights, consider exploring products built on similar principles from Autodesk and Altair.

To continue reading, please support us by subscribing.

All Access Membership

Learn, revise or refresh your knowledge and master engineering analysis and design

Access Every Course and Tool

  • Over 1040 lectures & over 212 hours of HD video content
  • Access member-only 'deep dive' tutorials
  • Access all downloads, pdf guides & Python codes
  • Access to the StructureWorks Blender addon + updates
  • Packed development roadmap of courses & tutorials
  • Price Guarantee – avoid future price rises as we grow
  • Priority Q&A support
  • Course completion certificates
  • Early access to new courses