What method minimizes pipe distortion caused by contraction of a metal as it cools after being welded?

What method minimizes pipe distortion caused by contraction of a metal as it cools after being welded?