Control and optimzation of sub-surface flow