Charging effects caused by secondary electron (SE) emission of a nanostructured material during ion beam irradiation are investigated by simulation. The materials simulated are a 100-nm-high SiO2 step on an Si substrate, and a 100-nm-deep trench through an SiO2 film to the Si substrate. Each position on the surface is irradiated with a 30 keV Ga ion beam. A Monte Carlo based model for SE emission from SiO2 and Si is used for simulation in which the charging of SiO2 induced by ion beam irradiation is taken into account. Dynamic and self-consistent calculations are performed to model the transport of the ions and SEs, the charge accumulation in SiO2, and the electric field in the SiO2 and in the vacuum. The calculated charging characteristics are compared with those calculated for a 1 keV electron beam. For Ga ion incidence; as a result of successive positive charging, the SE yield of the SiO2 layer decreases more strongly than for electron incidence, eventually vanishing, and the surface voltage progressively increases. The SE yield increases when the Ga ion incidence occurs at the position near the step edge on the layer, in a similar way to that observed for the electron incidence. The increase in the yield is more localized than for electron incidence. When the trench is irradiated with the Ga ion beam, the sidewall of the trench becomes negatively charged from reentrance of SEs emitted from the bottom of the trench. This negative charging increases the SE yield at the bottom of the trench (an effect also observed in the simulations of electron beam irradiation), because it assists SEs, which may be reabsorbed by the sidewall if they are not charged, to exit the trench. As the width of the trench decreases, the increase in the electron yield is enhanced. This enhancement is stronger for the incident ion beam than for the electron beam.