Minimisation of the residual stress in the heat affected zone by means of numerical methods