An accurate method for structural analysis of 2D foam