3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
ploteffectivediffusivitymodel.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
25#define DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
26
27#include <string>
28#include <vector>
29
30namespace Dumux {
31
32// forward declaration
33template<class Scalar> class GnuplotInterface;
34
39template<class Scalar, class EffectiveDiffusivityModel>
41{
42public:
45 : numIntervals_(1000)
46 { }
47
60 Scalar porosity,
61 Scalar diffCoeff,
62 Scalar lowerSat = 0.0,
63 Scalar upperSat = 1.0,
64 std::string curveName = "deff",
65 std::string curveOptions = "w l")
66 {
67 std::vector<Scalar> sw(numIntervals_+1);
68 std::vector<Scalar> deff(numIntervals_+1);
69 Scalar satInterval = upperSat - lowerSat;
70
71 for (int i = 0; i <= numIntervals_; i++)
72 {
73 sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
74 VolumeVariables volVars(sw[i], porosity, diffCoeff);
75 deff[i] = EffectiveDiffusivityModel::effectiveDiffusionCoefficient(volVars, 0, 0, 1);
76 }
77
78 gnuplot.addDataSetToPlot(sw, deff, curveName, curveOptions);
79 }
80
83 Scalar porosity,
84 Scalar diffCoeff) const
85 {
86 VolumeVariables volVars(saturation, porosity, diffCoeff);
87 return EffectiveDiffusivityModel::effectiveDiffusionCoefficient(volVars, 0, 0, 1);
88 }
89
90private:
91
92 class VolumeVariables
93 {
94 public:
95 VolumeVariables(Scalar saturation, Scalar porosity, Scalar diffCoeff)
96 : saturation_(saturation)
97 , porosity_(porosity)
98 , diffCoeff_(diffCoeff)
99 {}
100
101 Scalar saturation(int phaseIdx = 0) const
102 { return saturation_; }
103
104 Scalar porosity() const
105 { return porosity_; }
106
107 Scalar diffusionCoefficient(const int phaseIdx, const int compIdxI, const int compIdxJ) const
108 { return diffCoeff_;}
109
110 private:
111 Scalar saturation_;
112 Scalar porosity_;
113 Scalar diffCoeff_;
114 };
115
116 int numIntervals_;
117};
118
119} // end namespace Dumux
120
121#endif // DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
Definition: adapt.hh:29
std::string saturation(int phaseIdx) noexcept
I/O name of saturation for multiphase systems.
Definition: name.hh:43
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:139
Interface for passing data sets to a file and plotting them, if gnuplot is installed.
Definition: gnuplotinterface.hh:57
void addDataSetToPlot(const std::vector< Scalar > &x, const std::vector< Scalar > &y, const std::string &fileName, const std::string &options="with lines")
Adds a data set and writes a data file.
Definition: gnuplotinterface.hh:242
Interface for plotting the multi-component-matrix-interaction laws.
Definition: ploteffectivediffusivitymodel.hh:41
PlotEffectiveDiffusivityModel()
Constructor.
Definition: ploteffectivediffusivitymodel.hh:44
Scalar getEffectiveDiffusionCoefficient(Scalar saturation, Scalar porosity, Scalar diffCoeff) const
for point check
Definition: ploteffectivediffusivitymodel.hh:82
void adddeffcurve(GnuplotInterface< Scalar > &gnuplot, Scalar porosity, Scalar diffCoeff, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="deff", std::string curveOptions="w l")
Add a effective diffusion factor-saturation data set to the plot.
Definition: ploteffectivediffusivitymodel.hh:59