Discontinuities in mathematical modelling: origin, detection and resolution