A COMSOL engineer explains how parametric, shape and topology optimizations work.
Suppose you’re designing a balcony that’s fixed to a building on one side. Old-fashioned engineering tactics require assessing historical data and best practices to develop the balcony’s layout. In other words, you use a series of tools and estimations to determine an amount of material, in a given shape, that supports the distributed weight.
Your design will be sturdy. It will check all the boxes, and it will provide safety. Given the empirical nature of your development process, it won’t be optimal. Instead, it’ll be over-engineered and expensive.
The first step to minimize the mass is to define a design objective. In this case, use three optimization approaches to design a balcony, fixed on one end, to hold a distributed load with a minimal deflection at Point A. Your next step is to introduce a series of constraints on the design space, namely:
- A surface to support the distributed weight
- A limited deflection of Point A (in Figure 1) based on the distributed weight
Your job is to chip away at the balcony’s shape and layout (a.k.a. your control variables) until simulations prove that all criteria are met and the mass is at a minimum. To a human, this task would be error-prone, daunting, tedious and time-consuming.
However, this is the type of problem that simulation-based optimization tools, such as parameter, shape and topology optimization, are designed to handle.
The Building Blocks of Optimizations: Control Variables, Objectives, Goals and Constraints
The building blocks of any optimization are the control variables, constraints, goals and objective function.
“Let’s think of any input into the COMSOL model as a control variable,” said Walter Frei, COMSOL principal applications engineer and COMSOL Days: Canada presenter. “There is no limit on the number of control variables you can include, other than the computational cost. Those control variables can represent anything. Any dimension, any material property and any input to the model can be a control variable.”
Your objective function is dependent on these inputs and your simulation model. It describes the design space. In the case of the example, it includes all potential simulated balconies and the outputs of each simulation based on given control variables.
The goal of the optimization will be to enhance the objective function based on a specific task. In the case of the example, it is to minimize the weight of the balcony while maintaining a series of constraints.
Constraints define parts of the objective function and any inputs into the model that are unfeasible. In this case, any layout that breaks the surface that holds the distributed weight is unfeasible. Many balconies will also be deemed unfeasible if Point A, Figure 1, has too large of a deflection.
Optimization methods explore the design space from a given starting point until an optimum is reached.
“One of the requirements is that you have a feasible starting point,” Frei said. “You want to have some initial design. You want to be somewhere in your design space. From that point, you want to ask, ‘How should I change my inputs to my model so that I get a better design out?’”
How to Solve Optimizations: Derivative and Derivative-free Based Methods
Now that you understand how optimizations work, how do you decide on a method to traverse the design space toward an optimum? Essentially, there are two options: derivative and derivative-free solvers.
Derivative solvers numerically compute the slope of the objective function at a given point of the design space. The derivative then guides the software toward a new starting point for each iteration.
“The advantages of [derivative-based] solvers are that they are very fast and can handle many control variables—thousands, hundreds of thousands, even millions,” Frei said. “There really is no limit to the number of design variables. But you really do need a problem where you can actually evaluate the derivatives. That turns out to be strict in some cases.”
Derivative-based solvers are well suited for problems that can be modeled as stationary or time-invariant. Derivative-free solvers are used for computationally expensive scenarios. Frei explained, “Rather than analytically computing the derivative, derivative-free solvers would approximate them. They step through and approximate the derivative along the way to get to the optimum point.”
How Parametric Optimization Works?
When you define the control variables to be CAD parts and dimensions, you are performing a parametric optimization. These optimizations are easy to set up. However, they require remeshed models after every iteration. This can get computationally expensive.
“Parametric optimization of the dimensions of the geometry will trigger a remeshing of the geometry,” Frei said. “That gets us to the point where you can’t use the adjoint method to compute the derivatives anymore. So, you are locked into the derivative-free methods.”
The benefit of parametric studies is that the solution you get out is a true CAD model. Frei said, “You can take the output, ship it straight to the tool shop and get it made.”
How Shape Optimization Works?
Instead of redefining the geometry with parameters, shape optimizations define the control variables to be the shape of the boundaries.
“This is where we define the deformation of a boundary in terms of polynomials or in terms of the deformation of the boundary itself,” Frei said. “This is not altering the underlying CAD. It’s deforming it, so it allows us to use the gradient-based solvers.”
He added, “The cost of remeshing is off the table, and you can use the true gradients—computed via the adjoint method.”
Shape optimizations require more thought to set up. Since it doesn’t remesh the model, it can be less expensive computationally. Additionally, the output will be deformed CAD parts that can be made into STL files.
“It’s not quite a CAD part any longer, but it’s close,” Frei explained. “There is no ambiguity about where the boundary will be. We are just taking the boundary and moving it around.”
How Topology Optimization Works?
When the control variables are defined as the material distribution, you get a topology optimization. Optimizing a multiphysics problem using topology optimization will take a lot of time to set up, as the open-endedness of the problem will make it difficult to determine an objective function.
“Topology optimization is very much a research field in many cases,” Frei said. “In structural mechanics, it’s pretty well proven. In other areas, people are coming up with new and exciting ideas every day, especially in the area of multiphysics.”
“What you get out of this is a material distribution,” Frei added. “You can kind of get back into an STL format, but it’s still going to require some approximation on the user’s part. Actually, the process of interpreting the output of a topology optimization problem is, in itself, an engineering judgment call in a lot of ways.”
Topology optimization requires no remeshing, so gradients can be computed analytically. Additionally, the number of design variables doesn’t significantly increase the computational cost.
One interesting issue with this tool is that it creates ideal solutions. As a result, it could produce answers that are impossible to manufacture at a reasonable cost. However, Frei doesn’t see this as something that will hold back topology optimization.
“This is what makes that field challenging and interesting to work in,” he said.
Which Optimization Is Best? Parameter, Shape and Topology Optimization Results
Now that you understand the fundamentals of optimizations, it’s time to design an optimal balcony.
First, Frei set up a parameter optimization. He defined two points that position a line within the design space. The edges of the line connect to the balcony just below Point A and at the bottom of the constrained edge. Any material below this new edge is cut from the design.
The shape optimization connects a point just below Point A to the bottom of the constrained edge using a set of Bernstein polynomial basis functions of order 4. Any material below the edge created by this function is cut from the design.
For the topology optimization, the constrained edge was defined to not need material along its whole length. However, the surface supporting the weight needed to be continuous.
In the end, the parameter optimization was the easiest one to set up, but it took about a minute to solve and reduced the mass to 51 percent of the original size. The shape optimization was an order of magnitude faster, but it only reduced the mass to 47 percent of the original size. The topology optimization performed the best. It took the least amount of time and reduced the mass to 12 percent of the original size.
As expected, the topology optimizations produce the best results because it was given the most freedom to restrict the weight. Additionally, it was able to add design variables without affecting the runtime. However, it was the hardest to set up.
As a result, all three of these optimization tools should be in an engineer’s wheelhouse. Depending on the current state of the design cycle and the knowledge known, parametric, shape or topology optimization might be the better option. One thing is for sure. By performing these optimizations throughout development, you are sure to produce a near-optimal design.