Patch contributed by Bruno Santos Resolves contribution request https://bugs.openfoam.org/view.php?id=3794