An investigation of the residual stress of a machined workpiece considering tool flank wear