Solving the nonlinear periodic wave problems with the Homotopy Analysis Method