24#ifndef DUMUX_PLOT_FLUID_MATRIX_LAW_HH
25#define DUMUX_PLOT_FLUID_MATRIX_LAW_HH
34template<
class Scalar>
class GnuplotInterface;
40template<
class Scalar,
class MaterialLaw>
43 using MaterialLawParams =
typename MaterialLaw::Params;
62 const MaterialLawParams ¶ms,
63 Scalar lowerSat = 0.0,
64 Scalar upperSat = 1.0,
65 std::string curveName =
"pc-Sw",
66 std::string curveOptions =
"w l")
68 std::vector<Scalar> sw(numIntervals_+1);
69 std::vector<Scalar> pc(numIntervals_+1);
70 Scalar satInterval = upperSat - lowerSat;
72 for (
int i = 0; i <= numIntervals_; i++)
74 sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
75 pc[i] = MaterialLaw::pc(params, sw[i]);
78 gnuplot.
setXlabel(
"wetting phase saturation [-]");
79 gnuplot.
setYlabel(
"capillary pressure [Pa]");
94 const MaterialLawParams ¶ms,
95 Scalar lowerSat = 0.0,
96 Scalar upperSat = 1.0,
97 std::string curveName =
"log10_pc-Sw.dat",
98 std::string curveOptions =
"w l")
100 std::vector<Scalar> sw(numIntervals_+1);
101 std::vector<Scalar> log10pc(numIntervals_+1);
102 Scalar satInterval = upperSat - lowerSat;
104 for (
int i = 0; i <= numIntervals_; i++)
106 sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
107 const Scalar pc = std::log10(MaterialLaw::pc(params, sw[i]));
108 log10pc[i] = std::isnan(pc) ? 0.0 : pc;
111 gnuplot.
setXlabel(
"wetting phase saturation [-]");
112 gnuplot.
setYlabel(
"log10 of capillary pressure [Pa]");
127 const MaterialLawParams ¶ms,
128 Scalar lowerpc = 0.0,
129 Scalar upperpc = 5000.0,
130 std::string curveName =
"Sw-pc",
131 std::string curveOptions =
"w l")
133 std::vector<Scalar> sw;
134 std::vector<Scalar> pc;
135 Scalar pcInterval = upperpc - lowerpc;
137 Scalar pcTemp, swTemp = 0.0;
138 for (
int i = 0; i <= numIntervals_; i++)
140 pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_);
141 swTemp = MaterialLaw::sw(params, pcTemp);
142 if (checkValues_(pcTemp, swTemp))
144 pc.push_back(pcTemp);
145 sw.push_back(swTemp);
149 gnuplot.
setXlabel(
"capillary pressure [Pa]");
150 gnuplot.
setYlabel(
"wetting phase saturation [-]");
165 const MaterialLawParams ¶ms,
167 Scalar upperpc = 1e9,
168 std::string curveName =
"Sw-pc",
169 std::string curveOptions =
"w l")
171 std::vector<Scalar> sw;
172 std::vector<Scalar> pc;
173 Scalar pcInterval = std::log10(upperpc) - std::log10(lowerpc);
175 Scalar pcTemp, swTemp = 0.0;
176 for (
int i = 0; i <= numIntervals_; i++)
178 pcTemp = std::log10(lowerpc) + pcInterval * Scalar(i) / Scalar(numIntervals_);
179 swTemp = MaterialLaw::sw(params, std::pow(10, pcTemp));
180 pc.push_back(pcTemp);
181 sw.push_back(swTemp);
184 gnuplot.
setXlabel(
"log10 capillary pressure [Pa]");
185 gnuplot.
setYlabel(
"wetting phase saturation [-]");
200 const MaterialLawParams ¶ms,
201 Scalar lowerSat = 0.0,
202 Scalar upperSat = 1.0,
203 std::string curveName =
"dpcdsw",
204 std::string curveOptions =
"w l")
206 std::vector<Scalar> sw;
207 std::vector<Scalar> dpcdsw;
208 Scalar satInterval = upperSat - lowerSat;
210 Scalar swTemp, dpcdswTemp = 0.0;
211 for (
int i = 0; i <= numIntervals_; i++)
213 swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
214 dpcdswTemp = MaterialLaw::dpc_dsw(params, swTemp);
215 if (checkValues_(swTemp, dpcdsw))
217 sw.push_back(swTemp);
218 dpcdsw.push_back(dpcdswTemp);
222 gnuplot.
setXlabel(
"wetting phase saturation [-]");
223 gnuplot.
setYlabel(
"gradient of the pc-Sw curve [Pa]");
238 const MaterialLawParams ¶ms,
239 Scalar lowerpc = 0.0,
240 Scalar upperpc = 5000.0,
241 std::string curveName =
"dswdpc",
242 std::string curveOptions =
"w l")
244 std::vector<Scalar> pc;
245 std::vector<Scalar> dswdpc;
246 Scalar pcInterval = upperpc - lowerpc;
248 Scalar dswdpcTemp, pcTemp = 0.0;
249 for (
int i = 0; i <= numIntervals_; i++)
251 pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_);
252 dswdpcTemp = MaterialLaw::dsw_dpc(params, pcTemp);
253 if (checkValues_(pcTemp, dswdpcTemp))
255 pc.push_back(pcTemp);
256 dswdpc.push_back(dswdpcTemp);
260 gnuplot.
setXlabel(
"capillary pressure [Pa]");
261 gnuplot.
setYlabel(
"gradient of the Sw-pc curve [1/Pa]");
276 const MaterialLawParams ¶ms,
277 Scalar lowerSat = 0.0,
278 Scalar upperSat = 1.0,
279 std::string curveName =
"kr",
280 std::string curveOptions =
"w l")
282 std::vector<Scalar> sw;
283 std::vector<Scalar> krw;
284 std::vector<Scalar> krn;
285 Scalar satInterval = upperSat - lowerSat;
287 Scalar swTemp, krwTemp, krnTemp = 0.0;
288 for (
int i = 0; i <= numIntervals_; i++)
290 swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
291 krwTemp = MaterialLaw::krw(params, swTemp);
292 krnTemp = MaterialLaw::krn(params, swTemp);
293 if (checkValues_(swTemp, krwTemp) && checkValues_(swTemp, krnTemp))
295 sw.push_back(swTemp);
296 krw.push_back(krwTemp);
297 krn.push_back(krnTemp);
301 gnuplot.
setXlabel(
"wetting phase saturation [-]");
302 gnuplot.
setYlabel(
"relative permeability [-]");
318 const MaterialLawParams ¶ms,
319 Scalar lowerSat = 0.0,
320 Scalar upperSat = 1.0,
321 std::string curveName =
"dkrndsw",
322 std::string curveOptions =
"w l")
324 std::vector<Scalar> sw;
325 std::vector<Scalar> dkrw_dsw;
326 std::vector<Scalar> dkrn_dsw;
327 Scalar satInterval = upperSat - lowerSat;
329 Scalar swTemp, dkrwdswTemp, dkrndswTemp = 0.0;
330 for (
int i = 0; i <= numIntervals_; i++)
332 swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
333 dkrwdswTemp = MaterialLaw::dkrw_dsw(params, swTemp);
334 dkrndswTemp = MaterialLaw::dkrn_dsw(params, swTemp);
335 if (checkValues_(swTemp, dkrwdswTemp) && checkValues_(swTemp, dkrndswTemp))
337 sw.push_back(swTemp);
338 dkrw_dsw.push_back(dkrwdswTemp);
339 dkrn_dsw.push_back(dkrndswTemp);
343 gnuplot.
setXlabel(
"wetting phase saturation [-]");
344 gnuplot.
setYlabel(
"gradient of the kr-Sw function [-]");
345 gnuplot.
addDataSetToPlot(sw, dkrw_dsw, curveName +
"_dkrw_dsw", curveOptions);
346 gnuplot.
addDataSetToPlot(sw, dkrn_dsw, curveName +
"_dkrn_dsw", curveOptions);
356 bool checkValues_(Scalar value1, Scalar value2)
360 return !isnan(value1) && !isinf(value1)
361 && !isnan(value2) && !isinf(value2);
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
Interface for plotting the two-phase fluid-matrix-interaction laws.
Definition: plotmateriallaw.hh:42
void addLog10PcSwCurve(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="log10_pc-Sw.dat", std::string curveOptions="w l")
Add a capillary pressure-saturation data set to the plot.
Definition: plotmateriallaw.hh:93
void addswpccurve(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerpc=0.0, Scalar upperpc=5000.0, std::string curveName="Sw-pc", std::string curveOptions="w l")
Add a saturation-capillary pressure data set to the plot.
Definition: plotmateriallaw.hh:126
PlotMaterialLaw()
Constructor.
Definition: plotmateriallaw.hh:47
void addSwLog10PcCurve(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerpc=1, Scalar upperpc=1e9, std::string curveName="Sw-pc", std::string curveOptions="w l")
Add a saturation-capillary pressure data set to the plot.
Definition: plotmateriallaw.hh:164
void adddswdpccurve(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerpc=0.0, Scalar upperpc=5000.0, std::string curveName="dswdpc", std::string curveOptions="w l")
Add a saturation-capillary pressure gradient data set to the plot.
Definition: plotmateriallaw.hh:237
void adddkrdswcurves(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="dkrndsw", std::string curveOptions="w l")
Add relative permeabilities gradients data sets to the plot.
Definition: plotmateriallaw.hh:317
void adddpcdswcurve(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="dpcdsw", std::string curveOptions="w l")
Add a capillary pressure-saturation gradient data set to the plot.
Definition: plotmateriallaw.hh:199
void addpcswcurve(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="pc-Sw", std::string curveOptions="w l")
Add a capillary pressure-saturation data set to the plot.
Definition: plotmateriallaw.hh:61
void addkrcurves(GnuplotInterface< Scalar > &gnuplot, const MaterialLawParams ¶ms, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="kr", std::string curveOptions="w l")
Add relative permeabilities data sets to the plot.
Definition: plotmateriallaw.hh:275