Understanding the turbulent dynamics in the outermost region of the tokamak is essential to predict and control the heat and particle loads to the vessel wall, a crucial problem for the entire fusion program. In this thesis, the problem is approached via two-fluid simulations run with the GBS code. We leverage a recent code upgrade to employ coordinate systems independent of the magnetic geometry, allowing the simulation of diverted configurations. We focus on double-null magnetic configurations. A double null configuration is being considered for DEMO due to its practical advantages of spreading the heat load over more strike points than a single null configuration, having a quiescent high field side on which heating antennas can be placed and the possibility to radiate more heat in detached scenarios. From a theoretical point of view, it is simpler to analyse than a single null because the high and low field sides are topologically separated. Simulations with a balanced double null configuration are run for a range of resistivities and safety factors. The results are used to study the density decay at the outer midplane. A double decay length is observed and a model to predict the two decay lengths is developed. The decay length of the near scrape-off layer is well described as the result of transport driven by a non-linearly saturated ballooning instability, while in the far scrape-off layer the density decay length is described using a model of intermittent transport mediated by blobs. The analytical estimates of the decay lengths agree well with the simulation results and typical experimental values and can therefore be used to guide tokamak design and operation. Unbalanced double null configurations are then simulated using a new elliptical coordinate system developed for this purpose, allowing more realistic elongation of the magnetic field. The distribution of the heat flux between the four diverter legs is calculated and compared to previous experimental results. We explain the heat flux sharing in terms of the $E \times B$, diamagnetic and parallel flows.