Flow simulation and topological rearrangements of ordered foams