24#ifndef DUMUX_PLOT_FLUID_MATRIX_LAW_HH
25#define DUMUX_PLOT_FLUID_MATRIX_LAW_HH
34template<
class Scalar>
class GnuplotInterface;
41template<
class Scalar,
class MaterialLaw>
44 using MaterialLawParams =
typename MaterialLaw::Params;
62 const MaterialLawParams ¶ms,
63 Scalar lowerSat = 0.0,
64 Scalar upperSat = 1.0,
65 std::string curveTitle =
"")
67 addpcgw(gnuplot, params, lowerSat, upperSat, curveTitle);
68 addpcnw(gnuplot, params, lowerSat, upperSat, curveTitle);
69 addpcgn(gnuplot, params, lowerSat, upperSat, curveTitle);
82 const MaterialLawParams ¶ms,
83 Scalar lowerSat = 0.0,
84 Scalar upperSat = 1.0,
85 std::string curveTitle =
"")
87 std::vector<Scalar> sw;
88 std::vector<Scalar> pc;
89 Scalar satInterval = upperSat - lowerSat;
91 Scalar pcMax = -1e100;
93 Scalar swTemp, pcTemp = 0.0;
94 for (
int i = 0; i <= numIntervals_; i++)
96 swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
97 pcTemp = MaterialLaw::pcgw(params, swTemp);
100 if (checkValues_(swTemp, pcTemp))
102 sw.push_back(swTemp);
103 pc.push_back(pcTemp);
104 pcMin = min(pcMin, pcTemp);
105 pcMax = max(pcMax, pcTemp);
109 gnuplot.
setXlabel(
"wetting phase saturation [-]");
110 gnuplot.
setYlabel(
"capillary pressure [Pa]");
124 const MaterialLawParams ¶ms,
125 Scalar lowerSat = 0.0,
126 Scalar upperSat = 1.0,
127 std::string curveTitle =
"")
129 std::vector<Scalar> sw;
130 std::vector<Scalar> pc;
131 Scalar satInterval = upperSat - lowerSat;
133 Scalar pcMax = -1e100;
135 Scalar swTemp, pcTemp = 0.0;
136 for (
int i = 0; i <= numIntervals_; i++)
138 swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
139 pcTemp = MaterialLaw::pcnw(params, swTemp);
142 if (checkValues_(swTemp, pcTemp))
144 sw.push_back(swTemp);
145 pc.push_back(pcTemp);
146 pcMin = min(pcMin, pcTemp);
147 pcMax = max(pcMax, pcTemp);
151 gnuplot.
setXlabel(
"wetting phase saturation [-]");
152 gnuplot.
setYlabel(
"capillary pressure [Pa]");
166 const MaterialLawParams ¶ms,
167 Scalar lowerSat = 0.0,
168 Scalar upperSat = 1.0,
169 std::string curveTitle =
"")
171 std::vector<Scalar> st;
172 std::vector<Scalar> pc;
173 Scalar satInterval = upperSat - lowerSat;
175 Scalar pcMax = -1e100;
177 Scalar stTemp, pcTemp = 0.0;
178 for (
int i = 0; i <= numIntervals_; i++)
180 stTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
181 pcTemp = MaterialLaw::pcgn(params, stTemp);
184 if (checkValues_(stTemp, pcTemp))
186 st.push_back(stTemp);
187 pc.push_back(pcTemp);
188 pcMin = min(pcMin, pcTemp);
189 pcMax = max(pcMax, pcTemp);
193 gnuplot.
setXlabel(
"wetting phase saturation [-]");
194 gnuplot.
setYlabel(
"capillary pressure [Pa]");
209 const MaterialLawParams ¶ms,
210 Scalar lowerSat = 0.0,
211 Scalar upperSat = 1.0,
212 std::string curveTitle =
"")
214 std::vector<Scalar> sw(numIntervals_ + 1);
215 std::vector<Scalar> krw(numIntervals_ + 1);
216 std::vector<Scalar> krn(numIntervals_ + 1);
217 std::vector<Scalar> krg(numIntervals_ + 1);
218 Scalar satInterval = upperSat - lowerSat;
219 Scalar krMin = 1e100;
220 Scalar krMax = -1e100;
222 Scalar swTemp, krwTemp, krnTemp, krgTemp = 0.0;
223 for (
int i = 0; i <= numIntervals_; i++)
225 swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
226 krwTemp = MaterialLaw::krw(params, swTemp, 0.0);
227 krnTemp = MaterialLaw::krn(params, swTemp, 1.0 - swTemp);
228 krgTemp = MaterialLaw::krg(params, swTemp, 0.0);
231 if (checkValues_(swTemp, krwTemp)
232 && checkValues_(swTemp, krnTemp)
233 && checkValues_(swTemp, krgTemp))
235 sw.push_back(swTemp);
236 krw.push_back(krwTemp);
237 krn.push_back(krnTemp);
238 krg.push_back(krgTemp);
239 krMin = min({krMin, krwTemp, krnTemp, krgTemp});
240 krMax = max({krMax, krwTemp, krnTemp, krgTemp});
244 gnuplot.
setXlabel(
"wetting phase saturation [-]");
245 gnuplot.
setYlabel(
"relative permeability [-]");
261 const MaterialLawParams ¶ms,
262 Scalar lowerSat = 0.0,
263 Scalar upperSat = 1.0,
264 std::string curveTitle =
"")
266 std::vector<Scalar> sn(numIntervals_ + 1);
267 std::vector<Scalar> alpha(numIntervals_ + 1);
268 Scalar satInterval = upperSat - lowerSat;
269 Scalar alphaMin = -2;
272 Scalar snTemp, alphaTemp = 0.0;
273 for (
int i = 0; i <= numIntervals_; i++)
275 snTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
276 alphaTemp = MaterialLaw::pcAlpha(params, snTemp);
279 if (checkValues_(snTemp, alphaTemp))
281 sn.push_back(snTemp);
282 alpha.push_back(alphaTemp);
283 alphaMin = min(alphaMin, alphaTemp);
284 alphaMax = max(alphaMax, alphaTemp);
288 gnuplot.
setXlabel(
"non-wetting phase saturation [-]");
289 gnuplot.
setYlabel(
"transition function [-]");
300 bool checkValues_(Scalar value1, Scalar value2)
304 return !isnan(value1) && !isinf(value1)
305 && !isnan(value2) && !isinf(value2);
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Interface for passing data sets to a file and plotting them, if gnuplot is installed.
Definition: gnuplotinterface.hh:57
void setXlabel(const std::string &label)
Sets the label for the x-axis.
Definition: gnuplotinterface.hh:279
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
void setYlabel(const std::string &label)
Sets the label for the y-axis.
Definition: gnuplotinterface.hh:289
void addPcAlpha(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveTitle="")
Plot the transition (2P/3P) function.
Definition: plotmateriallaw3p.hh:260
void addpc(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveTitle="")
Plot the capillary pressure-saturation curve for all phases.
Definition: plotmateriallaw3p.hh:61
void addpcgw(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveTitle="")
Plot the capillary pressure-saturation curve for the water-gas interphase.
Definition: plotmateriallaw3p.hh:81
void addpcgn(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveTitle="")
Plot the capillary pressure-saturation curve for the gas-NAPL interface.
Definition: plotmateriallaw3p.hh:165
PlotMaterialLaw(bool interaction=true)
Constructor.
Definition: plotmateriallaw3p.hh:48
void addkr(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveTitle="")
Plot the relative permeabilities.
Definition: plotmateriallaw3p.hh:208
void addpcnw(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveTitle="")
Plot the capillary pressure-saturation curve for the water-NAPL interface.
Definition: plotmateriallaw3p.hh:123