Stability analysis of the D-dimensional nonlinear Schrödinger equation with trap and two- and three-body interactions