An Algorithm to Construct Subsolutions of Convex Optimal Control Problems