Fundamentals of Produced Water and Wastewater Management in Upstream Operation