The extension of incompressible flow solvers to the weakly compressible regime