Numerical and theoretical study of flapping airfoil aerodynamics using a parallelized immersed-boundary method