We develop a unified numerical approach for modeling semiconductor-superconductor heterostructures. All the key physical ingredients of these systems - orbital effect of magnetic field, superconducting proximity effect, and electrostatic environment - are taken into account on equal footing in a realistic device geometry. As a model system, we consider indium arsenide (InAs) nanowires with an epitaxial aluminum (Al) shell, which is one of the most promising platforms for Majorana zero modes. We demonstrate qualitative and quantitative agreement of the obtained results with the existing experimental data. Finally, we characterize the topological superconducting phase emerging in a finite magnetic field and calculate the corresponding topological phase diagram.