In the TRICE algorithms this aspect of the problem formulation (which can be more complicated than in this example) is fully incorporated.
More details can be found in the paper M. Heinkenschloss: Sequential Quadratic Programming Methods for the Control of Fluids Governed by the Steady State Navier Stokes Equations.