Heat transfer and material flow in friction stir welding