Adaptive Discretization of Nonlinear Optimization Models for Energy Supply Systems