  We develop a fast numerical procedure for analysis of nonlinear and nonlocal
electrodynamics of type-II superconducting films in transverse magnetic fields
taking into account realistic boundary conditions. Using this procedure we
explore stability of such films with respect to dendritic flux avalanches. The
calculated flux patterns are very similar to experimental magneto-optical
images of MgB2 and other superconductors, where the avalanche size and
morphology change dramatically with temperature. We also find a threshold
magnetic field, which agrees with both experiments and linear stability
analysis. The simulations predict the temperature rise during an avalanche,
where for a sub-microsecond time T ~ 1.5 Tc, and a precursor stage with large
thermal fluctuations.
