Due to the open field lines, the scrape-off layer and divertor region of tokamak plasmas is a complex, two-dimensional system, involving transport parallel and perpendicular to the magnetic field, as well as interaction of the plasma with surfaces and with the neutral gas. Therefore sophisticated two-dimensional codes are required to model the divertor and edge physics. In this paper, the B2-EIRENE code package is used to simulate the ASDEX-Upgrade scrape-off layer plasma and the neutral gas dynamics in a fully self-consistent way. Specific ASDEX-Upgrade discharges are modelled using the actual magnetic configuration and in-vessel components. Single fluid as well as multifluid calculations including self-consistent target and wall erosion of carbon are described. At given input power and bulk plasma radiation, typical divertor plasma profiles from Langmuir probes are fitted by varying the separatrix density and the transport coefficients. On the basis of such multifluid fits, spectroscopic divertor diagnostics are numerically modelled and compared with measured profiles, and reasonable agreement is found.