Dynamic shakedown theory allowing for second order geometric effects