3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
plotthermalconductivitymodel.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_THERMAL_CONDUCTIVITY_LAW_HH
25#define DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH
26
27#include <string>
28#include <vector>
30
31namespace Dumux {
32
33// forward declaration
34template<class Scalar> class GnuplotInterface;
35
40template<class Scalar, class ThermalConductivityModel, class FS>
42{
43 using FluidSystem = FS;
45
46 // phase indices
47 enum
48 {
49 phase0Idx = FluidSystem::phase0Idx,
50 phase1Idx = FluidSystem::phase1Idx
51 };
52
53public:
63 Scalar pressure = 1e5)
64 : numIntervals_(1000)
65 {
66 FluidState fluidstate;
67 fluidstate.setTemperature(temperature);
68 fluidstate.setPressure(phase0Idx, pressure);
69 fluidstate.setPressure(phase1Idx, pressure);
70 lambdaW_ = FluidSystem::thermalConductivity(fluidstate, phase0Idx);
71 lambdaN_ = FluidSystem::thermalConductivity(fluidstate, phase1Idx);
72 }
73
87 Scalar porosity,
88 Scalar rhoSolid,
89 Scalar lambdaSolid,
90 Scalar lowerSat = 0.0,
91 Scalar upperSat = 1.0,
92 std::string curveName = "lambdaeff",
93 std::string curveOptions = "w l")
94 {
95 std::vector<Scalar> sw(numIntervals_+1);
96 std::vector<Scalar> lambda(numIntervals_+1);
97 Scalar satInterval = upperSat - lowerSat;
98
99 for (int i = 0; i <= numIntervals_; i++)
100 {
101 sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
102 VolumeVariables volVars(sw[i], lambdaN_, lambdaW_, lambdaSolid, porosity, rhoSolid);
103 lambda[i] = ThermalConductivityModel::effectiveThermalConductivity(volVars);
104 }
105
106 gnuplot.addDataSetToPlot(sw, lambda, curveName, curveOptions);
107 }
108
109private:
110
111 class VolumeVariables
112 {
113 public:
114 VolumeVariables(Scalar saturation, Scalar lambdaN, Scalar lambdaW, Scalar lambdaSolid, Scalar porosity, Scalar rhoSolid)
115 : saturation_(saturation)
116 , lambdaN_(lambdaN)
117 , lambdaW_(lambdaW)
118 , lambdaSolid_(lambdaSolid)
119 , porosity_(porosity)
120 , rhoSolid_(rhoSolid)
121 {}
122
123 using FluidSystem = typename PlotThermalConductivityModel::FluidSystem;
124
125 Scalar saturation(const int phaseIdx) const
126 {
127 if (phaseIdx == wettingPhase())
128 return saturation_;
129 else
130 return 1.0 - saturation_;
131 }
132
133 Scalar fluidThermalConductivity(const int phaseIdx) const
134 {
135 if (phaseIdx == wettingPhase())
136 return lambdaW_;
137 else
138 return lambdaN_;
139 }
140
141 int wettingPhase() const
142 { return phase0Idx; }
143
144 Scalar porosity() const
145 { return porosity_; }
146
147 Scalar solidThermalConductivity() const
148 { return lambdaSolid_; }
149
150 Scalar solidDensity() const
151 { return rhoSolid_;}
152
153 private:
154 Scalar saturation_;
155 Scalar lambdaN_;
156 Scalar lambdaW_;
157 Scalar lambdaSolid_;
158 Scalar porosity_;
159 Scalar rhoSolid_;
160 };
161
162 int numIntervals_;
163 Scalar lambdaN_;
164 Scalar lambdaW_;
165};
166
167} // end namespace Dumux
168
169#endif
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string saturation(int phaseIdx) noexcept
I/O name of saturation for multiphase systems.
Definition: name.hh:43
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
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 non-isothermal two-phase fluid-matrix-interaction laws.
Definition: plotthermalconductivitymodel.hh:42
void addlambdaeffcurve(GnuplotInterface< Scalar > &gnuplot, Scalar porosity, Scalar rhoSolid, Scalar lambdaSolid, Scalar lowerSat=0.0, Scalar upperSat=1.0, std::string curveName="lambdaeff", std::string curveOptions="w l")
Add a effective thermal conductivity-saturation curve to the plot.
Definition: plotthermalconductivitymodel.hh:86
PlotThermalConductivityModel(Scalar temperature=283.15, Scalar pressure=1e5)
Constructor.
Definition: plotthermalconductivitymodel.hh:62
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
Definition: compositional.hh:47
void setTemperature(Scalar value)
Set the temperature of all phases.
Definition: compositional.hh:318
void setPressure(int phaseIdx, Scalar value)
Set the fluid pressure of a phase .
Definition: compositional.hh:334