A two-dimensional finite-element model was developed to simulate both the optical and electrical characteristics of thin-film, p-i-n junction, solar cells. For a preliminary assessment of the model's capabilities, one or more p-i-n junctions were allowed to fill the region between the front and back surfaces; the semiconductor layers were taken to be made from mixtures of three different alloys of hydrogenated amorphous silicon; empirical relationships between the complex-valued relative optical permittivity and the bandgap were used; a transparent-conductingoxide layer was taken to be attached to the front surface of the solar cell; and a metallic reflector, which may be periodically corrugated, was supposed to be attached to the back surface. First the frequency-domain Maxwell postulates were solved in order to determine the absorption of solar photons and the subsequent generation of electron-hole pairs, with the AM1.5G solar spectrum taken to represent the incident solar flux. Next, the drift-diffusion equations were solved to track the evolution of electron and hole densities to a steady state. Preliminary numerical results from our model indicate that by increasing the number of p-i-n junctions from one to three, the solar-cell efficiency may be increased. The efficiency may be further increased by incorporating a periodically-corrugated back reflector, as opposed to a flat back reflector, in the case of a single p-i-n junction solar cell. We plan to apply the two-dimensional finite-element model for more complicated solar cells.