A semidefinite programming approach for the projection onto the cone of negative semidefinite symmetric tensors with applications to solid mechanics