Line | Branch | Exec | Source |
---|---|---|---|
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 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup InputOutput | ||
10 | * \brief Interface for plotting the multi-component-matrix-interaction laws | ||
11 | */ | ||
12 | #ifndef DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH | ||
13 | #define DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH | ||
14 | |||
15 | #include <string> | ||
16 | #include <vector> | ||
17 | |||
18 | namespace Dumux { | ||
19 | |||
20 | // forward declaration | ||
21 | template<class Scalar> class GnuplotInterface; | ||
22 | |||
23 | /*! | ||
24 | * \ingroup InputOutput | ||
25 | * \brief Interface for plotting the multi-component-matrix-interaction laws | ||
26 | */ | ||
27 | template<class Scalar, class EffectiveDiffusivityModel> | ||
28 | class PlotEffectiveDiffusivityModel | ||
29 | { | ||
30 | public: | ||
31 | //! Constructor | ||
32 | 2 | PlotEffectiveDiffusivityModel() | |
33 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | : numIntervals_(1000) |
34 | { } | ||
35 | |||
36 | /*! | ||
37 | * \brief Add a effective diffusion factor-saturation data set to the plot | ||
38 | * | ||
39 | * \param gnuplot The gnuplot interface | ||
40 | * \param porosity The porosity | ||
41 | * \param diffCoeff The binary diffusion coefficient | ||
42 | * \param lowerSat Minimum x-value for data set | ||
43 | * \param upperSat Maximum x-value for data set | ||
44 | * \param curveName Name of the data set | ||
45 | * \param curveOptions Plotting options associated with that data set | ||
46 | */ | ||
47 | 4 | void adddeffcurve(GnuplotInterface<Scalar> &gnuplot, | |
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 | 8 | std::vector<Scalar> sw(numIntervals_+1); | |
56 |
4/12✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
16 | std::vector<Scalar> deff(numIntervals_+1); |
57 | 4 | Scalar satInterval = upperSat - lowerSat; | |
58 | |||
59 |
2/2✓ Branch 0 taken 2002 times.
✓ Branch 1 taken 2 times.
|
4008 | for (int i = 0; i <= numIntervals_; i++) |
60 | { | ||
61 |
1/2✓ Branch 1 taken 1001 times.
✗ Branch 2 not taken.
|
4004 | sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); |
62 | 8008 | VolumeVariables volVars(sw[i], porosity, diffCoeff); | |
63 | 6006 | deff[i] = EffectiveDiffusivityModel::effectiveDiffusionCoefficient(volVars, 0, 0, 1); | |
64 | } | ||
65 | |||
66 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | gnuplot.addDataSetToPlot(sw, deff, curveName, curveOptions); |
67 | 4 | } | |
68 | |||
69 | //! for point check | ||
70 | ✗ | Scalar getEffectiveDiffusionCoefficient(Scalar saturation, | |
71 | Scalar porosity, | ||
72 | Scalar diffCoeff) const | ||
73 | { | ||
74 | 4 | VolumeVariables volVars(saturation, porosity, diffCoeff); | |
75 | 2 | return EffectiveDiffusivityModel::effectiveDiffusionCoefficient(volVars, 0, 0, 1); | |
76 | } | ||
77 | |||
78 | private: | ||
79 | |||
80 | class VolumeVariables | ||
81 | { | ||
82 | public: | ||
83 | 2004 | VolumeVariables(Scalar saturation, Scalar porosity, Scalar diffCoeff) | |
84 | : saturation_(saturation) | ||
85 | , porosity_(porosity) | ||
86 |
3/8✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 1001 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
2004 | , 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 | ||
110 |