From 56a82ec469303bf1f32f920a55e5554ff8c65821 Mon Sep 17 00:00:00 2001
From: Timo Heister <timo.heister@gmail.com>
Date: Tue, 31 May 2022 16:19:24 -0400
Subject: [PATCH] fix parallel .vtu missing footer

---
 source/base/data_out_base.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc
index bfa770c2eb..a7bbb7d98c 100644
--- a/source/base/data_out_base.cc
+++ b/source/base/data_out_base.cc
@@ -7786,6 +7786,11 @@ DataOutInterface<dim, spacedim>::write_vtu_in_parallel(
       }
   }
 
+  // Make sure we sync to disk. This ensures that the change in file
+  // size caused by the write_at() for the footer is visible for all
+  // ranks. Otherwise, the footer is sometimes lost.
+  ierr = MPI_File_sync(fh);
+  AssertThrowMPI(ierr);
 
   ierr = MPI_File_close(&fh);
   AssertThrowMPI(ierr);
-- 
2.39.5