A numerical model of ion implantation into presolar grains