The accumulated effect of energy extraction by wind turbines in a wind farm leads to a collective interaction between the farm and the atmospheric boundary layer (ABL). To date, many aspects of wind-farm--ABL interaction are still not entirely understood, and wind-farm boundary layers remain an active field of research. In addition to measurement campaigns and wind-tunnel experiments, numerical simulations provide an indispensable tool to study the complex flow phenomena in and around large wind farms in an idealised and controlled environment. The general purpose of this PhD is to improve the current understanding of the flow through large wind farms and the interaction with the atmospheric boundary layer. The main focus thereby lies on the influence of atmospheric stability, inversion layers and Coriolis effects on wind-energy extraction in large wind farms. It is shown that overlying inversion layers actively control the height of the boundary layer, which is directly related to the energy content of the ABL. Moreover, Coriolis forces affect the wind-energy extraction indirectly by causing wake deflection and modifying the effective wind-farm layout. In addition to these outer-layer effects, it is found that atmospheric gravity waves on the inversion layer and in the free atmosphere strongly influence the wind-farm flow behaviour by inducing pressure gradients in the boundary layer. These pressure gradients lead to considerable changes in wind speed and direction upstream of the wind farm and modify the wind-farm energy balance.