Work Packages Other Topics

Optimal Shape Design for Poisson Equation in Matlab

Author: - 29 June 2018

Download Code

We study the shape design problem through the minimization of the cost functional

where is the state variable, is a target function, and the normal displacement to a reference boundary,

The problem is subject to the following elliptic PDE in the domain with Dirichlet boundary conditions on ,

and .

We consider the set of admissible domains whose measure is fixed,

and aim at finding the optimal shape that minimizes the cost function. In order to do so, we use the steepest descent method with descent direction given by

where is solution of the adjoint problem

The normal displacement field is updated at every iteration,

with sufficiently small. The Lagrange multiplier is computed in order to ensure that the volume contraint is fulfilled, thus

Mesh Motion Solver

The solutions to the primal and adjoint problems are commonly approximated by means of numerical methods, such as the finite element method (FEM) or the finite volume method (FVM). In order to apply these techniques, the domain under study must be tessellated with a mesh. Nevertheless, applying the displacement directly to the controlled boundary will deteriorate the surrounding elements after a few iterations and the computation will crash if the interior nodes of the domain are not reallocated. In order to avoid this, the domain can be re-meshed after a number of iterations. However, this can be very expensive as a completely new mesh must be generated. A commonly used alternative is to move the interior nodes of the mesh according to the displacements prescribed on the boundary. By doing this the number of elements and the nodes connectivities remain the same, only the mesh nodes positions are updated.

Linear Elasticity

Mesh motion can be achieved by treating the mesh as an elastic body and solving the equations of Linear Elasticity for solids with prescribed displacements on the domain boundary,

Solid Body Rotation (SBR) Stress

The Linear Elasticity model fails when dealing with rotating meshes. This can be mitigated by selecting the material properties in a proper manner, which yields

Laplacian Smoothing

A simple and widely used practice is to solve a Laplace equation with the prescribed displacements as boundary conditions,

The behavior of the Laplacian smoothing can be improved by adding a non-uniform diffusivity term,

The diffusion field decreases with the distance to the controlled boundary. A common choice is to make it depend on the inverse of the distance as

so that the nodes next to the deforming boundaries move with similar displacements as those on the boundary.

Spring Analogy

A more intuitive approach is reached by thinking of the N mesh nodes as a mechanical system consisting of a finite set of masses that are linked with springs along the mesh edges. We can consider the existence of additional external forces acting on every mesh node, so that for every equilibrium configuration the following must hold,

The equilibrium equations can be expressed in terms of the nodes displacements,

At the M nodes that belong to the domain boundary the displacements are prescribed with unknown forces acting on them. On the other hand, on the interior nodes of the mesh whose displacements are unknown, there are no other forces than the elastic ones. Let us denote with D the indices of the nodes with prescribed displacement, and with S the set of nodes with unknown displacements. The equilibrium can be expressed in matrix form as

One can get the displacements of the interior mesh nodes as

Radial Basis Functions (RBF)

The RBF mesh morphing technique uses the known displacements at the domain boundaries to construct an interpolation expression as a weighted sum of radial functions ,

The weighting coefficients and the polynomials are obtained by imposing the known displacements at the boundaries,

and the orthogonality conditions for every polynomial with degree less or equal than that of ,

At the end, a linear system of the form

must be solved, and the mesh nodes are updated as

Free Form Deformation (FFD)

An alternative is to use some parametrization technique for the boundary and extend it to be able to handle the motion of the interior nodes of the mesh as well. This can be done with the Free Form Deformation method, that is based upon the positions of a set of control points inside a parallelepiped.

If we consider the 2-dimensional reference control domain , we can define a set of evenly spaced control points,

and introduce the tensorial product of Bernstein polynomials , with

The transformation

is the identity transformation, i.e., .

We consider a set of control points defined as displacements from the reference positions, . In this case it is easy to see that the following holds

We must find the control points displacements that parametrize the controlled boundary and for which, for every boundary node ,

Getting Started

The file main.m needs to be run from the Matlab command line,


Dynamic Mesh

The different mesh motion methods can be selected in the heading of main.m

% Minimum element size
Hmin = 1e-3;
% Maximum elements size
Hmax = 0.05;
% Step theta^{n+1} = theta^{n} - d * Dtheta^{n}
d = 1e-3;
% Maximum number of iterations
maxIter = 2000000;
% Dirichlet boundary condition on the outer boundary
ue = 1;
% Dirichlet boundary condition on the inner boundary
uc = 0;
% Smoothing of sensitivity field
smoothing = true;
% Reshaping of elements whose edges are lying on the controlled boundary
reshaping = true;
% Mesh motion solver method:
% - Laplace Equation ('laplace')
% - Spring Analogy ('spring')
% - Free Form Deformation ('FFD')
% - Radial Basis Functions ('RBF')
meshMotionSolver = 'laplace';
% Parameters for Laplace method
% Diffusivity (diff)
% - Inverse distance ('invdist')
invdist = true;
m = 6;
% Parameters for FFD method:
% Mi - number of control points along X axis
% Nj - number of control points along Y axis
% Xmin, Xmax - coordinates defining the control rectangle
Mi = 9;
Nj = 9;
Xmin = [-0.7, -0.6];
Xmax = -Xmin;
% Parameters for RBF method
% h - Dimensionless radial distance (r/h)
% RBFtype - Radial Basis Functions
% - Spline type, n odd ('Rn')
% - Thin Plate Spline, n even ('TPSn')
% - Multiquadratic ('MQ')
% - Inverse multiquadratic ('IMQ')
% - Inverse quadratic ('IQ')
% - Gaussian ('GS')
% n - Exponent
h = 2.5*0.3;
RBFtype = 'R';
n = 1;

Running a Case

The shape optimization method described in the previous section has been tested with a simple example. The Poisson equation is posed in a two-dimensional circular domain with boundary

The reference geometry to be optimized is an inner hole with boundary given by

The target function will be the analytical solution of the Poisson equation with the inner hole centered in the origin,

where the integration constants are obtained from the boundary conditions,

When the hole center is displaced from the origin, the target state must be extended in the region , thus

It is clear that for

the cost function equals zero, thus it is an optimal solution. The steepest descent algorithm has been coded in Matlab with .

Other geometry configurations have been tried. For instance, the inner hole can be initially located farther from its optimal position,

Different starting shapes can be tested as well,


  • O. Pironneau. Optimal shape design for elliptic systems. Springer Science & Business Media, 2012.
  • J Simon. Diferenciación de problemas de contorno respecto del dominio. Technical report, Universidad de Sevilla, Facultad de Matemáticas, Departamento de Análisis Matemático, 1989.

Linear Elasticity mesh motion method:

  • Andrew A. Johnson and Tayfun E. Tezduyar. Mesh update strategies in parallel finite element computations of flow problems with moving boundaries and interfaces. Computer methods in applied mechanics and engineering, 119(1-2):73–94, 1994.
  • Thomas D. Economon, Francisco Palacios, and Juan J. Alonso. Unsteady continuous adjoint approach for aerodynamic design on dynamic meshes. AIAA Journal, 53(9):2437–2453, 2015.
  • George S. Eleftheriou and Guillaume Pierrot. Rigid motion mesh morpher: A novel approach for mesh deformation. In OPT-i, An International Conference on Engineering and Applied Sciences Optimization, Kos, Greece, pages 4–6, 2014.

Solid Body Rotation (SBR) Stress method:

  • Richard P. Dwight. Robust mesh deformation using the linear elasticity equations. In Computational fluid dynamics 2006, pages 401–406. Springer, 2009.

Laplacian Smoothing:

  • Peter Hansbo. Generalized laplacian smoothing of unstructured grids. International Journal for Numerical Methods in Biomedical Engineering, 11(5):455–464, 1995.
  • Rainald Löhner and Chi Yang. Improved ale mesh velocities for moving bodies. Communications in numerical methods in engineering, 12(10):599–608, 1996.
  • Hrvoje Jasak and Zeljko Tukovic. Automatic mesh motion for the unstructured finite volume method. Transactions of FAMENA, 30(2):1–20, 2006.

Spring Analogy:

  • Ch. Farhat, C. Degand, B. Koobus, and M. Lesoinne. Torsional springs for two-dimensional dynamic unstructured fluid meshes. Computer methods in applied mechanics and engineering, 163(1-4):231–245, 1998.
  • Christoph Degand and Charbel Farhat. A three-dimensional torsional spring analogy method for unstructured dynamic meshes. Computers & structures, 80(3-4):305–316, 2002.
  • Carlo L Bottasso, Davide Detomi, and Roberto Serra. The ball-vertex method: a new simple spring analogy method for unstructured dynamic meshes. Computer Methods in Applied Mechanics and Engineering, 194(39-41):4244–4264, 2005.

Radial Basis Functions mesh morphing:

  • Stefan Jakobsson and Olivier Amoignon. Mesh deformation using radial basis functions for gradient-based aerodynamic shape optimization. Computers & Fluids, 36(6):1119–1136, 2007.
  • AM Morris, CB Allen, and TCS Rendall. Cfd-based optimization of aerofoils using radial basis functions for domain element parameterization and mesh deformation. International Journal for Numerical Methods in Fluids, 58(8):827–860, 2008.
  • Daniel Sieger, Stefan Menzel, and Mario Botsch. High quality mesh morphing using triharmonic radial basis functions. In Proceedings of the 21st International Meshing Roundtable, pages 1–15. Springer, 2013.
  • Marco Evangelos Biancolini. Fast Radial Basis Functions for Engineering Applications. Springer, 2018.
  • Fank Martijn Bos. Numerical simulations of flapping foil and wing aerodynamics: Mesh deformation using radial basis functions. PhD thesis, Technische Universiteit Delf, 2010.
  • Armin Beckert and Holger Wendland. Multivariate interpolation for fluid-structure-interaction problems using radial basis functions. Aerospace Science and Technology, 5(2):125–134, 2001.
  • A De Boer, MS Van der Schoot, and Hester Bijl. Mesh deformation based on radial basis function interpolation. Computers & structures, 85(11-14):784–795, 2007.
  • Holger Wendland. Konstruktion und Untersuchung radialer Basisfunktionen mit kompaktem Träger. PhD thesis, Göttingen, Georg-August-Universität zu Göttingen, Diss, 1996.

Free Form Deformation technique:

  • Matteo Lombardi, Nicola Parolini, Alfio Quarteroni, and Gianluigi Rozza. Numerical simulation of sailing boats: Dynamics, fsi, and shape optimization. In Variational Analysis and Aerospace Engineering: Mathematical Challenges for Aerospace Design, pages 339–377. Springer, 2012.
  • Thomas W Sederberg and Scott R Parry. Free-form deformation of solid geometric models. ACM SIGGRAPH computer graphics, 20(4):151–160, 1986.
  • Michele Andreoli, Janka Ales, and Jean-Antoine Désidéri. Free-form-deformation parameterization for multilevel 3D shape optimization in aerodynamics. PhD thesis, INRIA, 2003.