0% found this document useful (0 votes)
386 views55 pages

Optimization With COMSOL Multiphysics

The document discusses optimization techniques in COMSOL Multiphysics. It provides an overview of optimization concepts and terminology, demonstrates an example of optimizing a bracket with a hole, and discusses available optimization solvers in COMSOL for both gradient-free and gradient-based methods.

Uploaded by

mortezagashti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
386 views55 pages

Optimization With COMSOL Multiphysics

The document discusses optimization techniques in COMSOL Multiphysics. It provides an overview of optimization concepts and terminology, demonstrates an example of optimizing a bracket with a hole, and discusses available optimization solvers in COMSOL for both gradient-free and gradient-based methods.

Uploaded by

mortezagashti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Optimization with COMSOL Multiphysics

COMSOL Tokyo Conference 2014

Walter Frei, PhD


Applications Engineer
Product Suite – COMSOL 5.0
Agenda
• An introduction to optimization
– A lot of concepts, and a little bit of math
– What do these options mean?

• Demo

• Overview of Examples
A quick conceptual introduction,
and some terminologies

- Dimensions - Performance
Objective: f(u(χ))
Constrained Design “Black Box” - Failure criteria
- Material Properties &
Variables: χ u(χ) - Constraints:
etc…
- Operating Conditions g(u(χ))
- etc…
K(χ)u=b(χ)

Optimization
More formally, optimization is…

min f (u(χ ) ) Objective function


χ∈ℜ
χ L ≤ χ ≤ χU Simple bounds on the design variables

p(χ ) ≤ 0 Pointwise constraints on the design variables

such that : g(u(χ ) ) = 0 General Equality constraints

h(u(χ ) ) ≤ 0 General Inequality constraints


The design variables: χ
χ2

Design Pointwise constraints


χ2,U
Space

p(χ) ≤ 0
χ1,L χ1,U
χ1

χ2,L Upper and


Lower
Bounds
The design space must be continuous
χ2

Design
Space 1 Design
Space 2

χ1

Break this up into two separate


optimization problems
Why no equality constraints for χ ?
χ2

χ2,U

p(χ) = 0
χ1,L χ1,U
χ1

χ2,L
An equality constraint is equivalent
to a different optimization problem
with one less design variable
Introduce a new design variable instead
χ2
χ1= f(χA)
χ2,U χA,U
χ2 = f(χA)
χA
χ1,L χ1,U
χ1

χA,L
χ2,L
The design space must be continuous
in the real
χ
number space
2

χ1

Optimizing over a set of discrete values is an


Integer Programming problem

LiveLink™ for MATLAB® & LiveLink™ for Excel®


can be used to interface to 3rd party optimizers
It is helpful if the design space is
convex

Usually more difficult Every point can see every


other design point
Now lets look at the objective function:
f(u(χ)) or f(χ)
χ2

χ1 χ2
χ1
We are always starting somewhere
f
We want to
improve this
Tip: Always start
χ2 optimizing from a
feasible design

Initial design

χ1
Lets first assume a smooth and differentiable objective
function with a single minimum

1) Find the gradient


∇χ f χ2
2) Search along the line

3) Find the minimum

4) Repeat

χ1
Repeat until converged
Start from a point, find the
direction of steepest descent
(the gradient) and search in
that direction for a minimum

Repeat
Once the gradient is zero, or
the boundary of the design
space is reached, stop
Adjoint method is used to compute derivatives
K (χ )u − b(χ ) = 0 Finite element equations

(K (χ )u − b(χ )) = 0 Differentiate w.r.t. χ
∂χ
∂K (χ ) ∂u ∂b(χ )
u + K (χ ) = Expand
∂χ ∂χ ∂χ
∂u  ∂b(χ ) ∂K (χ ) 
= K (χ )
−1
− u  Re-arrange
∂χ  ∂χ ∂χ 
∂f ∂f ∂u
= Assuming f is differentiable w.r.t. u
∂χ ∂u ∂χ

Computing this derivative only doubles the computational requirements,


regardless of how many design variables there are
If we hit a constraint, follow it…
Start from a point, find the
direction of steepest descent
(the gradient) and search in
that direction for a minimum

Repeat
Once the gradient is zero, or
the boundary of the design
space is reached, stop
What if we have multiple minima?
Depends on where you start!

You are never guaranteed of


finding the global minimum, but
you can find a local minimum
What if the objective function is not
smooth or differentiable?
Approximate the shape by
evaluating the objective
function repeatedly

For example, Nelder-Mead


evaluates n+1 points when
optimizing n design variables
What if the objective function is not
smooth or differentiable?
Approximate the shape by
evaluating the objective
function repeatedly

For example, Nelder-Mead


evaluates n+1 points when
optimizing n design variables
What if we want to include general
equality and inequality constraints?

h(u(χ)) ≤ 0
g(u(χ)) = 0
χ1 χ2
χ1 χ2

Highly constrained design space Strong dependence on initial conditions


Summary…
• Design variables must be continuous and real-valued
• Design space:
– Simple (Cartesian) bounds
– Pointwise inequality constraints
– If you want to set up an equality constraint, get rid of one design variable
– Convex design space is better
• Objective function
– If it is smooth and differentiable,
• can use the Adjoint method and the gradient-based optimization technique
– If it is non-smooth or non-differentiable
• Use the gradient-free approach
• General Equality and Inequality Constraints
– Equality constraints can severely complicate the optimization problem
– Inequality constraints can make the design space non-continuous
Demo: A bracket with a hole

Fixed

Load
First, minimize the mass by changing
the hole radius

The radius must be greater than zero,


and not so large as to cut the bracket in half
Next, add a constraint on the maximum
stress within the part

σ < σmax

But the location of the peak stress is not known,


So we use a maximum coupling operator & a constraint
What about moving & resizing the hole?
Let’s look at the constraints...

How can we express these mathematically?


Add one more design variable

A
Let’s take these constraints a few at a time
With a bit of (behind the scenes) trigonometry:

B = (1-0.25*A)/(1+sqrt(4.25)/2)

R
A

Which leads to the constraint: B-R>0


What about the other limits?

A–R>0.2

A
Sometimes we can just ignore a constraint

Based upon the


simulations so
far, its likely this
constraint will
never be an issue
The available optimization solvers
Optimization
Module

Gradient-Free Gradient-Based
Methods Methods

Monte Levenberg-
MMA SNOPT
-Carlo Marquardt

Coordinate Nelder-
BOBYQA COBYLA
Search Mead
When to use gradient-free methods?
• Non-differentiable objective function, and/or constraints

• Few design variables


– Optimization time increases exponentially with number of variables
– Aim for less than 10 design variables

• Whenever re-meshing will occur


– Re-meshing results in a non-smooth objective function
The gradient-free solvers
• COBYLA
Faster – Similar to BOBYQA, but uses a linear approximation
– Can consider constraints
• BOBYQA
– Constructs a quadratic approximant to the objective function
– Probably the fastest, but needs a “reasonably smooth” objective
Usually function
the • Nelder-Mead
Most – Construct a simplex, and improve the worst point
– Probably the best if the objective function is relatively noisy
Robust
– Can consider constraints
• Coordinate Search
– Search along one design variable at a time
– Estimate the gradients along that line, move on to next variable,
repeat

Slower
• Monte-Carlo
– Random choices of design variables are evaluated
– Only a very dense statistical sampling can find the global optimum
When to use gradient-based methods?
• Differentiable objective function, and/or constraints

• Many design variables


– Optimization speed does not depend strongly on number of variables
– 100,000+ design variables are not unreasonable

• Topology Optimization
The gradient-based solvers
• SNOPT
– Sequential Quadratic Programming algorithm
• MMA
– Linear convergence rate near the optimum
– Popular in the Topology Optimization community

• Levenberg-Marquardt
– Only for unconstrained least squares minimization problems
– Very fast
Scaling and Tolerances
• Specify scales for all control variables
– In Optimization study step for global parameters
– In Optimization interface features for fields

• All solvers work with rescaled variables


– Solver tolerances are relative to these

• Keep objectives and constraints close to 1


– Solvers may use scaled gradient for termination
Comparison of Algorithms
Gradient-Free Gradient-Based
Objective Any scalar output Must be both smooth and differentiable
Function

Design Variables Anything, including geometric Anything, but cannot result in remeshing of
dimensions the geometry

Allows Yes No
Remeshing
Constraints Can only constrain scalar outputs Constraints must be smooth and
differentiable, but can be at each point in
space
Relative Increases exponentially with the Performance is not very sensitive to the
Performance number of design variables number of design variables
So what else can you do?

Parameter Estimation
& Curve Fitting

Shape &
Dimension

Topology
Structural Sizing
• Optimization of joint
positions in a truck-
mounted crane.
• Reduces force on boom
lift cylinder for a range
of operation conditions
• Uses the Multibody
Dynamics Module
Multi-study Structural Sizing
• Weight minimization of
a mounting bracket.
• Multi-study constraints
– Maximum stress under
static load
– Lowest eigenfrequency
Estimating the material properties
based upon experimental data

[Link]
Example: Optimizing a Flywheel,
with Constraints
• Make stress distribution
as uniform along the
radius as possible
• Constrain the mass not to
change
• Constrain the moment of
inertia not to change
• Gradient-based approach
[Link]
Example: Band dispersion in a microchannel

Minimize the difference is transit time between inside and outside


Gradient-Free optimization
[Link]
Example: Optimizing a Horn

• Maximize the sound intensity along


the axis of the horn
• The shape of the horn is described by
a sum of sine waves
– Truncated Fourier series
• The Deformed Mesh functionality is
used to avoid remeshing the domain
• Gradient-Based approach

[Link]
Example: Optimizing a Heater

Maximize the
temperature at
the outlet

Such that the


temperature at
each heater stays
below a target

[Link]
Example: Optimizing a Spinning Wheel

Minimize the Mass


By changing:
rinner
router

Constrain the maximum stress

[Link]
Topology Optimization: Buy this book
Example: Optimizing a Beam

Minimize the compliance


Add constraint on total material
SIMP method

[Link]
Example: Tesla Microvalve

Flow to the right: Minimize ∆p


Flow to the left: Maximize ∆p

Laurits Højgaard Olesen, Fridolin Okkels and Henrik Bruus, “A high-level programming-language implementation of
topology optimization applied to steady-state Navier–Stokes flow,” Int. J. Numer. Meth. Engng 2006; 65:975–1001.

[Link]
COMSOL Conference Papers on Topology Optimization
• Topology Optimization in Multiple Physics Problems, O. Sigmund, DTU Mechanical Engineering,
[Link]

• Multiphysics Topology Optimization of Heat Transfer and Fluid Flow Systems, E. Dede, Toyota Research
Institute of North America, [Link]

• Simulation of Topology Optimized Electrothermal Microgrippers, O. Sardan, D. Petersen, O. Sigmund, & P.


Boggild, DTU Mechanical Engineering, [Link]

• Implementation of Structural Topology Optimization in COMSOL, B. Lemke, Z. Liu, & J. G. Korvink,


Department of Microsystems Engineering, University of Freiburg, [Link]

• Topology Optimization of Dielectric Metamaterials Based on the Level Set Method Using COMSOL
Multiphysics, M. Otomori & S. Nishiwaki, Kyoto University, [Link]

• Optimization of a Photonic Crystal Waveguide Termination, W. Frei, COMSOL,


[Link]
When to use which one?
• Early in the design process, when you have a lot of time
to run analyses, and don’t have a very rigid idea about
your final design?

• Already have the basic topology fixed, but can change


the shape?

• It’s about to go to production, and we realized it


doesn’t work!!!
When to use which one?
• Early in the design process, when you have a lot of time
to run analyses, and don’t have a very rigid idea about
your final design?
Topology Optimization

• Already have the basic topology fixed, but can change


the shape?
Shape Optimization

• It’s about to go to production, and we realized it


doesn’t work!!!
Dimensional Optimization
Some general optimization tips…

• Scale your objective function to be close to unity


• Do not get frustrated, the software doesn’t know that
you haven’t asked the right question
• Start as simple as possible, especially with constraints
Concluding remarks…

min f (u(χ ) )
χ∈ℜ
χ L ≤ χ ≤ χU
p(χ ) ≤ 0
such that : g(u(χ ) ) = 0
h(u(χ ) ) ≤ 0

You might also like