The open-source CFD library OpenFoam® contains a method for solving free surface Newtonian flows using the Reynolds averaged Navier–Stokes equations coupled with a volume of fluid method. In this paper, it is demonstrated how this has been extended with a generic wave generation and absorption method termed ‘wave relaxation zones’, on which a detailed account is given. The ability to use OpenFoam for the modelling of waves is demonstrated using two benchmark test cases, which show the ability to model wave propagation and wave breaking. Furthermore, the reflection coefficient from outlet relaxation zones is considered for a range of parameters. The toolbox is implemented in C++, and the flexibility in deriving new relaxation methods and implementing new wave theories along with other shapes of the relaxation zone is outlined. Subsequent to the publication of this paper, the toolbox has been made freely available through the OpenFoam-Extend Community. Copyright © 2011 John Wiley & Sons, Ltd.