In nonlinear MHD simulations of edge localized modes (ELMs) with the code JOREK, a strong m = n = 0 poloidal flow localized in the H-mode pedestal region shears density filaments off the separatrix. This flow is nonlinearly induced by the ballooning instability (Huysmans and Czarny 2007 Nucl. Fusion 47 659, Huysmans et al 2009 Plasma Phys. Control. Fusion 51 124012). An approach of the reduced resistive MHD equations used in JOREK leads to an analytical interpretation of the equilibrium flow in both circular and X-point plasmas. Transitions between two different flow structures have been found. Similar transitions between equilibrium flow states had been predicted by Strauss (1995 Phys. Plasmas 2 1229). Finally, results concerning the influence of the equilibrium flow on the linear and nonlinear stabilities of the ELM are presented. ELM-like multiple crashes were simulated.