© 2011 ANSYS, Inc. September 8, 2011 1
Mesh Morphing and the Adjoint Solver in
ANSYS R14.0
Simon Pereira
Laz Foley
© 2011 ANSYS, Inc. September 8, 2011 2
• Fluent Morphing-Optimization Feature
• RBF Morph with ANSYS DesignXplorer
• Adjoint Solver
• What does an adjoint solver do, and how do we use the results?
• Supporting technologies and challenges
• Current Functionality
• Examples
• Summary
Agenda
© 2011 ANSYS, Inc. September 8, 2011 4
FLUENT Morpher-Optimization feature
•Allows users to optimize product design based on shape deformation to achieve design objective
•Based on Free-Form Deformation tool coupled with various optimization methods
© 2011 ANSYS, Inc. September 8, 2011 5
Mesh Morphing
Applies a geometric design change directly to the mesh in the solver
Uses a Bernstein polynomial-based morphing scheme
• Freeform mesh deformation defined on a matrix of control points leads to a smooth deformation
• Works on all mesh types (Tet/Prism, CutCell, HexaCore, Polyhedral)
User prescribes the scale and direction of deformations to control points distributed evenly through the rectilinear region.
© 2011 ANSYS, Inc. September 8, 2011 6
Region Defined
Examples
Some Basic examples…
Optimization based morphing…
Baseline Modified
© 2011 ANSYS, Inc. September 8, 2011 7
Process • Morpher coupled with
Optimizer 1. Setup the CFD problem
2. Invoke Mesh Morpher Tool
3. Define Objective Function
4. Define deformation region and assign deformation of control points through “Optimizer”
5. Perform solution to get the optimized design
OR What if? Optimizer
Setup Case
Run
Setup Morph
Evaluate
Choose “best” design
Regions
Parameters
Deformation
Setup Case
Run
Setup Optimizer
Optimize
Optimal Solution
Morph
Optimizer
Auto
© 2011 ANSYS, Inc. September 8, 2011 8
Objective Function
Baseline Design Optimized Design
• Objective Function: Equal flow rate
© 2011 ANSYS, Inc. September 8, 2011 9
Example – Simple Sedan •Defining the deformation •And shape variables
Sequential Tabs
• Define Control Region(s)
© 2011 ANSYS, Inc. September 8, 2011 10
Deformation Definition
• Define constraint(s) (if any)
• Select control points and prescribe the relative ranges of motion
© 2011 ANSYS, Inc. September 8, 2011 11
Optimizer Algorithms; Compass, Powell, Rosenbrock, Simplex, Torczon
Auto
• Optimize!
© 2011 ANSYS, Inc. September 8, 2011 12
Results
Incompressible turbulent flow
Objective Function; Minimize Drag
Baseline Design Optimized Design
• Questions?
• Please contact ANSYS Tech support for help in applying this technology
© 2011 ANSYS, Inc. September 8, 2011 15
How RBF-Morph Works? • Once displacements are defined by the user at the source points, Radial Basis Function interpolation is used to derive the displacement at any location in the space, so it is also available at every grid node. • The RBF problem definition is mesh independent, same set up can be applied to different meshes
© 2011 ANSYS, Inc. September 8, 2011 17
RBF-Morph main features
• Fully integrated within FLUENT and Workbench
• Easy to use
• Parallel calculation allows to morph large size models (many millions of cells) in a short time
• Mesh independent solution works with all element types (tetrahedral, hexahedral, polyhedral, etc.)
• Superposition of multiple RBF-solutions makes the FLUENT case truly parametric (only 1 mesh is stored)
– RBF-solution can also be applied on the CAD
• Precision: exact nodal movement and exact feature preservation.
© 2011 ANSYS, Inc. September 8, 2011 18
Ship hull: Series 60, CB=0.6
external hydrodynamics
multiphase flow (air & water)
ship advancing steadly in calm water
trim and sinkage fixed
displaced volume as constraint
resistance prediction
Objective: Optimization of the hull shape with no displacement reduction
Reduction of the resistance
Test case description
Conducted by Pranzitelli & Caridi
© 2011 ANSYS, Inc. September 8, 2011 19
CAD
Mesh ICEM-CFD
Baseline sim. Fluent
Workbench and RBF-morph setup
DOE RUNS
Optimization
Final solution
op
era
tor
wo
rkb
ench
Process
grid cells
Coarse 331,652
Medium 692,984
Fine 1,274,742 CT
ΔCT
Coarse 5.81x10-3 -2.52%
Medium 5.94x10-3 -0.34%
Fine 5.96x10-3 0%
Exp.* 5.96x10-3 -
© 2011 ANSYS, Inc. September 8, 2011 20
CAD
Mesh ICEM-CFD
Baseline sim. Fluent
Workbench and RBF-morph setup
DOE RUNS
Optimization
Final solution
op
era
tor
wo
rkb
ench
Process
Symmetry plane fixed
Morphing domain defined Eight cross sections specified
Section deformation applied
© 2011 ANSYS, Inc. September 8, 2011 21
CAD
Mesh ICEM-CFD
Baseline sim. Fluent
Workbench and RBF-morph setup
DOE RUNS
Optimization
Final solution
op
era
tor
wo
rkb
ench
Process
DX builds a DOE and drives Fluent and RBF Morph
Parameters are defined and transferred to the parameter set bar for use with ANSYS DesignXplorer
© 2011 ANSYS, Inc. September 8, 2011 22
• Design of Experiments
• 45 Design Points
• Solved in Batch
• Input parameters
• Output parameters
• DOE Settings
ANSYS DesignXplorer • Results
• Sensitivity analysis
• Response Surface
© 2011 ANSYS, Inc. September 8, 2011 23
baseline
optimized
baseline
optimized
• Optimize
Optimize with ANSYS DesignXplorer
Baseline Optimized
Fx 6.83N 6.29N
• 7.9% resistance reduction
• No volume reduction
© 2011 ANSYS, Inc. September 8, 2011 24 *one Intel® i7 quad-core processor, 2.8GHz
Performance with RBF-Morph in Workbench: • Mesh generation: 6 man-hours • Fluent case setup: 1 man-hours • Baseline simulation (coarse grid): 4 CPU*-hours • Workbench and RBF-Morph setup:1 man-hours • DOE (45 simulations): 45 CPU*-hours • Optimization: Minutes
8 man hrs
2 CPU days
Without Workbench & RBF-Morph....? • Mesh generation (first mesh): 6 man-hours • Geometry (CAD) and mesh modification for each case (considering mesh automation in ICEM-CFD): 1x45 = 45 man-hours • Cases management (Fluent): 1x46 = 46 man-hours • Cases execution: 4+45 = 49 CPU*-hours • use of other optimization tools: ??
~100 man hrs
2 CPU days (optimistically)
© 2011 ANSYS, Inc. September 8, 2011 26
Preface
• The release of the adjoint solver in ANSYS Fluent 14 is the culmination of several years of R&D effort.
• This project was risky, but the rewards are great for ANSYS clients.
• There were a number of false starts and dead-ends.
• Writing an adjoint solver that meets the needs of the engineering community is not a trivial task.
• We are pleased to have come so far, and look forward to going much further.
© 2011 ANSYS, Inc. September 8, 2011 27
An adjoint solver allows specific information about a fluid system to be computed that is very difficult to gather otherwise.
The adjoint solution itself is a set of derivatives.
• They are not particularly useful in their raw form and must be post-processed appropriately.
• The derivative of an engineering quantity with respect to all of the inputs for the system can be computed in a single calculation.
– Example: Sensitivity of the drag on an airfoil to its shape.
There are 4 main ways in which these derivatives can be used:
1. Qualitative guidance on what can influence the performance of a system strongly.
2. Quantitative guidance on the anticipated effect of specific design changes.
3. Guidance on important factors in solver numerics.
4. Gradient-based design optimization.
What is an adjoint solution and how do we use those results?
© 2011 ANSYS, Inc. September 8, 2011 28
GOAL: Identify features of a system design that are most influential in the performance of the system.
EXAMPLE: – Sensitivity of the Drag on a NACA 0012 airfoil to changes in the shape of the
airfoil.
– The shape sensitivity field is extracted from the adjoint solution in a post-processing step.
How to use the results - Qualitative
High sensitivity – changes to shape have a big effect on drag
Low sensitivity – changes to shape have a small effect on drag
© 2011 ANSYS, Inc. September 8, 2011 29
GOAL: Identify specific system design changes that benefit the performance and quantify the improvement in performance that is anticipated.
EXAMPLE: – Design modifications to turning vanes in a 90 degree elbow to
reduce the total pressure drop.
– The optimal adjustment that is made to the shape is defined by the shape sensitivity field (steepest descent algorithm).
– Effect of each change can be computed in advance based on linear extrapolation.
How to use the results - Quantitative
Original DP = -232.8 Pa Expected change computed using the adjoint and linear extrapolation = 10.0 Pa Make the change and recompute the solution. Actual change = 9.0 Pa
Baseline Modified
© 2011 ANSYS, Inc. September 8, 2011 30
GOAL: Identify aspects of the solver numerics and computational mesh that have a strong influence on quantities that are being computed that are of engineering interest.
EXAMPLE: – Use the adjoint solution to identify parts of the mesh where mesh
adaption will benefit the computed drag by reducing the influence of discretization errors.
How to use the results – Solver Numerics
Baseline Mesh Adapted Mesh
Adapted Mesh Detail
© 2011 ANSYS, Inc. September 8, 2011 31
GOAL: Perform a sequence of automated design modifications to improve a specific performance measure for a system
EXAMPLE: – Gradient-based optimization of the total pressure drop in a pipe.
– Flow solution is recomputed and the adjoint recomputed at each design iteration.
How to use the results – Optimization
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30D
pto
t [P
a]
Iteration
Initial design
Final design
30% reduction in total pressure drop after 30 design iterations
© 2011 ANSYS, Inc. September 8, 2011 32
Standard CFD Workflow elements
– Define a flow problem.
– Create a geometric representation of the problem and create a computational mesh.
– Setup and solve the flow problem.
– Post-process the results.
If the design is not meeting performance requirements
– Use insight, experience and intuition to decide how to select design changes that will improve the performance of the system
or
Adjoint workflow elements
– Use the results to improve the design systematically using one of the 4 strategies outlined
– Pick an observation that is of engineering interest.
• Lift, drag, total pressure drop?
– Set up and solve the adjoint problem for this observation for the specific computed flow field
• Define adjoint solution advancement controls
• Set adjoint convergence criteria
• Initialize the adjoint solution field
• Iterate to convergence
• Post process
How does an adjoint analysis fit into the familiar CFD workflow?
© 2011 ANSYS, Inc. September 8, 2011 33
– Mesh morphing
– Mesh morphing & Adjoint Data
– Mesh Morphing, Adjoint Data & Constraints
Supporting Technologies
© 2011 ANSYS, Inc. September 8, 2011 34
Once a desired change to the geometry of the system has been selected, how is that change to be made?
• Mesh morphing provides a convenient and powerful means of changing the geometry and the computational mesh.
– Use Bernstein polynomial-based morphing scheme discussed earlier
Mesh Morphing
© 2011 ANSYS, Inc. September 8, 2011 35
• Example: Sensitivity of lift to surface shape
• Select portions of the geometry to be modified
• Adjoint to deformation operation
• Surface shape sensitivity becomes control point sensitivity (chain rule for differentiation)
• Benefit of this approach is two-fold
• Smooths the surface sensitivity field
• Provides a smooth interior and boundary mesh deformation
Mesh Morphing & Adjoint Data
Flow
© 2011 ANSYS, Inc. September 8, 2011 36
The adjoint solution is determined based on the specific flow physics of the problem in hand.
The effect of other practical engineering constraints must be reconciled with the adjoint data to decide on an allowable design change.
Example:
– Some walls within the control volume may be constrained not to move.
– A minimal adjustment is made to the control-point sensitivity field so that deformation of the fixed walls is eliminated.
Mesh Morphing, Adjoint Data & Constraints
Fixed wall
Fixed wall
Moveable walls
© 2011 ANSYS, Inc. September 8, 2011 37
Current Functionality
ANSYS-Fluent flow solver has very broad scope
Adjoint is configured to compute solutions based on some assumptions
– Steady, incompressible, laminar flow.
– Steady, incompressible, turbulent flow with standard wall functions.
– First-order discretization in space.
– Frozen turbulence.
The primary flow solution does NOT need to be run with these restrictions
– Strong evidence that these assumptions do not undermine the utility of the adjoint solution data for engineering purposes.
Fully parallelized
Gradient algorithm for shape modification
– Mesh morphing using control points.
Adjoint-based solution adaption
© 2011 ANSYS, Inc. September 8, 2011 38
The adjoint solver is an addon that will be part of the Fluent 14 distribution.
Documentation is available
– Theory
– Usage
– Tutorial
– Case study
Training is available.
Functionality is activated by loading the adjoint solver addon module.
A new menu item is added at the top level.
Limitations include unsupported models (porous media, MRF etc.), convergence can be challenging for large cases (5-10M+ cells) and cases that exhibit unsteady flow or strong shear flows
– Stabilized solution advancement algorithm is in place
Current Functionality
© 2011 ANSYS, Inc. September 8, 2011 39
GUI
• Follow as closely as possible the same design layout as Fluent solver – Specify observable
– Adjoint solution advancement controls
– Residual monitors
– Initialization and iteration
– Post-processing: contours, vectors.
– Results reporting
– Mesh-morphing with pre-calculation of expected change in observable.
TUI
User-Interface
/adjoint>
controls morphing/ reporting/
monitors/ observable/ run/
© 2011 ANSYS, Inc. September 8, 2011 41
Full discrete adjoint for shape sensitivity
Frozen turbulence
Reduce total pressure drop, DP, through system
Total Pressure Drop in a Bend
DP = -232.8 Expect change 10.0
Baseline 1
Actual change 9.0 DP = -223.8 Expect change 8.9
Actual change 6.9 DP = -216.9 Expect change 7.0
2
Actual change 3.1 DP = -213.8 Total improvement of 8%
3
© 2011 ANSYS, Inc. September 8, 2011 42
Goal is to reduce the total pressure drop through the system
Set up and solve the adjoint system with a total pressure drop objective function
Total Pressure Drop in a Duct
Flow residuals
Adjoint residuals
Flow
Outflow
© 2011 ANSYS, Inc. September 8, 2011 43
Aggressive adjustment results in a 17% reduction in loss in just one design iteration
Total Pressure Drop in a Duct Total Pressure Drop (Pa)
Geometry Predicted Result
Original --- -22.0
Modified -14.8 -18.3
© 2011 ANSYS, Inc. September 8, 2011 44
The adjoint solver will be released with R14
An adjoint solver computes sensitivity data that can be used to aid with design decisions in 4 main ways:
1. Qualitative identification of critical parts of the system of interest.
2. Quantitative predictions of the optimal choice for a design change and a prediction of the effect of that change.
3. Aiding in the numerical analysis of the flow solution to improve solution quality.
4. Gradient-based optimization.
Supporting technologies such as mesh morphing, and the application of design constraints, are seen as important.
The adjoint solver for the present release is limited to steady incompressible flows, with other restrictions on models.
Summary