From df0603b534ee1736c16a0c329cc3b13d2051ac79 Mon Sep 17 00:00:00 2001
From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de>
Date: Fri, 14 Oct 2016 10:51:48 +0200
Subject: [PATCH] [plotmateriallaws] Outsource plot command, so that all plot
 options can be defined at a problem-level

---
 dumux/io/gnuplotinterface.hh                  |  23 +-
 dumux/io/ploteffectivediffusivitymodel.hh     |  36 +++
 dumux/io/plotmateriallaw.hh                   | 238 ++++++++++++++++++
 dumux/io/plotthermalconductivitymodel.hh      |  43 +++-
 .../2p/test_thermalconductivityjohansen.input |   2 +-
 .../2p/test_thermalconductivitysomerton.input |   2 +-
 .../2p/thermalconductivityspatialparams.hh    |   7 +-
 .../effectivediffusivityspatialparams.hh      |   5 +-
 .../test_effectivediffusivityconstant.input   |   2 +-
 ...test_effectivediffusivityconstanttau.input |   2 +-
 ..._effectivediffusivitymillingtonquirk.input |   2 +-
 .../2cnistokes2p2cni/2p2cnisubproblem.hh      |   2 +-
 .../2p2c/implicit/waterairspatialparams.hh    |  40 +--
 .../implicit/evaporationatmosphereproblem.hh  |   2 +-
 14 files changed, 377 insertions(+), 29 deletions(-)

diff --git a/dumux/io/gnuplotinterface.hh b/dumux/io/gnuplotinterface.hh
index 8d042f7aad..7e8f4fed09 100644
--- a/dumux/io/gnuplotinterface.hh
+++ b/dumux/io/gnuplotinterface.hh
@@ -42,6 +42,7 @@
 #include <string>
 #include <vector>
 
+#include <dune/common/deprecated.hh>
 #include <dune/common/stdstreams.hh>
 
 namespace Dumux
@@ -144,10 +145,30 @@ public:
     /*!
      * \brief Deletes all plots from a plotting window and resets user-defined options
      */
-    void reset(const bool persist = true)
+    DUNE_DEPRECATED_MSG("reset() is deprecated. Use resetPlot() instead.")
+    void reset()
+    {
+        curveFile_.resize(0);
+        curveOptions_.resize(0);
+        curveTitle_.resize(0);
+        plotOptions_ = "";
+    }
+
+    /*!
+     * \brief Restarts gnuplot
+     */
+    void resetAll(const bool persist = true)
     {
         close();
         open(persist);
+        resetPlot();
+    }
+
+    /*!
+     * \brief Deletes all plots from a plotting window and resets user-defined options
+     */
+    void resetPlot()
+    {
         curveFile_.resize(0);
         curveOptions_.resize(0);
         curveTitle_.resize(0);
diff --git a/dumux/io/ploteffectivediffusivitymodel.hh b/dumux/io/ploteffectivediffusivitymodel.hh
index d150b10c94..0ec3c5a082 100644
--- a/dumux/io/ploteffectivediffusivitymodel.hh
+++ b/dumux/io/ploteffectivediffusivitymodel.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
 #define DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
 
+#include <dune/common/deprecated.hh>
+
 #include <dumux/common/basicproperties.hh>
 #include <dumux/io/gnuplotinterface.hh>
 
@@ -53,6 +55,39 @@ public:
         gnuplot_.setInteraction(interaction);
     }
 
+    /*!
+     * \brief Add a effective diffusion factor-saturation data set to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerSat Minimum x-value for data set
+     * \param upperSat Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void adddeffcurve(GnuplotInterface<Scalar> &gnuplot,
+                      Scalar porosity,
+                      Scalar lowerSat = 0.0,
+                      Scalar upperSat = 1.0,
+                      std::string curveName = "deff",
+                      std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw(numIntervals_+1);
+        std::vector<Scalar> deff(numIntervals_+1);
+        Scalar satInterval = upperSat - lowerSat;
+
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
+            deff[i] = EffectiveDiffusivityModel::effectiveDiffusivity(porosity, sw[i],
+                                                                      1.0 /*Diffusion Coefficient*/);
+        }
+
+        gnuplot.setXlabel("phase saturation [-]");
+        gnuplot.setYlabel("effective diffusion/molecular diffusion [-]");
+        gnuplot.addDataSetToPlot(sw, deff, curveName, curveOptions);
+    }
+
     /*!
      * \brief Plot the effective diffusion factor-saturation curve
      *
@@ -61,6 +96,7 @@ public:
      * \param upperSat Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotdeff() is deprecated. Use adddeffcurve() instead.")
     void plotdeff(Scalar porosity,
                   Scalar lowerSat = 0.0,
                   Scalar upperSat = 1.0,
diff --git a/dumux/io/plotmateriallaw.hh b/dumux/io/plotmateriallaw.hh
index f90b81c751..78e5b81322 100644
--- a/dumux/io/plotmateriallaw.hh
+++ b/dumux/io/plotmateriallaw.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_PLOT_FLUID_MATRIX_LAW_HH
 #define DUMUX_PLOT_FLUID_MATRIX_LAW_HH
 
+#include <dune/common/deprecated.hh>
+
 #include <dumux/common/basicproperties.hh>
 #include <dumux/io/gnuplotinterface.hh>
 
@@ -60,6 +62,38 @@ public:
         gnuplotkrdsw_.setInteraction(interaction);
     }
 
+    /*!
+     * \brief Add a capillary pressure-saturation data set to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerSat Minimum x-value for data set
+     * \param upperSat Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void addpcswcurve(GnuplotInterface<Scalar> &gnuplot,
+                      const MaterialLawParams &params,
+                      Scalar lowerSat = 0.0,
+                      Scalar upperSat = 1.0,
+                      std::string curveName = "pc-Sw",
+                      std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw(numIntervals_+1);
+        std::vector<Scalar> pc(numIntervals_+1);
+        Scalar satInterval = upperSat - lowerSat;
+
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
+            pc[i] = MaterialLaw::pc(params, sw[i]);
+        }
+
+        gnuplot.setXlabel("wetting phase saturation [-]");
+        gnuplot.setYlabel("capillary pressure [Pa]");
+        gnuplot.addDataSetToPlot(sw, pc, curveName, curveOptions);
+    }
+
     /*!
      * \brief Plot the capillary pressure-saturation curve
      *
@@ -68,6 +102,7 @@ public:
      * \param upperSat Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotpcsw() is deprecated. Use addpcswcurve() instead.")
     void plotpcsw(const MaterialLawParams &params,
                   Scalar lowerSat = 0.0,
                   Scalar upperSat = 1.0,
@@ -108,6 +143,44 @@ public:
         gnuplotpcsw_.plot("pc-Sw");
     }
 
+    /*!
+     * \brief Add a saturation-capillary pressure data set to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerpc Minimum x-value for data set
+     * \param upperpc Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void addswpccurve(GnuplotInterface<Scalar> &gnuplot,
+                      const MaterialLawParams &params,
+                      Scalar lowerpc = 0.0,
+                      Scalar upperpc = 5000.0,
+                      std::string curveName = "Sw-pc",
+                      std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw;
+        std::vector<Scalar> pc;
+        Scalar pcInterval = upperpc - lowerpc;
+
+        Scalar pcTemp, swTemp = 0.0;
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_);
+            swTemp = MaterialLaw::sw(params, pcTemp);
+            if (checkValues_(pcTemp, swTemp))
+            {
+                pc.push_back(pcTemp);
+                sw.push_back(swTemp);
+            }
+        }
+
+        gnuplot.setXlabel("capillary pressure [Pa]");
+        gnuplot.setYlabel("wetting phase saturation [-]");
+        gnuplot.addDataSetToPlot(pc, sw, curveName, curveOptions);
+    }
+
     /*!
      * \brief Plot the saturation-capillary pressure curve
      *
@@ -116,6 +189,7 @@ public:
      * \param upperpc Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotswpc() is deprecated. Use addswpccurve() instead.")
     void plotswpc(const MaterialLawParams &params,
                   Scalar lowerpc = 0.0,
                   Scalar upperpc = 5000.0,
@@ -149,6 +223,44 @@ public:
         gnuplotswpc_.plot("sw-pc");
     }
 
+    /*!
+     * \brief Add a capillary pressure-saturation gradient data set to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerSat Minimum x-value for data set
+     * \param upperSat Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void adddpcdswcurve(GnuplotInterface<Scalar> &gnuplot,
+                        const MaterialLawParams &params,
+                        Scalar lowerSat = 0.0,
+                        Scalar upperSat = 1.0,
+                        std::string curveName = "dpcdsw",
+                        std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw;
+        std::vector<Scalar> dpcdsw;
+        Scalar satInterval = upperSat - lowerSat;
+
+        Scalar swTemp, dpcdswTemp = 0.0;
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
+            dpcdswTemp = MaterialLaw::dpc_dsw(params, swTemp);
+            if (checkValues_(swTemp, dpcdsw))
+            {
+                sw.push_back(swTemp);
+                dpcdsw.push_back(dpcdswTemp);
+            }
+        }
+
+        gnuplot.setXlabel("wetting phase saturation [-]");
+        gnuplot.setYlabel("gradient of the pc-Sw curve [Pa]");
+        gnuplot.addDataSetToPlot(sw, dpcdsw, curveName, curveOptions);
+    }
+
     /*!
      * \brief Plot the gradient of the capillary pressure-saturation curve
      *
@@ -157,6 +269,7 @@ public:
      * \param upperSat Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotdpcdsw() is deprecated. Use adddpcdswcurve() instead.")
     void plotdpcdsw(const MaterialLawParams &params,
                     Scalar lowerSat = 0.0,
                     Scalar upperSat = 1.0,
@@ -190,6 +303,44 @@ public:
         gnuplotdpcdsw_.plot("dpcdsw");
     }
 
+    /*!
+     * \brief Add a saturation-capillary pressure gradient data set to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerpc Minimum x-value for data set
+     * \param upperpc Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void adddswdpccurve(GnuplotInterface<Scalar> &gnuplot,
+                        const MaterialLawParams &params,
+                        Scalar lowerpc = 0.0,
+                        Scalar upperpc = 5000.0,
+                        std::string curveName = "dswdpc",
+                        std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> pc;
+        std::vector<Scalar> dswdpc;
+        Scalar pcInterval = upperpc - lowerpc;
+
+        Scalar dswdpcTemp, pcTemp = 0.0;
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_);
+            dswdpcTemp = MaterialLaw::dsw_dpc(params, pcTemp);
+            if (checkValues_(pcTemp, dswdpcTemp))
+            {
+                pc.push_back(pcTemp);
+                dswdpc.push_back(dswdpcTemp);
+            }
+        }
+
+        gnuplot.setXlabel("capillary pressure [Pa]");
+        gnuplot.setYlabel("gradient of the Sw-pc curve [1/Pa]");
+        gnuplot.addDataSetToPlot(pc, dswdpc, curveName, curveOptions);
+    }
+
     /*!
      * \brief Plot the gradient of the saturation-capillary pressure curve
      *
@@ -198,6 +349,7 @@ public:
      * \param upperpc Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotdswdpc() is deprecated. Use adddswdpccurve() instead.")
     void plotdswdpc(const MaterialLawParams &params,
                     Scalar lowerpc = 0.0,
                     Scalar upperpc = 5000.0,
@@ -231,6 +383,48 @@ public:
         gnuplotdswdpc_.plot("dswdpc");
     }
 
+    /*!
+     * \brief Add relative permeabilities data sets to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerSat Minimum x-value for data set
+     * \param upperSat Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void addkrcurves(GnuplotInterface<Scalar> &gnuplot,
+                      const MaterialLawParams &params,
+                      Scalar lowerSat = 0.0,
+                      Scalar upperSat = 1.0,
+                      std::string curveName = "kr",
+                      std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw;
+        std::vector<Scalar> krw;
+        std::vector<Scalar> krn;
+        Scalar satInterval = upperSat - lowerSat;
+
+        Scalar swTemp, krwTemp, krnTemp = 0.0;
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
+            krwTemp = MaterialLaw::krw(params, swTemp);
+            krnTemp = MaterialLaw::krn(params, swTemp);
+            if (checkValues_(swTemp, krwTemp) && checkValues_(swTemp, krnTemp))
+            {
+                sw.push_back(swTemp);
+                krw.push_back(krwTemp);
+                krn.push_back(krnTemp);
+            }
+        }
+
+        gnuplot.setXlabel("wetting phase saturation [-]");
+        gnuplot.setYlabel("relative permeability [-]");
+        gnuplot.addDataSetToPlot(sw, krw, curveName + "_krw", curveOptions);
+        gnuplot.addDataSetToPlot(sw, krn, curveName + "_krw", curveOptions);
+    }
+
     /*!
      * \brief Plot the relative permeabilities
      *
@@ -239,6 +433,7 @@ public:
      * \param upperSat Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotkr() is deprecated. Use addkrcurves() instead.")
     void plotkr(const MaterialLawParams &params,
                 Scalar lowerSat = 0.0,
                 Scalar upperSat = 1.0,
@@ -276,6 +471,48 @@ public:
         gnuplotkr_.plot("kr");
     }
 
+    /*!
+     * \brief Add relative permeabilities gradients data sets to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerSat Minimum x-value for data set
+     * \param upperSat Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void adddkrdswcurves(GnuplotInterface<Scalar> &gnuplot,
+                         const MaterialLawParams &params,
+                         Scalar lowerSat = 0.0,
+                         Scalar upperSat = 1.0,
+                         std::string curveName = "dkrndsw",
+                         std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw;
+        std::vector<Scalar> dkrw_dsw;
+        std::vector<Scalar> dkrn_dsw;
+        Scalar satInterval = upperSat - lowerSat;
+
+        Scalar swTemp, dkrwdswTemp, dkrndswTemp = 0.0;
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
+            dkrwdswTemp = MaterialLaw::dkrw_dsw(params, swTemp);
+            dkrndswTemp = MaterialLaw::dkrn_dsw(params, swTemp);
+            if (checkValues_(swTemp, dkrwdswTemp) && checkValues_(swTemp, dkrndswTemp))
+            {
+                sw.push_back(swTemp);
+                dkrw_dsw.push_back(dkrwdswTemp);
+                dkrn_dsw.push_back(dkrndswTemp);
+            }
+        }
+
+        gnuplot.setXlabel("wetting phase saturation [-]");
+        gnuplot.setYlabel("gradient of the kr-Sw function [-]");
+        gnuplot.addDataSetToPlot(sw, dkrw_dsw, curveName + "_dkrw_dsw", curveOptions);
+        gnuplot.addDataSetToPlot(sw, dkrn_dsw, curveName + "_dkrn_dsw", curveOptions);
+    }
+
     /*!
      * \brief Plot the gradient of the relative permeabilities
      *
@@ -284,6 +521,7 @@ public:
      * \param upperSat Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotdkrdsw() is deprecated. Use adddkrdswcurves() instead.")
     void plotdkrdsw(const MaterialLawParams &params,
                     Scalar lowerSat = 0.0,
                     Scalar upperSat = 1.0,
diff --git a/dumux/io/plotthermalconductivitymodel.hh b/dumux/io/plotthermalconductivitymodel.hh
index 42851c23b8..b608716a05 100644
--- a/dumux/io/plotthermalconductivitymodel.hh
+++ b/dumux/io/plotthermalconductivitymodel.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH
 #define DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH
 
+#include <dune/common/deprecated.hh>
+
 #include <dumux/common/basicproperties.hh>
 #include <dumux/io/gnuplotinterface.hh>
 #include <dumux/material/fluidstates/compositional.hh>
@@ -68,7 +70,9 @@ public:
      * \param pressure reference pressure in \f$\mathrm{[Pa]}\f$
      * \param interaction Specifies whether a live output via a gnuplot window is wanted
      */
-    PlotThermalConductivityModel(Scalar temperature, Scalar pressure, bool interaction = true)
+    PlotThermalConductivityModel(Scalar temperature = 283.15,
+                                 Scalar pressure = 1e5,
+                                 bool interaction = true)
     : numIntervals_(1000)
     {
         FluidState fluidstate;
@@ -80,6 +84,42 @@ public:
         gnuplot_.setInteraction(interaction);
     }
 
+    /*!
+     * \brief Add a effective thermal conductivity-saturation curve to the plot
+     *
+     * \param gnuplot The gnuplot interface
+     * \param params The material law parameters
+     * \param lowerSat Minimum x-value for data set
+     * \param upperSat Maximum x-value for data set
+     * \param curveName Name of the data set
+     * \param curveOptions Plotting options associated with that data set
+     */
+    void addlambdaeffcurve(GnuplotInterface<Scalar> &gnuplot,
+                           Scalar porosity,
+                           Scalar rhoSolid,
+                           Scalar lambdaSolid,
+                           Scalar lowerSat = 0.0,
+                           Scalar upperSat = 1.0,
+                           std::string curveName = "lambdaeff",
+                           std::string curveOptions = "w l")
+    {
+        std::vector<Scalar> sw(numIntervals_+1);
+        std::vector<Scalar> lambda(numIntervals_+1);
+        Scalar satInterval = upperSat - lowerSat;
+
+        for (int i = 0; i <= numIntervals_; i++)
+        {
+            sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
+            lambda[i] = ThermalConductivityModel::effectiveThermalConductivity(sw[i], lambdaW_,
+                                                                               lambdaN_, lambdaSolid,
+                                                                               porosity, rhoSolid);
+        }
+
+        gnuplot.setXlabel("wetting phase saturation [-]");
+        gnuplot.setYlabel("effective thermal conductivity [W/(m K)]");
+        gnuplot.addDataSetToPlot(sw, lambda, curveName, curveOptions);
+    }
+
     /*!
      * \brief Plot the effective thermal conductivity-saturation curve
      *
@@ -90,6 +130,7 @@ public:
      * \param upperSat Maximum x-value
      * \param curveTitle Name of the plotted curve
      */
+    DUNE_DEPRECATED_MSG("plotlambdaeff() is deprecated. Use addlambdaeffcurve() instead.")
     void plotlambdaeff(Scalar porosity,
                        Scalar rhoSolid,
                        Scalar lambdaSolid,
diff --git a/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input b/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input
index c302e503d6..52dcaeb559 100644
--- a/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input
+++ b/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input
@@ -8,4 +8,4 @@ UpperRight = 6 4
 Cells = 48 32
 
 [Conductivity]
-File = johansen
+File = johansen_lambda_eff
diff --git a/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input b/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input
index 8cb19ec9d3..d90b9fd49b 100644
--- a/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input
+++ b/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input
@@ -8,4 +8,4 @@ UpperRight = 6 4
 Cells = 48 32
 
 [Conductivity]
-File = somerton
+File = somerton_lambda_eff
diff --git a/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh b/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh
index 357047a605..8c21280e58 100644
--- a/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh
+++ b/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh
@@ -106,10 +106,11 @@ public:
      */
     void plotMaterialLaw()
     {
-        PlotThermalConductivityModel<TypeTag> plotThermalConductivityModel_(293.15, 1e5, false);
+        GnuplotInterface<Scalar> gnuplot(false);
+        PlotThermalConductivityModel<TypeTag> plotThermalConductivityModel_(293.15, 1e5);
         std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Conductivity, File);
-        plotThermalConductivityModel_.plotlambdaeff(porosity_, rhoSolid_, lambdaSolid_,
-                                                    0.0, 1.0, fileName);
+        plotThermalConductivityModel_.addlambdaeffcurve(gnuplot, porosity_, rhoSolid_, lambdaSolid_,
+                                                        0.0, 1.0, fileName);
     }
 
     /*!
diff --git a/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh b/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh
index 72f2a5b311..be57d35b29 100644
--- a/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh
+++ b/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh
@@ -106,9 +106,10 @@ public:
      */
     void plotMaterialLaw()
     {
-        PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel(false);
+        GnuplotInterface<Scalar> gnuplot(false);
+        PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel;
         std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Diffusivity, File);
-        plotEffectiveDiffusivityModel.plotdeff(porosity_, 0.0, 1.0, fileName);
+        plotEffectiveDiffusivityModel.adddeffcurve(gnuplot, porosity_, 0.0, 1.0, fileName);
     }
 
     /*!
diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input
index 92d3655a04..5ace3f3b57 100644
--- a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input
+++ b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input
@@ -7,7 +7,7 @@ UpperRight = 6 4
 Cells = 48 32
 
 [Diffusivity]
-File = constant
+File = constant_d_eff
 
 []
 TauTortuosity = 0.3
diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input
index 99c4467422..f759f333bb 100644
--- a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input
+++ b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input
@@ -10,4 +10,4 @@ UpperRight = 6 4
 Cells = 48 32
 
 [Diffusivity]
-File = constanttau
+File = constanttau_d_eff
diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input b/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input
index 4d23f437de..4e445a6fe4 100644
--- a/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input
+++ b/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input
@@ -8,4 +8,4 @@ UpperRight = 6 4
 Cells = 48 32
 
 [Diffusivity]
-File = millingtonquirk
+File = millingtonquirk_d_eff
diff --git a/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh b/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh
index c0e5d186e2..7ed89c2aa5 100644
--- a/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh
+++ b/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh
@@ -387,7 +387,7 @@ public:
                             << std::endl;
 
                     evaporationFile << time/86400.0 << " " << storageChange[contiWEqIdx]*86400.0 << std::endl;
-                    gnuplot_.reset();
+                    gnuplot_.resetPlot();
                     gnuplot_.setInteraction(liveEvaporationRates_);
                     gnuplot_.setXRange(0.0, time/86400.0);
                     gnuplot_.setYRange(0.0, 12.0);
diff --git a/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh b/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh
index 6b88e122db..68d348e991 100644
--- a/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh
+++ b/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh
@@ -126,21 +126,31 @@ public:
      */
     void plotMaterialLaw()
     {
-        PlotMaterialLaw<TypeTag> plotMaterialLaw(plotFluidMatrixInteractions_);
-        PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel(plotFluidMatrixInteractions_);
-        PlotThermalConductivityModel<TypeTag> plotThermalConductivityModel(283.15/*temperature*/, 1e5/*pressure*/,
-                                                                           plotFluidMatrixInteractions_);
-
-        plotMaterialLaw.plotpcsw(fineMaterialParams_, 0.2, 1.0, "fine");
-        plotMaterialLaw.plotpcsw(coarseMaterialParams_, 0.2, 1.0, "coarse");
-        plotMaterialLaw.plotkr(fineMaterialParams_, 0.2, 1.0, "fine");
-        plotMaterialLaw.plotkr(coarseMaterialParams_, 0.2, 1.0, "coarse");
-
-        plotEffectiveDiffusivityModel.plotdeff(finePorosity_, 0.0, 1.0, "fine");
-        plotEffectiveDiffusivityModel.plotdeff(coarsePorosity_, 0.0, 1.0, "coarse");
-
-        plotThermalConductivityModel.plotlambdaeff(finePorosity_, 2700.0, lambdaSolid_, 0.0, 1.0, "fine");
-        plotThermalConductivityModel.plotlambdaeff(coarsePorosity_, 2700.0, lambdaSolid_, 0.0, 1.0, "coarse");
+        PlotMaterialLaw<TypeTag> plotMaterialLaw;
+        GnuplotInterface<Scalar> gnuplot(plotFluidMatrixInteractions_);
+        gnuplot.setInteraction(plotFluidMatrixInteractions_);
+        plotMaterialLaw.addpcswcurve(gnuplot, fineMaterialParams_, 0.2, 1.0, "fine", "w lp");
+        plotMaterialLaw.addpcswcurve(gnuplot, coarseMaterialParams_, 0.2, 1.0, "coarse", "w l");
+        gnuplot.setOption("set xrange [0:1]");
+        gnuplot.setOption("set label \"residual\\nsaturation\" at 0.1,100000 center");
+        gnuplot.plot("pc-Sw");
+
+        gnuplot.resetAll();
+        plotMaterialLaw.addkrcurves(gnuplot, fineMaterialParams_, 0.2, 1.0, "fine");
+        plotMaterialLaw.addkrcurves(gnuplot, coarseMaterialParams_, 0.2, 1.0, "coarse");
+        gnuplot.plot("kr");
+
+        gnuplot.resetAll();
+        PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel;
+        plotEffectiveDiffusivityModel.adddeffcurve(gnuplot, finePorosity_, 0.0, 1.0, "fine");
+        plotEffectiveDiffusivityModel.adddeffcurve(gnuplot, coarsePorosity_, 0.0, 1.0, "coarse");
+        gnuplot.plot("deff");
+
+        gnuplot.resetAll();
+        PlotThermalConductivityModel<TypeTag> plotThermalConductivityModel;
+        plotThermalConductivityModel.addlambdaeffcurve(gnuplot, finePorosity_, 2700.0, lambdaSolid_, 0.0, 1.0, "fine");
+        plotThermalConductivityModel.addlambdaeffcurve(gnuplot, coarsePorosity_, 2700.0, lambdaSolid_, 0.0, 1.0, "coarse");
+        gnuplot.plot("lambdaeff");
     }
 
     /*!
diff --git a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh
index 6c50789b12..2c682e3b2d 100644
--- a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh
+++ b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh
@@ -345,8 +345,8 @@ public:
         }
 
         // use gnuplot for plotting the line data
+        gnuplot_.resetPlot();
         gnuplot_.setInteraction(true);
-        gnuplot_.reset();
         gnuplot_.setXlabel("xN2w [-]");
         gnuplot_.setYlabel("y [m]");
         std::ostringstream stream;
-- 
GitLab