From 7a7fa4350df2dbdcd6e81c67c40004189a57acf7 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Fri, 3 Feb 2017 14:51:04 +0000
Subject: [PATCH] Time: when "writeFormat" is set to "binary" disallow
 compression

Compressing and decompressing binary files introduces a significant IO overhead
without a providing significant reduction in file-size.
---
 src/OpenFOAM/db/Time/TimeIO.C | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C
index 436661040fa..39e88a66d18 100644
--- a/src/OpenFOAM/db/Time/TimeIO.C
+++ b/src/OpenFOAM/db/Time/TimeIO.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2017 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -347,6 +347,20 @@ void Foam::Time::readDict()
         (
             controlDict_.lookup("writeCompression")
         );
+
+        if
+        (
+            writeFormat_ == IOstream::BINARY
+         && writeCompression_ == IOstream::COMPRESSED
+        )
+        {
+            IOWarningInFunction(controlDict_)
+                << "Selecting compressed binary is inefficient and ineffective"
+                   ", resetting to uncompressed binary"
+                << endl;
+
+            writeCompression_ = IOstream::UNCOMPRESSED;
+        }
     }
 
     controlDict_.readIfPresent("graphFormat", graphFormat_);
-- 
GitLab