This 2D cross-section renders a polycrystalline perovskite solar-cell film as a from-scratch Voronoi-style grain tiling: random nucleation seed points are scattered across the film, and every cell in a fine grid is assigned to its nearest seed, exactly the microstructure an SEM cross-section reveals. The engine then walks every cell edge of the resulting tiling and counts the edges that separate two different grains to obtain a real, measured grain-boundary length density — a genuine geometric quantity, not a formula shortcut. Photogenerated charge carriers spawn near the illuminated top surface and random-walk toward the top contact under diffusion and drift; whenever a carrier occupies a boundary cell it faces a trap-assisted Shockley-Read-Hall recombination probability set by that measured boundary density and the passivation slider. A live chart regenerates independent tilings at several grain sizes, re-runs carriers through each to completion, and plots the resulting collection efficiency — confirming, from real generated geometry rather than an assumed relationship, that smaller average grain size means more measured grain-boundary length per unit area and lower collection efficiency, exactly as in real perovskite and perovskite/silicon tandem photovoltaics.