Clearly CFD is used as one of the tools to improve the performance of systems and machines. Hence it comes as no surprise that during the design process lots of flow simulations are carried out. Sometimes the design recommendations are available instantly and quick engineering look at the simulation results is enough to guide the geometry modifications. In other cases, however, the choice of the optimal design is highly non-trivial and the resultsant geometries are non-intuitive.
There the automatic optimization algorithms come in useful. One can distinguish a few distinct approaches in the area:
- MATLAB built-in optimizers such as the optimization Toolbox
- NLopt  set of algorithms
- Derivative-free algorithms such as Cobyla algorithm 
- Adjoint-based algorithms 
As well as many others. Everything depends on the time and purpose.
 M. J. D. Powell (2007). A view of algorithms for optimization without derivatives. Cambridge University Technical Report DAMTP 2007.
 M. B. GILES1 and N. A. PIERCE An Introduction to the Adjoint Approach to Design. , Flow, Turbulence and Combustion 65: 393–415, 2000