Skip to main content
Log in

Geometrical shape optimization in fluid mechanics using FreeFem++

  • EDUCATIONAL ARTICLE
  • Published:
Structural and Multidisciplinary Optimization Aims and scope Submit manuscript

Abstract

In this article, we present simple and robust numerical methods for two-dimensional geometrical shape optimization problems, in the context of viscous flows driven by the stationary Navier-Stokes equations at low Reynolds number. The salient features of our algorithm are exposed with an educational purpose; in particular, the numerical resolution of the nonlinear stationary Navier-Stokes system, the Hadamard boundary variation method for calculating the sensitivity of the minimized function of the domain, and the mesh update strategy are carefully described. Several pedagogical examples are discussed. The corresponding program is written in the FreeFem++ environment, and it is freely available. Its chief features—and notably the implementation details of the main steps of our algorithm—are carefully presented, so that it can easily be handled and elaborated upon to deal with different, or more complex physical situations.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9
Listing 10
Listing 11
Listing 12
Listing 13
Listing 14
Listing 15
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20

References

  • Aage N, Poulsen TH, Gersborg-Hansen A, Sigmund O (2008) Topology optimization of large scale stokes flow problems. Struct Multidisc Optim 35:175–180

    Article  MathSciNet  Google Scholar 

  • Abraham F, Behr M, Heinkenschloss M (2005) Shape optimization in unsteady blood flow: a numerical study of non-newtonian effects. Comput Methods Biomech Biomed Eng 8:3. https://doi.org/10.1080/10255840500309562

    Google Scholar 

  • Agoshkov V, Quarteroni A, Rozza G (2006) Shape design in aorto-coronaric bypass anastomoses using perturbation theory. SIAM J Numer Anal 44(1):367–384

    Article  MathSciNet  Google Scholar 

  • Allaire G (2007) Conception optimale de structures, vol 58. Springer, Berlin

    MATH  Google Scholar 

  • Allaire G, Pantz O (2006) Structural optimization with freefem++. Struct Multidiscip Optim 32(3):173–181

    Article  MathSciNet  Google Scholar 

  • Allaire G, Jouve F, Toader AM (2004) Structural optimization using sensitivity analysis and a level-set method. J Comput Phys 194(1):363–393

    Article  MathSciNet  Google Scholar 

  • Amstutz S (2005) The topological asymptotic for the navier-stokes equations. ESAIM: Control Optim Calc Var 11(3):401–425

    Article  MathSciNet  Google Scholar 

  • Badra M, Caubet F, Dambrine M (2011) Detecting an obstacle immersed in a fluid by shape optimization methods, unpublished

    Article  MathSciNet  Google Scholar 

  • Baker TJ (2002) Mesh movement and metamorphosis. Eng Comput 18(1):188–198

    Article  MathSciNet  Google Scholar 

  • Bendsoe MP, Sigmund O (2013) Topology optimization: theory, methods, and applications. Springer Science & Business Media

  • Bergounioux M, Privat Y (2013) Shape optimization with Stokes constraints over the set of axisymmetric domains. SIAM J Control Optim 51(1):599–628. https://doi.org/10.1137/100818133

    Article  MathSciNet  MATH  Google Scholar 

  • Borrvall T, Petersson J (2003) Topology optimization of fluids in stokes flow. Int J Numer Meth Fluids 41:77–107

    Article  MathSciNet  Google Scholar 

  • Bourot JM (1974) On the numerical computation of the optimum profile in stokes flow. J Fluid Mech 65 (3):513–515

    Article  Google Scholar 

  • Bruneau CH, Chantalat F, Iollo A, Jordi B, Mortazavi I (2013) Modelling and shape optimization of an actuator. Struct Multidiscip Optim 48(6):1143–1151

    Article  MathSciNet  Google Scholar 

  • Bucur D, Buttazzo G (2002) Variational methods in some shape optimization problems. Appunti dei Corsi Tenuti da Docenti della Scuola. [Notes of Courses Given by Teachers at the School]. Scuola Normale Superiore, Pisa

    Google Scholar 

  • Burger M (2003) A framework for the construction of level set methods for shape optimization and reconstruction. Interfaces Free Bound 5(3):301–329

    Article  MathSciNet  Google Scholar 

  • Burkardt J, Gunzburger M, Peterson J (2002) Insensitive functionals, inconsistent gradients, spurious minima, and regularized functionals in flow optimization problems. Int J Comput Fluid Dyn 16(3):171–185. https://doi.org/10.1080/10618560290034663

    Article  MathSciNet  MATH  Google Scholar 

  • Carlson HW, Middleton WD (1964) A numerical method for the design of camber surfaces of supersonic wingswith arbitrary planforms. NASA Technical report

  • Challis V, Guest J (2009) Level set topology optimization of fluids in stokes flow. Int J Numer Meth Eng 79:1284–1308

    Article  MathSciNet  Google Scholar 

  • Challis VJ, Guest J (2009) Level set topology optimization of fluids in stokes flow. Int J Numer Methods Eng 79(10):1284–1308

    Article  MathSciNet  Google Scholar 

  • Choi JH, Kim KY, Chung DS (1997) Numerical optimization for design of an automotive cooling fan. Tech. rep., SAE Technical Paper

  • Ciarlet P (2002) The finite element method for elliptic problems. Soc Ind Appl Math. https://doi.org/10.1137/1.9780898719208 http://epubs.siam.org/doi/abs/10.1137/1.9780898719208

  • Çlabuk H., Modi V (1992) Optimum plane diffusers in laminar flow. J Fluid Mech 237:373–393

    Article  Google Scholar 

  • De Gournay F (2006) Velocity extension for the level-set method and multiple eigenvalues in shape optimization. SIAM J Control Optim 45(1):343–367

    Article  MathSciNet  Google Scholar 

  • de La Sablonière XD, Mauroy B, Privat Y (2011) Shape minimization of the dissipated energy in dyadic trees. Discrete Contin Dyn Syst Ser B 16(3):767–799. https://doi.org/10.3934/dcdsb.2011.16.767

    Article  MathSciNet  MATH  Google Scholar 

  • Dobrzynski C, Frey P (2008) Anisotropic delaunay mesh adaptation for unsteady simulations. In: Proceedings of the 17th international meshing roundtable

  • Dogan G, Morin P, Nochetto RH, Verani M (2007) Discrete gradient flows for shape optimization and applications. Comput Methods Appl Mech Eng 196(37):3898–3914

    Article  MathSciNet  Google Scholar 

  • Donea J, Huerta A (2003) Finite element methods for flow problems. Wiley, New York

    Book  Google Scholar 

  • Duan XB, Ma YC, Zhang R (2008) Shape-topology optimization for navier-stokes problem using variational level set method. J Comput Appl Math 222:487–499

    Article  MathSciNet  Google Scholar 

  • Ern A, Guermond JL (2013) Theory and practice of finite elements, vol 159. Springer Science & Business Media

  • Evgrafov A (2006) Topology optimization of slightly compressible fluids. ZAMM-J Appl Math Mech/Z Angew Math Mech 86(1):46–62

    Article  MathSciNet  Google Scholar 

  • Frey P, George PL (2008) Mesh generation, application to Finite Elements. Wiley, New York

    MATH  Google Scholar 

  • Garcke H, Hecht C, Hinze M, Kahle C (2015) Numerical approximation of phase field based shape and topology optimization for fluids. SIAM J Sci Comput 37(4):A1846–A1871

    Article  MathSciNet  Google Scholar 

  • Gersborg-Hansen A, Sigmund O, Haber RB (2005) Topology optimization of channel flow problems. Struct Multidiscip Optim 30(3):181–192

    Article  MathSciNet  Google Scholar 

  • Girault V, Raviart PA (1986) Finite element methods for Navier-Stokes Equations. Springer, Berlin

    Book  Google Scholar 

  • Guest J, Prévost J (2006) Topology optimization of creeping fluid flows using a darcystokes finite element. Int J Numer Meth Eng 66:461–484

    Article  Google Scholar 

  • Gunzburger MD (2003) Perspectives in flow control and optimization, vol 5. SIAM, Philadelphia

    MATH  Google Scholar 

  • Hecht F, Pironneau O, Le Hyaric A, Ohtsuka K (2005) Freefem++ manual

  • Henrot A, Pierre M (2005) Variation et optimisation de formes, vol 48. Springer, Berlin. https://doi.org/10.1007/3-540-37689-5

    Book  Google Scholar 

  • Henrot A, Privat Y (2008) Une conduite cylindrique n’est pas optimale pour minimiser l’énergie dissipée par un fluide. C R Math Acad Sci Paris 346(19–20):1057–1061. https://doi.org/10.1016/j.crma.2008.09.005

    Article  MathSciNet  Google Scholar 

  • Henrot A, Privat Y (2010) What is the optimal shape of a pipe. Arch Ration Mech Anal 196(1):281–302. https://doi.org/10.1007/s00205-009-0243-8

    Article  MathSciNet  Google Scholar 

  • Hicks RM, Henne PA (1978) Wing design by numerical optimization. J Aircr 15(7):407–412

    Article  Google Scholar 

  • Hicks RM, Murman EM, Vanderplaats GN (1974) An assessment of airfoil design by numerical optimization

  • Jameson A (1988) Aerodynamic design via control theory. J Sci Comput 3(3):233–260

    Article  Google Scholar 

  • Kreissl S, Maute K (2012) Levelset based fluid topology optimization using the extended finite element method. Struct Multidiscip Optim 46(3):311–326

    Article  MathSciNet  Google Scholar 

  • Kreissl S, Pingen G, Maute K (2011a) An explicit level set approach for generalized shape optimization of fluids with the lattice Boltzmann method. Int J Numer Methods Fluids 65(5):496–519

    Article  Google Scholar 

  • Kreissl S, Pingen G, Maute K (2011b) Topology optimization for unsteady flow. Int J Numer Methods Eng 87(13):1229–1253. https://doi.org/10.1002/nme.3151

  • Lions JL (1971) Optimal control of systems governed by partial differential equations, vol 170. Springer, Berlin

    Book  Google Scholar 

  • Litman A, Lesselier D, Santosa F (1998) Reconstruction of a two-dimensional binary obstacle by controlled evolution of a level-set. Inverse Prob 14(3):685. http://stacks.iop.org/0266-5611/14/i=3/a=018

    Article  MathSciNet  Google Scholar 

  • Mohammadi B, Pironneau O (2004) Shape optimization in fluid mechanics. Annu Rev Fluid Mech 36:255–279

    Article  MathSciNet  Google Scholar 

  • Mohammadi B, Pironneau O (2010) Applied shape optimization for fluids. Oxford University Press, London

    MATH  Google Scholar 

  • Munson B, Rothmayer A, Okiishi T, Huebsch W (2013) Fundamentals of fluid mechanics, 7th edn. Wiley, New York

    Google Scholar 

  • Murat F, Simon J (1976) Sur le contrôle par un domaine géométrique. Technical report RR-76005

  • Nocedal J, Wright S (2006) Numerical optimization. Springer, Berlin

    MATH  Google Scholar 

  • Novotny AA, Sokołowski J (2012) Topological derivatives in shape optimization. Springer Science & Business Media

  • Osher S, Sethian JA (1988) Fronts propagating with curvature-dependent speed: algorithms based on hamilton-jacobi formulations. J Comput Phys 79(1):12–49

    Article  MathSciNet  Google Scholar 

  • Pingen G, Evgrafov A, Maute K (2007) Topology optimization of flow domains using the lattice boltzmann method. Struct Multidiscip Optim 34(6):507–524

    Article  MathSciNet  Google Scholar 

  • Pingen G, Waidmann M, Evgrafov A, Maute K (2010) A parametric level-set approach for topology optimization of flow domains. Struct Multidiscip Optim 41(1):117–131

    Article  MathSciNet  Google Scholar 

  • Pironneau O (1973) On optimum profiles in stokes flow. J Fluid Mech 59(1):117–128

    Article  MathSciNet  Google Scholar 

  • Pironneau O (1974) On optimum design in fluid mechanics. J Fluid Mech 64(01):97–110

    Article  MathSciNet  Google Scholar 

  • Pironneau O (2012) Optimal shape design for elliptic systems. Springer Science & Business Media

  • Sethian JA, Wiegmann A (2000) Structural boundary design via level set and immersed interface methods. J Comput Phys 163(2):489–528

    Article  MathSciNet  Google Scholar 

  • Sigmund O (2001) A 99 line topology optimization code written in matlab. Struct Multidiscip Optim 21 (2):120–127

    Article  MathSciNet  Google Scholar 

  • Sokołowski J, Zolésio JP (1992) Introduction to shape optimization. Springer Series in Computational Mathematics. Springer, Berlin

    Book  Google Scholar 

  • Temam R (1977) Navier-stokes equation: theory and numerical analysis. North Holland, Amsterdam

    MATH  Google Scholar 

  • Wang MY, Wang X, Guo D (2003) A level set method for structural topology optimization. Comput Methods Appl Mech Eng 192(1):227–246

    Article  MathSciNet  Google Scholar 

  • Zhou S, Li Q (2008) A variational level set method for the topology optimization of steady-state navier-stokes flow. J Comput Phys 227:10178–10195

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Florian Omnès.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Y. Privat was partially supported by the Project ‘Analysis and simulation of optimal shapes—application to lifesciences’ of the Paris City Hall.

Appendix A: Sketch of the proof of Theorem 2

Appendix A: Sketch of the proof of Theorem 2

The differentiability of the solution \((\mathbf {u},p)\) to the Navier-Stokes system (1) with respect to the domain is a technical, albeit quite classical matter, and we admit the result, referring for instance to Henrot and Pierre (2005) for the rigorous definition of this notion, and to Henrot and Privat (2010) or de La Sablonière et al. (2011) for this precise calculation. The derivative \((\mathbf {u}^{\prime }, p^{\prime })\) of \((\mathbf {u},p)\) with respect to the domain, in the direction \(\boldsymbol {\theta } \in {\Theta }_{ad}\), is solution to the problem:

$$ \left\{ \begin{array}{cl} -\nu{\Delta} \mathbf{u}^{\prime}+(\nabla \mathbf{u} )\mathbf{u}^{\prime} + (\nabla \mathbf{u}^{\prime})\mathbf{u} + \nabla p^{\prime} = 0 & \text{in } {\Omega},\\ \text{div}(\mathbf{u}^{\prime}) = 0 & \text{in } {\Omega},\\ \sigma(\mathbf{u}^{\prime},p^{\prime})\mathbf{n} = 0 & \text{on } {\Gamma}_{\text{out}},\\ \mathbf{u}^{\prime}= 0 & \text{on } {\Gamma}_{\text{in}},\\ \mathbf{u}^{\prime}=-\left( \frac{\partial \mathbf{u}}{\partial n}\right)(\boldsymbol{\theta}.n) & \text{on } {\Gamma}. \end{array} \right. $$
(32)

Also, we only present the calculation of the shape derivative of the functional \(D({\Omega })\) given by (5), the calculation being on any point easier in the case of \(E({\Omega })\); see de La Sablonière et al. (2011) if need be.

Using the chain rule from the definition (5) of \(D({\Omega })\) yields:

$$ D^{\prime}({\Omega})(\boldsymbol{\theta}) ={\int}_{{\Gamma}_{\text{out}}} \mathbf{u}^{\prime}\cdot(\mathbf{u}-\mathbf{u}_{\text{ref}})\,ds. $$
(33)

The main idea of the proof consists in using the adjoint state \((\mathbf {v}_{d},q_{d})\), solution to (12): performing several integrations by parts allows to eliminate the unknown derivatives \((\mathbf {u}^{\prime },p^{\prime })\) from the expression (33). More precisely, multiplying the first equation in (32) by \(\mathbf {v}_{d}\) and integrating by parts yields

$$\begin{array}{@{}rcl@{}} 0&=& {\int}_{{\Omega}} (-\nu{\Delta} \mathbf{u}^{\prime}+(\nabla \mathbf{u} )\mathbf{u}^{\prime} + (\nabla \mathbf{u}^{\prime})\mathbf{u} + \nabla p^{\prime}) \cdot \mathbf{v}_{d}\,dx\\ &=&{\int}_{{\Omega}}(2\nu \:e(\mathbf{u}^{\prime}):e(\mathbf{v}_{d}) - \text{div}(\mathbf{v}_{d}) p^{\prime} + (\nabla \mathbf{u})\mathbf{u}^{\prime}\cdot\mathbf{v}_{d}\\ &&+ (\nabla \mathbf{u}^{\prime})\mathbf{u}\cdot\mathbf{v}_{d})\,dx - {\int}_{\partial{\Omega}}\sigma (\mathbf{u}^{\prime},p^{\prime})\mathbf{n}\cdot\mathbf{v}_{d}\,ds\\ &=& {\int}_{\Omega}{(2\nu\: e(\mathbf{u}^{\prime}):e(\mathbf{v}_{d}) + (\nabla \mathbf{u})\mathbf{u}^{\prime}\cdot\mathbf{v}_{d} + (\nabla \mathbf{u}^{\prime})\mathbf{u}\cdot\mathbf{v}_{d})\,dx}\\ \end{array} $$
(34)

where the boundary integral has vanished thanks to the boundary conditions satisfies by \((\mathbf {u}^{\prime },p^{\prime })\) and \((\mathbf {v}_{d},q_{d})\). Likewise, multiplying the first equation in (12) by \(\mathbf {u}^{\prime }\) and integrating by parts, we obtain:

$$\begin{array}{@{}rcl@{}} 0&=& {\int}_{{\Omega}} \left( -\nu{\Delta} \mathbf{v}_{d}+(\nabla \mathbf{u})^{T}\mathbf{v} -(\nabla \mathbf{v}_{d} )\mathbf{u} + \nabla q_{d}\right) \cdot \mathbf{u}^{\prime} \, dx \\ &=& {\int}_{\Omega}{ \left( 2\nu\: e(\mathbf{u}^{\prime}): e(\mathbf{v}_{d}) +(\nabla\mathbf{u}) \mathbf{u}^{\prime}\cdot\mathbf{v}_{d} -(\nabla\mathbf{v}_{d})\mathbf{u}\cdot\mathbf{u}^{\prime}\right)\, dx}\\ &&-{\int}_{\partial{\Omega}}\sigma (\mathbf{v}_{d},q_{d})\mathbf{n}\cdot\mathbf{u}^{\prime}\,ds. \end{array} $$
(35)

Combining Eqs. 34 and (35) leads to:

$$ -{\int}_{\Omega}((\nabla\mathbf{u}^{\prime})\mathbf{u}\cdot\mathbf{v}_{d}+ (\nabla\mathbf{v}_{d})\mathbf{u}\cdot\mathbf{u}^{\prime})\,dx = {\int}_{\partial{\Omega}} \sigma (\mathbf{v}_{d},q_{d})\mathbf{n}\,ds. $$
(36)

Now using the identity

$$\begin{array}{@{}rcl@{}} {\int}_{\Omega}{(\nabla\mathbf{v}_{d})\cdot \mathbf{u} \cdot\mathbf{u}^{\prime}\,dx} &=& {\int}_{\partial{\Omega}}{(\mathbf{v}_{d}\cdot\mathbf{u}^{\prime})(\mathbf{u}\cdot\mathbf{n})\,ds}\\ &&- {\int}_{\Omega}{(\nabla\mathbf{u}^{\prime})\mathbf{u}\cdot\mathbf{v}_{d}\,dx}, \end{array} $$
(37)

which again follows from integration by parts, (36) rewrites:

$$ {\int}_{\partial{\Omega}} {(\sigma(\mathbf{v}_{d},q_{d})\mathbf{n}\cdot\mathbf{u}^{\prime} + (\mathbf{u}^{\prime}\cdot\mathbf{v}_{d})(\mathbf{u}\cdot\mathbf{n}))\,ds} = 0. $$
(38)

Eventually, taking into account the boundary conditions in the systems (1), (10) and (32) yields:

$$\begin{array}{@{}rcl@{}} D^{\prime}({\Omega})(\boldsymbol{\theta}) &=&{\int}_{{\Gamma}_{\text{out}}} (\mathbf{u}-\mathbf{u}_{\text{ref}})\cdot\mathbf{u}^{\prime}\,ds\\ &=& {\int}_{{\Gamma}_{\text{out}}}{(\sigma (\mathbf{v}_{d},q_{d})\mathbf{n} + (\mathbf{u} \cdot \mathbf{n})\mathbf{v}_{d}) \cdot \mathbf{u}^{\prime}\,ds}\\ &=&- {\int}_{{\Gamma}}{(\sigma (\mathbf{v}_{d},q_{d})\mathbf{n} + (\mathbf{u} \cdot \mathbf{n})\mathbf{v}_{d}) \cdot \mathbf{u}^{\prime}\,ds}\\ &=& {\int}_{{\Gamma}}{(\sigma (\mathbf{v}_{d},q_{d})\mathbf{n} + (\mathbf{u} \cdot \mathbf{n})\mathbf{v}_{d}) \cdot \frac{\partial\mathbf{u}}{\partial n} \:\boldsymbol{\theta} \cdot n\,ds}.\\ \end{array} $$
(39)

We now use the boundary conditions \(\mathbf {u} = 0\) and \(\mathbf {v}_{d} = 0\) on \({\Gamma }\) to simplify this last expression. For any tangential vector field \(\boldsymbol {\tau }: {\Gamma } \to \mathbb {R}^{d}\) to \({\Gamma }\), they imply that \(\frac {\partial \mathbf {u}}{\partial \boldsymbol {\tau }} = 0\), and so, using that \(\text {div}(\mathbf {u}) = 0\),

$$ \frac{\partial \mathbf{u}}{\partial n} \cdot \mathbf{n} = 0 $$
(40)

the same relation holds for \(\mathbf {v}_{d}\). Hence (39) rewrites:

$$D^{\prime}({\Omega})(\boldsymbol{\theta}) = {\int}_{{\Gamma}}{2\nu \: e(\mathbf{v}_{d})\mathbf{n} \cdot \frac{\partial\mathbf{u}}{\partial n} \:\boldsymbol{\theta} \cdot \mathbf{n}\,ds}.$$

After a few algebraic manipulations based again on (40), we eventually obtain:

$$ D^{\prime}({\Omega})(\boldsymbol{\theta}) = {\int}_{\Gamma}{ 2\nu \: e(\mathbf{u}):e(\mathbf{v}_{d})(\boldsymbol{\theta}\cdot\mathbf{n})\,ds}, $$
(41)

which is the desired result, and terminates the proof of Theorem 2.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Dapogny, C., Frey, P., Omnès, F. et al. Geometrical shape optimization in fluid mechanics using FreeFem++. Struct Multidisc Optim 58, 2761–2788 (2018). https://doi.org/10.1007/s00158-018-2023-2

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00158-018-2023-2

Keywords

Navigation