Controlling the stress in a material with an inhomogeneity