An immersed boundary method for fluid-structure interactions