From e52fa3b04237db7d688df7fd33750df7a0a2b62a Mon Sep 17 00:00:00 2001
From: DennisGlaeser <dennis.glaeser@iws.uni-stuttgart.de>
Date: Tue, 16 Jan 2018 17:34:53 +0100
Subject: [PATCH] [1p][test] update grid variables prior to output

In case of global caching, the grid variables have to be updated
as otherwise the old solution is written to disk.
---
 .../1p/implicit/incompressible/test_1pfv.cc                | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc b/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc
index 3d488de44a..ec15de9b66 100644
--- a/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc
+++ b/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc
@@ -118,7 +118,7 @@ int main(int argc, char** argv) try
     // we solve Ax = -r to save update and copy
     (*r) *= -1.0;
 
-    // // solve the linear system
+    // solve the linear system
     Dune::Timer solverTimer;
     using LinearSolver = SSORCGBackend<TypeTag>;
     auto linearSolver = std::make_shared<LinearSolver>();
@@ -128,6 +128,11 @@ int main(int argc, char** argv) try
     solverTimer.stop();
     if (mpiHelper.rank() == 0) std::cout << " took " << solverTimer.elapsed() << " seconds." << std::endl;
 
+    // the grid variables need to be up to date for subsequent output
+    Dune::Timer updateTimer; std::cout << "Updating variables ..." << std::flush;
+    gridVariables->update(x);
+    updateTimer.elapsed(); std::cout << " took " << updateTimer.elapsed() << std::endl;
+
     // output result to vtk
     vtkWriter.write(1.0);
 
-- 
GitLab