version 3.10-dev
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// 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_THERMAL_CONDUCTIVITY_LAW_HH
13#define DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH
14
15#include <string>
16#include <vector>
18
19namespace Dumux {
20
21// forward declaration
22template<class Scalar> class GnuplotInterface;
23
28template<class Scalar, class ThermalConductivityModel, class FS>
30{
31 using FluidSystem = FS;
33
34 // phase indices
35 enum
36 {
37 phase0Idx = FluidSystem::phase0Idx,
38 phase1Idx = FluidSystem::phase1Idx
39 };
40
41public:
51 Scalar pressure = 1e5)
52 : numIntervals_(1000)
53 {
54 FluidState fluidstate;
55 fluidstate.setTemperature(temperature);
56 fluidstate.setPressure(phase0Idx, pressure);
57 fluidstate.setPressure(phase1Idx, pressure);
58 lambdaW_ = FluidSystem::thermalConductivity(fluidstate, phase0Idx);
59 lambdaN_ = FluidSystem::thermalConductivity(fluidstate, phase1Idx);
60 }
61
75 Scalar porosity,
76 Scalar rhoSolid,
77 Scalar lambdaSolid,
78 Scalar lowerSat = 0.0,
79 Scalar upperSat = 1.0,
80 std::string curveName = "lambdaeff",
81 std::string curveOptions = "w l")
82 {
83 std::vector<Scalar> sw(numIntervals_+1);
84 std::vector<Scalar> lambda(numIntervals_+1);
85 Scalar satInterval = upperSat - lowerSat;
86
87 for (int i = 0; i <= numIntervals_; i++)
88 {
89 sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
90 VolumeVariables volVars(sw[i], lambdaN_, lambdaW_, lambdaSolid, porosity, rhoSolid);
91 lambda[i] = ThermalConductivityModel::effectiveThermalConductivity(volVars);
92 }
93
94 gnuplot.addDataSetToPlot(sw, lambda, curveName, curveOptions);
95 }
96
97private:
98
99 class VolumeVariables
100 {
101 public:
102 VolumeVariables(Scalar saturation, Scalar lambdaN, Scalar lambdaW, Scalar lambdaSolid, Scalar porosity, Scalar rhoSolid)
103 : saturation_(saturation)
104 , lambdaN_(lambdaN)
105 , lambdaW_(lambdaW)
106 , lambdaSolid_(lambdaSolid)
107 , porosity_(porosity)
108 , rhoSolid_(rhoSolid)
109 {}
110
111 using FluidSystem = typename PlotThermalConductivityModel::FluidSystem;
112
113 Scalar saturation(const int phaseIdx) const
114 {
115 if (phaseIdx == wettingPhase())
116 return saturation_;
117 else
118 return 1.0 - saturation_;
119 }
120
121 Scalar fluidThermalConductivity(const int phaseIdx) const
122 {
123 if (phaseIdx == wettingPhase())
124 return lambdaW_;
125 else
126 return lambdaN_;
127 }
128
129 int wettingPhase() const
130 { return phase0Idx; }
131
132 Scalar porosity() const
133 { return porosity_; }
134
135 Scalar solidThermalConductivity() const
136 { return lambdaSolid_; }
137
138 Scalar solidDensity() const
139 { return rhoSolid_;}
140
141 private:
142 Scalar saturation_;
143 Scalar lambdaN_;
144 Scalar lambdaW_;
145 Scalar lambdaSolid_;
146 Scalar porosity_;
147 Scalar rhoSolid_;
148 };
149
150 int numIntervals_;
151 Scalar lambdaN_;
152 Scalar lambdaW_;
153};
154
155} // end namespace Dumux
156
157#endif
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
Definition: compositional.hh:35
void setTemperature(Scalar value)
Set the temperature of all phases.
Definition: compositional.hh:306
void setPressure(int phaseIdx, Scalar value)
Set the fluid pressure of a phase .
Definition: compositional.hh:322
Interface for passing data sets to a file and plotting them, if gnuplot is installed.
Definition: gnuplotinterface.hh:45
void addDataSetToPlot(const DataX &x, const DataY &y, const std::string &fileName, const std::string &options="with lines")
Adds a data set and writes a data file.
Definition: gnuplotinterface.hh:231
Interface for plotting the non-isothermal two-phase fluid-matrix-interaction laws.
Definition: plotthermalconductivitymodel.hh:30
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:74
PlotThermalConductivityModel(Scalar temperature=283.15, Scalar pressure=1e5)
Constructor.
Definition: plotthermalconductivitymodel.hh:50
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string saturation(int phaseIdx) noexcept
I/O name of saturation for multiphase systems.
Definition: name.hh:31
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:127
Definition: adapt.hh:17