Energetic approach to subgrain formation