Based on patch contributed by Kevin Nordin-Bates Resolves patch request https://bugs.openfoam.org/view.php?id=3458