Regarding this method, OpenFOAM includes one special solver adjointShapeOptimizationFoam.
adjointShapeOptimizationFoam can be described as a steady-state solver for incompressible, turbulent flow of non-Newtonian fluids with optimisation of duct shape by applying “blockage” in regions causing pressure loss as estimated using an adjoint formulation.
This adjointShapeOptimizationFoam solver was implemented based on the following paper: “Implementation of a continuous adjoint for topology optimization of ducted flows” C. Othmer, E. de Villiers, H.G. Weller AIAA-2007-3947
This solver can be also understood as simpleFoam with the adjoint method in it.
This solver seems to make sense to be applied to internal flows. For example on ducting flows.