Centralized control of district heating networks during failure events using discrete adjoint sensitivities