Numerical Simulation of a Flapping Foil with Chordwise or Spanwise Flexibility