A variational quantum algorithm-based numerical method for solving potential and Stokes flows