Finally completed function!

Added iterations for optimizing the flow vectors. Error threshold
changed to 0.01. Extra figures displayed to visualize the flow.