Insulating materials usually suffer charging effects when irradiated by charged particles. In this paper, we present a Monte Carlo study on the charging effect caused by electron beam irradiation for sample structures with any complex geometry. When transporting in an insulating solid, electrons encounter elastic and inelastic scattering events; the Mott cross section and a Lorentz-type dielectric function are respectively employed to describe such scatterings. In addition, the band gap and the electron-long optical phonon interaction are taken into account. The electronic excitation in inelastic scattering causes generation of electron-hole pairs; these negative and positive charges establish an inner electric field, which in turn induces the drift of charges to be trapped by impurities, defects, vacancies etc in the solid, where the distributions of trapping sites are assumed to have uniform density. Under charging conditions, the inner electric field distorts electron trajectories, and the surface electric potential dynamically alters secondary electron emission. We present, in this work, an iterative modeling method for a self-consistent calculation of electric potential; the method has advantages in treating any structure with arbitrary complex geometry, in comparison with the image charge method-which is limited to a quite simple boundary geometry. Our modeling is based on: the combination of the finite triangle mesh method for an arbitrary geometry construction; a self-consistent method for the spatial potential calculation; and a full dynamic description for the motion of deposited charges. Example calculations have been done to simulate secondary electron yield of SiO 2 for a semi-infinite solid, the charging for a heterostructure of SiO 2 film grown on an Au substrate, and SEM imaging of a SiO 2 line structure with rough surfaces and SiO 2 nanoparticles with irregular shapes. The simulations have explored interesting interlaced charge layer distribution underneath the nanoparticle surface and the mechanism by which it is produced.