The classical example of second-order state constraint is the one of the Euler-Bernoulli beam, see Bryson et al. 
The exact solution, for various values of a, is displayed in figure 1.
Figure 1: Shape of a beam: the three cases and the locus of junction points
The qualitative behavior is as follows:
If , the constraint is not active and the solution is .
If , there is a touch point at .
If , there is a boundary arc without strict complementarity: the measure has its support at end points. The locus of switching points is piecewise affine.
Our numerical results are in accordance with the theory: we display in figure 2 the displacement and control when , i.e., when a boundary arc occurs.
Numerical simulations: problem clamped_beam
Discretization: Gauss II with 100 steps.
Figure 2: Clamped beam . Boundary and control.
 A.E Bryson, W.F. Denham, and S.E Dreyfus. Optimal programming problems with inequality constraints I: necessary conditions for extremal solutions. AIAA Journal, 1:2544-2550, 1963.