diff --git a/dumux/io/gnuplotinterface.hh b/dumux/io/gnuplotinterface.hh index 7e8f4fed09e2802544a22c47a02832de3a0c4729..ea23705a49f63f8168d300f5838e7b71ef23431d 100644 --- a/dumux/io/gnuplotinterface.hh +++ b/dumux/io/gnuplotinterface.hh @@ -63,17 +63,16 @@ public: //! \brief The constructor GnuplotInterface(bool persist = true) : - plotStyle_("lines"), pipe_(0), + pipe_(0), openPlotWindow_(true), persist_(persist), + datafileSeparator_(' '), plotStyle_("lines"), curveFile_(0), curveOptions_(0), curveTitle_(0), - interaction_(true), xRangeMin_(1e100), xRangeMax_(-1e100), yRangeMin_(1e100), yRangeMax_(-1e100), xLabel_(""), yLabel_(""), plotOptions_(""), - datafileSeparator_(' '), gnuplotPath_(GNUPLOT_EXECUTABLE) { - open(persist); + open(persist_); } //! \brief The destructor @@ -126,7 +125,7 @@ public: // live plot of the results if gnuplot is installed #ifdef HAVE_GNUPLOT - if (interaction_) + if (openPlotWindow_) executeGnuplot(plot.c_str()); #endif @@ -265,9 +264,10 @@ public: * * \param interaction Open window or not */ + DUNE_DEPRECATED_MSG("setInteraction() is deprecated. Use setOpenPlotWindow() instead.") void setInteraction(bool interaction) { - interaction_ = interaction; + setOpenPlotWindow(interaction); } /*! @@ -324,6 +324,16 @@ public: plotOptions_ += option + "\n"; } + /*! + * \brief Define whether the gnuplot window should be opened + * + * \param openPlotWindow Open gnuplot or not + */ + void setOpenPlotWindow(bool openPlotWindow) + { + openPlotWindow_ = openPlotWindow; + } + /*! * \brief Sets the datafile separator * @@ -360,8 +370,11 @@ private: return stream.str(); } - std::string plotStyle_; std::FILE * pipe_; + bool openPlotWindow_; + bool persist_; + char datafileSeparator_; + std::string plotStyle_; StringVector curveFile_; StringVector curveOptions_; StringVector curveTitle_; @@ -373,7 +386,6 @@ private: std::string xLabel_; std::string yLabel_; std::string plotOptions_; - char datafileSeparator_; std::string gnuplotPath_; }; } // end of namespace diff --git a/dumux/io/ploteffectivediffusivitymodel.hh b/dumux/io/ploteffectivediffusivitymodel.hh index 0ec3c5a08272b10479c97e6371b33a54d903cb8d..d850723b747178197ad6fdcd80a97482d6041f46 100644 --- a/dumux/io/ploteffectivediffusivitymodel.hh +++ b/dumux/io/ploteffectivediffusivitymodel.hh @@ -49,12 +49,18 @@ class PlotEffectiveDiffusivityModel public: //! Constructor - PlotEffectiveDiffusivityModel(bool interaction = true) + DUNE_DEPRECATED_MSG("PlotEffectiveDiffusivityModel(bool) is deprecated. Use PlotEffectiveDiffusivityModel() instead.") + PlotEffectiveDiffusivityModel(bool interaction) : numIntervals_(1000) { gnuplot_.setInteraction(interaction); } + //! Constructor + PlotEffectiveDiffusivityModel() + : numIntervals_(1000) + { } + /*! * \brief Add a effective diffusion factor-saturation data set to the plot * diff --git a/dumux/io/plotmateriallaw.hh b/dumux/io/plotmateriallaw.hh index 78e5b8132239470375a3d47bcfa768a580313346..a94f3814875314dcf84a87a57dd4eeec859a1eef 100644 --- a/dumux/io/plotmateriallaw.hh +++ b/dumux/io/plotmateriallaw.hh @@ -51,7 +51,8 @@ class PlotMaterialLaw public: //! Constructor - PlotMaterialLaw(bool interaction = true) + DUNE_DEPRECATED_MSG("PlotMaterialLaw(bool) is deprecated. Use PlotMaterialLaw() instead.") + PlotMaterialLaw(bool interaction) : numIntervals_(1000) { gnuplotpcsw_.setInteraction(interaction); @@ -62,6 +63,11 @@ public: gnuplotkrdsw_.setInteraction(interaction); } + //! Constructor + PlotMaterialLaw() + : numIntervals_(1000) + { } + /*! * \brief Add a capillary pressure-saturation data set to the plot * diff --git a/dumux/io/plotmateriallaw3p.hh b/dumux/io/plotmateriallaw3p.hh index 2dc8e41eea239b352d2403e33dbc7ceca64ac3aa..444fa69748bd42d5632d9e72e23c2c666bc6a9ec 100644 --- a/dumux/io/plotmateriallaw3p.hh +++ b/dumux/io/plotmateriallaw3p.hh @@ -54,10 +54,10 @@ public: PlotMaterialLaw(bool interaction = true) : numIntervals_(1000) { - gnuplotpc_.setInteraction(interaction); - gnuplotpcAlpha_.setInteraction(interaction); - gnuplotkr_.setInteraction(interaction); - gnuplotkrn_.setInteraction(interaction); + gnuplotpc_.setOpenPlotWindow(interaction); + gnuplotpcAlpha_.setOpenPlotWindow(interaction); + gnuplotkr_.setOpenPlotWindow(interaction); + gnuplotkrn_.setOpenPlotWindow(interaction); } /*! diff --git a/dumux/io/plotthermalconductivitymodel.hh b/dumux/io/plotthermalconductivitymodel.hh index b608716a0505394db7892d3788f21b44cff44949..45d934bbc9903bf8990cd77e539dcbce4d7f5ce6 100644 --- a/dumux/io/plotthermalconductivitymodel.hh +++ b/dumux/io/plotthermalconductivitymodel.hh @@ -70,9 +70,10 @@ 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 = 283.15, - Scalar pressure = 1e5, - bool interaction = true) + DUNE_DEPRECATED_MSG("PlotThermalConductivityModel(Scalar, Scalar, bool) is deprecated. Use PlotThermalConductivityModel(Scalar, Scalar) instead.") + PlotThermalConductivityModel(Scalar temperature, + Scalar pressure, + bool interaction) : numIntervals_(1000) { FluidState fluidstate; @@ -84,6 +85,26 @@ public: gnuplot_.setInteraction(interaction); } + /*! + * \brief Constructor + * + * Initializes the fluid system. + * + * \param temperature temperature in \f$\mathrm{[K]}\f$ + * \param pressure reference pressure in \f$\mathrm{[Pa]}\f$ + */ + PlotThermalConductivityModel(Scalar temperature = 283.15, + Scalar pressure = 1e5) + : numIntervals_(1000) + { + FluidState fluidstate; + fluidstate.setTemperature(temperature); + fluidstate.setPressure(wPhaseIdx, pressure); + fluidstate.setPressure(nPhaseIdx, pressure); + lambdaW_ = FluidSystem::template thermalConductivity<FluidState>(fluidstate, wPhaseIdx); + lambdaN_ = FluidSystem::template thermalConductivity<FluidState>(fluidstate, nPhaseIdx); + } + /*! * \brief Add a effective thermal conductivity-saturation curve to the plot * diff --git a/test/io/gnuplotinterface/test_gnuplotinterface.cc b/test/io/gnuplotinterface/test_gnuplotinterface.cc index 3e6087732c929758cd38e7b8f55ab07f17396b53..7a1d2cdee2d2559757e4f47659853f0fd6e7e617 100644 --- a/test/io/gnuplotinterface/test_gnuplotinterface.cc +++ b/test/io/gnuplotinterface/test_gnuplotinterface.cc @@ -31,6 +31,7 @@ int main() { Dumux::GnuplotInterface<double> gnuplot(false); + gnuplot.setOpenPlotWindow(false); unsigned int numIntervals = 100; std::vector<double> x(101); diff --git a/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh b/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh index 8c21280e58139832ccb371f8ec6e869e3f5dfcb0..90ba3d58d7b711d9935728aaef6433c623e8e953 100644 --- a/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh +++ b/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh @@ -50,6 +50,10 @@ SET_TYPE_PROP(ThermalConductivitySpatialParams, SpatialParams, ThermalConductivi SET_TYPE_PROP(ThermalConductivitySpatialParams, MaterialLaw, EffToAbsLaw<RegularizedBrooksCorey<typename GET_PROP_TYPE(TypeTag, Scalar)> >); + +// Define whether to open a gnuplot window +NEW_PROP_TAG(OutputOpenPlotWindow); +SET_BOOL_PROP(ThermalConductivitySpatialParams, OutputOpenPlotWindow, false); } /*! @@ -106,11 +110,13 @@ public: */ void plotMaterialLaw() { - GnuplotInterface<Scalar> gnuplot(false); + GnuplotInterface<Scalar> gnuplot; + gnuplot.setOpenPlotWindow(GET_PARAM_FROM_GROUP(TypeTag, bool, Output, OpenPlotWindow)); PlotThermalConductivityModel<TypeTag> plotThermalConductivityModel_(293.15, 1e5); std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Conductivity, File); plotThermalConductivityModel_.addlambdaeffcurve(gnuplot, porosity_, rhoSolid_, lambdaSolid_, 0.0, 1.0, fileName); + gnuplot.plot("lambda_eff"); } /*! diff --git a/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh b/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh index be57d35b295325ed190b2aa3fcb418d81673a8d8..038449e6bb5873071e5745c9b9f4f7fb19b76d9f 100644 --- a/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh +++ b/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh @@ -50,6 +50,10 @@ SET_TYPE_PROP(EffectiveDiffusivitySpatialParams, SpatialParams, EffectiveDiffusi SET_TYPE_PROP(EffectiveDiffusivitySpatialParams, MaterialLaw, EffToAbsLaw<RegularizedBrooksCorey<typename GET_PROP_TYPE(TypeTag, Scalar)> >); + +// Define whether to open a gnuplot window +NEW_PROP_TAG(OutputOpenPlotWindow); +SET_BOOL_PROP(EffectiveDiffusivitySpatialParams, OutputOpenPlotWindow, false); } /*! @@ -106,10 +110,12 @@ public: */ void plotMaterialLaw() { - GnuplotInterface<Scalar> gnuplot(false); + GnuplotInterface<Scalar> gnuplot; + gnuplot.setOpenPlotWindow(GET_PARAM_FROM_GROUP(TypeTag, bool, Output, OpenPlotWindow)); PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel; std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Diffusivity, File); plotEffectiveDiffusivityModel.adddeffcurve(gnuplot, porosity_, 0.0, 1.0, fileName); + gnuplot.plot("d_eff"); } /*! diff --git a/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh b/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh index 7ed89c2aa520ffe9dd8d08de2d95893f02a2189e..45d19fe9ea4094622073c2965df3f989015da2db 100644 --- a/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh +++ b/test/multidomain/2cnistokes2p2cni/2p2cnisubproblem.hh @@ -388,7 +388,7 @@ public: evaporationFile << time/86400.0 << " " << storageChange[contiWEqIdx]*86400.0 << std::endl; gnuplot_.resetPlot(); - gnuplot_.setInteraction(liveEvaporationRates_); + gnuplot_.setOpenPlotWindow(liveEvaporationRates_); gnuplot_.setXRange(0.0, time/86400.0); gnuplot_.setYRange(0.0, 12.0); gnuplot_.setXlabel("time [d]"); diff --git a/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh b/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh index 68d348e9919878b05a4762252f1bc8bd92632f1d..30a2442084862e093aaa35e1d0315a9ae758836b 100644 --- a/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh +++ b/test/porousmediumflow/2p2c/implicit/waterairspatialparams.hh @@ -128,7 +128,7 @@ public: { PlotMaterialLaw<TypeTag> plotMaterialLaw; GnuplotInterface<Scalar> gnuplot(plotFluidMatrixInteractions_); - gnuplot.setInteraction(plotFluidMatrixInteractions_); + gnuplot.setOpenPlotWindow(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]"); diff --git a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh index 2c682e3b2d94d6ae0ba8823d29183823aa926039..035541d7931dc26d8054583a4e84c7f611bb4369 100644 --- a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh +++ b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh @@ -346,7 +346,6 @@ public: // use gnuplot for plotting the line data gnuplot_.resetPlot(); - gnuplot_.setInteraction(true); gnuplot_.setXlabel("xN2w [-]"); gnuplot_.setYlabel("y [m]"); std::ostringstream stream;