plotthermalconductivitymodel.hh 4.61 KB
Newer Older
Thomas Fetzer's avatar
Thomas Fetzer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
 *   See the file COPYING for full copying permissions.                      *
 *                                                                           *
 *   This program is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 *****************************************************************************/
/*!
 * \file
21
 * \ingroup InputOutput
Thomas Fetzer's avatar
Thomas Fetzer committed
22
23
24
25
26
 * \brief Interface for plotting the non-isothermal two-phase fluid-matrix-interaction laws
 */
#ifndef DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH
#define DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH

Timo Koch's avatar
Timo Koch committed
27
28
#include <string>
#include <vector>
29
#include <dumux/material/fluidstates/compositional.hh>
Thomas Fetzer's avatar
Thomas Fetzer committed
30

Timo Koch's avatar
Timo Koch committed
31
32
namespace Dumux {

33
34
// forward declaration
template<class Scalar> class GnuplotInterface;
Thomas Fetzer's avatar
Thomas Fetzer committed
35
36

/*!
37
 * \ingroup InputOutput
Thomas Fetzer's avatar
Thomas Fetzer committed
38
39
 * \brief Interface for plotting the non-isothermal two-phase fluid-matrix-interaction laws
 */
40
template<class Scalar, class ThermalConductivityModel, class FluidSystem>
Thomas Fetzer's avatar
Thomas Fetzer committed
41
42
class PlotThermalConductivityModel
{
43
    using FluidState = CompositionalFluidState<Scalar, FluidSystem>;
Thomas Fetzer's avatar
Thomas Fetzer committed
44
    enum {
45
46
        wPhaseIdx = FluidSystem::wPhaseIdx,
        nPhaseIdx = FluidSystem::nPhaseIdx
Thomas Fetzer's avatar
Thomas Fetzer committed
47
48
49
    };

public:
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    /*!
     * \brief Constructor
     *
     * Initializes the fluid system.
     *
     * \param temperature temperature in \f$\mathrm{[K]}\f$
     * \param pressure reference pressure in \f$\mathrm{[Pa]}\f$
     */
    PlotThermalConductivityModel(Scalar temperature = 283.15,
                                 Scalar pressure = 1e5)
    : numIntervals_(1000)
    {
        FluidState fluidstate;
        fluidstate.setTemperature(temperature);
        fluidstate.setPressure(wPhaseIdx, pressure);
        fluidstate.setPressure(nPhaseIdx, pressure);
66
67
        lambdaW_ = FluidSystem::thermalConductivity(fluidstate, wPhaseIdx);
        lambdaN_ = FluidSystem::thermalConductivity(fluidstate, nPhaseIdx);
68
69
    }

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    /*!
     * \brief Add a effective thermal conductivity-saturation curve to the plot
     *
     * \param gnuplot The gnuplot interface
     * \param params The material law parameters
     * \param lowerSat Minimum x-value for data set
     * \param upperSat Maximum x-value for data set
     * \param curveName Name of the data set
     * \param curveOptions Plotting options associated with that data set
     */
    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")
    {
        std::vector<Scalar> sw(numIntervals_+1);
        std::vector<Scalar> lambda(numIntervals_+1);
        Scalar satInterval = upperSat - lowerSat;

        for (int i = 0; i <= numIntervals_; i++)
        {
            sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
            lambda[i] = ThermalConductivityModel::effectiveThermalConductivity(sw[i], lambdaW_,
                                                                               lambdaN_, lambdaSolid,
                                                                               porosity, rhoSolid);
        }

        gnuplot.setXlabel("wetting phase saturation [-]");
        gnuplot.setYlabel("effective thermal conductivity [W/(m K)]");
        gnuplot.addDataSetToPlot(sw, lambda, curveName, curveOptions);
    }

Thomas Fetzer's avatar
Thomas Fetzer committed
106
107
108
109
110
private:
    int numIntervals_;
    Scalar lambdaN_;
    Scalar lambdaW_;
};
111
112

} // end namespace Dumux
Thomas Fetzer's avatar
Thomas Fetzer committed
113
114

#endif // DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH