The diurnal variation of temperature leads to significant deviations from neutral atmospheric stability conditions in the atmospheric boundary layer. Previous field observations have revealed ambiguities in the effect of atmospheric stability on wake losses and power production of wind farms. Wake losses are also known to be affected significantly by the configuration (layout and wind direction) of the wind farm. Large-eddy simulations (LES) of the Lillgrund wind farm (48 closely-spaced turbines) are conducted in order to study the combined effects of layout, wind direction and stability in large but finite wind farms. In keeping with previous theoretical estimates, wake losses are found to be larger under stable than under neutral conditions for the perfectly aligned configuration. In contrast, in three of the four configurations studied, wake losses actually decrease under stable stratification compared to under neutral conditions. Two competing effects, based on the rate of wake recovery and the lateral spread of the wakes are identified, which explain this unexpected influence of stability on the power production. This study reveals that atmospheric stability and configuration interact in a complicated manner to determine the total power produced by large, finite wind farms. The LES results are also used to develop simple statistical models that predict the power based only on geometric parameters derived from the wind farm layout. These geometry-based models are proposed as alternatives to the industry-standard PARK model, and can be used for quick evaluation and screening of wind farm layouts. Finally, current efforts towards high-order simulations of deformations of solids, and their coupling to fluids, in a fully Eulerian framework, will be briefly discussed.