Solar flares and avalanches in driven dissipative systems