From aa226c6480615f31a392a63f0966ddc73337b40d Mon Sep 17 00:00:00 2001
From: Alexander Jaust <alexander.jaust@ipvs.uni-stuttgart.de>
Date: Sat, 21 Dec 2019 13:48:06 +0100
Subject: [PATCH] update output routines for monolithic solver

---
 appl/coupling-ff-pm/common/outputhelper.hh    |  2 +-
 .../fvca-monolithic.cc                        | 39 +++++++++++++++----
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/appl/coupling-ff-pm/common/outputhelper.hh b/appl/coupling-ff-pm/common/outputhelper.hh
index d414eda..51baab5 100644
--- a/appl/coupling-ff-pm/common/outputhelper.hh
+++ b/appl/coupling-ff-pm/common/outputhelper.hh
@@ -52,7 +52,7 @@ std::tuple<double,double,double> writeVelocitiesOnInterfaceToFile( const std::st
         const int prec = ofs.precision();
         ofs << std::setprecision(std::numeric_limits<double>::digits10 + 1) << v << "\n";
         ofs.precision( prec );
-        ofs << v / 1e3 << "\n";
+//        ofs << v / 1e3 << "\n";
       }
     }
   }
diff --git a/appl/coupling-ff-pm/fvca-monolithic-reversed/fvca-monolithic.cc b/appl/coupling-ff-pm/fvca-monolithic-reversed/fvca-monolithic.cc
index 7bddbfc..48ae76d 100644
--- a/appl/coupling-ff-pm/fvca-monolithic-reversed/fvca-monolithic.cc
+++ b/appl/coupling-ff-pm/fvca-monolithic-reversed/fvca-monolithic.cc
@@ -151,9 +151,9 @@ int main(int argc, char** argv) try
     auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry);
     darcyGridVariables->init(sol[darcyIdx]);
 
-//    couplingManager->setGridVariables(std::make_tuple(stokesGridVariables->cellCenterGridVariablesPtr(),
-//                                                      stokesGridVariables->faceGridVariablesPtr(),
-//                                                      darcyGridVariables));
+    couplingManager->setGridVariables(std::make_tuple(stokesGridVariables->cellCenterGridVariablesPtr(),
+                                                      stokesGridVariables->faceGridVariablesPtr(),
+                                                      darcyGridVariables));
 
     // intialize the vtk output module
     StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesProblem->name());
@@ -249,13 +249,26 @@ int main(int argc, char** argv) try
                                                                                 *darcyProblem,
                                                                                 *darcyGridVariables,
                                                                                 sol[darcyIdx] );
-      const int prec = std::cout.precision();
-      std::cout << "Velocity statistics:" << std::endl
+      const auto prec = std::cout.precision();
+      std::cout << "Velocity statistics (Darcy):" << std::endl
                 << std::setprecision(std::numeric_limits<double>::digits10 + 1)
                 << "  min: " << min << std::endl
                 << "  max: " << max << std::endl
                 << "  sum: " << sum << std::endl;
       std::cout.precision( prec );
+
+      {
+        const std::string filenameDarcy="darcy-flow-statistics.txt";
+        std::ofstream ofs( filenameDarcy+".txt", std::ofstream::out | std::ofstream::trunc);
+        const auto prec = ofs.precision();
+        ofs << "Velocity statistics (Darcy):" << std::endl
+                  << std::setprecision(std::numeric_limits<double>::digits10 + 1)
+                  << "  min: " << min << std::endl
+                  << "  max: " << max << std::endl
+                  << "  sum: " << sum << std::endl;
+        ofs.precision( prec );
+        ofs.close();
+      }
     }
 
     //TODO make freeflow
@@ -268,13 +281,25 @@ int main(int argc, char** argv) try
                                                                        *couplingManager,
                                                                        *stokesProblem,
                                                                        sol[stokesFaceIdx] );
-      const int prec = std::cout.precision();
-      std::cout << "Velocity statistics:" << std::endl
+      const auto prec = std::cout.precision();
+      std::cout << "Velocity statistics (free flow):" << std::endl
                 << std::setprecision(std::numeric_limits<double>::digits10 + 1)
                 << "  min: " << min << std::endl
                 << "  max: " << max << std::endl
                 << "  sum: " << sum << std::endl;
       std::cout.precision( prec );
+      {
+        const std::string filenameFlow="free-flow-statistics.txt";
+        std::ofstream ofs( filenameFlow+".txt", std::ofstream::out | std::ofstream::trunc);
+        const auto prec = ofs.precision();
+        ofs << "Velocity statistics (free flow):" << std::endl
+            << std::setprecision(std::numeric_limits<double>::digits10 + 1)
+            << "  min: " << min << std::endl
+            << "  max: " << max << std::endl
+            << "  sum: " << sum << std::endl;
+        ofs.precision( prec );
+        ofs.close();
+      }
     }
 
     ////////////////////////////////////////////////////////////
-- 
GitLab