From dda32e5d682b25a774f81fa72bf174b3e6863652 Mon Sep 17 00:00:00 2001
From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de>
Date: Tue, 14 Nov 2017 08:32:30 +0100
Subject: [PATCH] [2pnc] make permeability output problem specific

---
 .../2pnc/implicit/vtkoutputfields.hh              |  6 ------
 .../2pnc/implicit/fuelcellproblem.hh              | 15 +++++++++++++++
 .../2pnc/implicit/test_box2pnc.cc                 |  2 ++
 .../porousmediumflow/2pnc/implicit/test_cc2pnc.cc |  2 ++
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/dumux/porousmediumflow/2pnc/implicit/vtkoutputfields.hh b/dumux/porousmediumflow/2pnc/implicit/vtkoutputfields.hh
index c37b68c46c..3748b9848f 100644
--- a/dumux/porousmediumflow/2pnc/implicit/vtkoutputfields.hh
+++ b/dumux/porousmediumflow/2pnc/implicit/vtkoutputfields.hh
@@ -61,12 +61,6 @@ public:
             vtk.addVolumeVariable([j](const VolumeVariables& v){ return v.molarity(Indices::wPhaseIdx,j); },"m_"+ FluidSystem::phaseName(Indices::wPhaseIdx) + "^" + FluidSystem::componentName(j));
 
         vtk.addVolumeVariable([](const VolumeVariables& v){ return v.priVars().state(); }, "phasePresence");
-
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.permeability()[0][0];},"Kxx");
-        if (dim >= 2)
-            vtk.addVolumeVariable([](const VolumeVariables& v){ return v.permeability()[1][1]; },"Kyy");
-        if (dim >= 3)
-            vtk.addVolumeVariable([](const VolumeVariables& v){ return v.permeability()[2][2]; },"Kzz");
     }
 };
 
diff --git a/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh b/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh
index eb3ed5df47..e854362a31 100644
--- a/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh
+++ b/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh
@@ -166,6 +166,8 @@ public:
         currentDensity_.resize(fvGridGeometry->gridView().size(dofCodim));
         reactionSourceH2O_.resize(fvGridGeometry->gridView().size(dofCodim));
         reactionSourceO2_.resize(fvGridGeometry->gridView().size(dofCodim));
+        Kxx_.resize(fvGridGeometry->gridView().size(dofCodim));
+        Kyy_.resize(fvGridGeometry->gridView().size(dofCodim));
     }
 
     /*!
@@ -284,6 +286,15 @@ public:
         return reactionSourceO2_;
     }
 
+    const std::vector<Scalar>& getKxx()
+    {
+        return Kxx_;
+    }
+
+    const std::vector<Scalar>& getKyy()
+    {
+        return Kyy_;
+    }
 
     void updateVtkOutput(const SolutionVector& curSol)
     {
@@ -320,6 +331,8 @@ public:
                     reactionSourceO2_[dofIdxGlobal] = 0.0;
                     currentDensity_[dofIdxGlobal] = 0.0;
                 }
+                Kxx_[dofIdxGlobal] = volVars.permeability()[0][0];
+                Kyy_[dofIdxGlobal] = volVars.permeability()[1][1];
             }
         }
     }
@@ -367,6 +380,8 @@ private:
     std::vector<double> currentDensity_;
     std::vector<double> reactionSourceH2O_;
     std::vector<double> reactionSourceO2_;
+    std::vector<double> Kxx_;
+    std::vector<double> Kyy_;
 };
 
 } //end namespace Dumux
diff --git a/test/porousmediumflow/2pnc/implicit/test_box2pnc.cc b/test/porousmediumflow/2pnc/implicit/test_box2pnc.cc
index fe2d17a33d..9ed36c7b4c 100644
--- a/test/porousmediumflow/2pnc/implicit/test_box2pnc.cc
+++ b/test/porousmediumflow/2pnc/implicit/test_box2pnc.cc
@@ -144,6 +144,8 @@ int main(int argc, char** argv) try
     vtkWriter.addField(problem->getCurrentDensity(), "currentDensity [A/cm^2]");
     vtkWriter.addField(problem->getReactionSourceH2O(), "reactionSourceH2O [mol/(sm^2)]");
     vtkWriter.addField(problem->getReactionSourceO2(), "reactionSourceO2 [mol/(sm^2)]");
+    vtkWriter.addField(problem->getKxx(), "Kxx");
+    vtkWriter.addField(problem->getKyy(), "Kyy");
     vtkWriter.write(0.0);
 
     // instantiate time loop
diff --git a/test/porousmediumflow/2pnc/implicit/test_cc2pnc.cc b/test/porousmediumflow/2pnc/implicit/test_cc2pnc.cc
index 7ba7e44d6c..a697b4bc31 100644
--- a/test/porousmediumflow/2pnc/implicit/test_cc2pnc.cc
+++ b/test/porousmediumflow/2pnc/implicit/test_cc2pnc.cc
@@ -143,6 +143,8 @@ int main(int argc, char** argv) try
     vtkWriter.addField(problem->getCurrentDensity(), "currentDensity [A/cm^2]");
     vtkWriter.addField(problem->getReactionSourceH2O(), "reactionSourceH2O [mol/(sm^2)]");
     vtkWriter.addField(problem->getReactionSourceO2(), "reactionSourceO2 [mol/(sm^2)]");
+    vtkWriter.addField(problem->getKxx(), "Kxx");
+    vtkWriter.addField(problem->getKyy(), "Kyy");
     vtkWriter.write(0.0);
 
     // instantiate time loop
-- 
GitLab