3D source simulation method for static fields in inhomogeneous media