version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
13#define DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH
14
15#include <string>
16#include <vector>
17
18namespace Dumux {
19
20// forward declaration
21template<class Scalar> class GnuplotInterface;
22
27template<class Scalar, class EffectiveDiffusivityModel>
29{
30public:
33 : numIntervals_(1000)
34 { }
35
48 Scalar porosity,
49 Scalar diffCoeff,
50 Scalar lowerSat = 0.0,
51 Scalar upperSat = 1.0,
52 std::string curveName = "deff",
53 std::string curveOptions = "w l")
54 {
55 std::vector<Scalar> sw(numIntervals_+1);
56 std::vector<Scalar> deff(numIntervals_+1);
57 Scalar satInterval = upperSat - lowerSat;
58
59 for (int i = 0; i <= numIntervals_; i++)
60 {
61 sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
62 VolumeVariables volVars(sw[i], porosity, diffCoeff);
63 deff[i] = EffectiveDiffusivityModel::effectiveDiffusionCoefficient(volVars, 0, 0, 1);
64 }
65
66 gnuplot.addDataSetToPlot(sw, deff, curveName, curveOptions);
67 }
68
71 Scalar porosity,
72 Scalar diffCoeff) const
73 {
74 VolumeVariables volVars(saturation, porosity, diffCoeff);
75 return EffectiveDiffusivityModel::effectiveDiffusionCoefficient(volVars, 0, 0, 1);
76 }
77
78private:
79
80 class VolumeVariables
81 {
82 public:
83 VolumeVariables(Scalar saturation, Scalar porosity, Scalar diffCoeff)
84 : saturation_(saturation)
85 , porosity_(porosity)
86 , diffCoeff_(diffCoeff)
87 {}
88
89 Scalar saturation(int phaseIdx = 0) const
90 { return saturation_; }
91
92 Scalar porosity() const
93 { return porosity_; }
94
95 Scalar diffusionCoefficient(const int phaseIdx, const int compIdxI, const int compIdxJ) const
96 { return diffCoeff_;}
97
98 private:
99 Scalar saturation_;
100 Scalar porosity_;
101 Scalar diffCoeff_;
102 };
103
104 int numIntervals_;
105};
106
107} // end namespace Dumux
108
109#endif
Interface for passing data sets to a file and plotting them, if gnuplot is installed.
Definition: gnuplotinterface.hh:45
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:230
Interface for plotting the multi-component-matrix-interaction laws.
Definition: ploteffectivediffusivitymodel.hh:29
PlotEffectiveDiffusivityModel()
Constructor.
Definition: ploteffectivediffusivitymodel.hh:32
Scalar getEffectiveDiffusionCoefficient(Scalar saturation, Scalar porosity, Scalar diffCoeff) const
for point check
Definition: ploteffectivediffusivitymodel.hh:70
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:47
std::string saturation(int phaseIdx) noexcept
I/O name of saturation for multiphase systems.
Definition: name.hh:31
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:127
Definition: adapt.hh:17