tensorlambdafactory.hh 6.24 KB
Newer Older
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
Dennis Gläser's avatar
Dennis Gläser committed
21
 * \ingroup CCMpfaDiscretization
22
23
24
25
26
27
28
29
30
31
32
 * \brief Helper class to be used to obtain lambda functions for the tensors
 *        involved in the laws that describe the different kind of fluxes that
 *        occur in DuMuX models (i.e. advective, diffusive and heat conduction fluxes).
 *        The local systems appearing in Mpfa methods have to be solved subject to
 *        the different tensors. This class returns lambda expressions to be used in the
 *        local systems. The specialization for other discretization methods allows
 *        compatibility with the TPFA scheme, which could be used for one or more of the tensors.
 */
#ifndef DUMUX_DISCRETIZATION_MPFA_TENSOR_LAMBDA_FACTORY_HH
#define DUMUX_DISCRETIZATION_MPFA_TENSOR_LAMBDA_FACTORY_HH

Timo Koch's avatar
Timo Koch committed
33
#include <dumux/common/properties.hh>
34
35
36
37
38
39
40
#include <dumux/discretization/methods.hh>
#include <dumux/discretization/cellcentered/mpfa/tensorlambdafactory.hh>

namespace Dumux
{

/*!
Dennis Gläser's avatar
Dennis Gläser committed
41
 * \ingroup CCMpfaDiscretization
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 * \brief Helper class to be used to obtain lambda functions for the tensors
 *        involved in the laws that describe the different kind of fluxes that
 *        occur in DuMuX models (i.e. advective, diffusive and heat conduction fluxes).
 *        The local systems appearing in Mpfa methods have to be solved subject to
 *        the different tensors. This class returns lambda expressions to be used in the
 *        local systems. The specialization for discretization methods other than mpfa allows
 *        compatibility with the TPFA scheme, which could be used for one or more of the tensors.
 *        The interfaces of the lambdas are chosen such that all involved tensors can be extracted
 *        with the given arguments.
 */
template<class TypeTag, DiscretizationMethods Method>
class TensorLambdaFactory
{
public:

    //! We return zero scalars here in the functions below.
    //! We have to return something as the local systems expect a type
Dennis Gläser's avatar
Dennis Gläser committed
59
60
61
    //! to perform actions on, thus a compiler error will occur.
    //! We return 0.0 as this call should never happen for a tensor
    //! which is not treated by an mpfa method anyway.
62
63
64
65
66
67
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

    //! lambda for the law describing the advective term
    static auto getAdvectionLambda()
    {
        return [] (const auto& problem,
                   const auto& element,
                   const auto& volVars,
                   const auto& fvGeometry,
                   const auto& scv)
               { return 0.0; };
    }

    //! lambda for the diffusion coefficient/tensor
    static auto getDiffusionLambda(unsigned int phaseIdx, unsigned int compIdx)
    {
        return [] (const auto& problem,
                   const auto& element,
                   const auto& volVars,
                   const auto& fvGeometry,
                   const auto& scv)
               { return 0.0; };
    }

    //! lambda for the fourier coefficient
    static auto getHeatConductionLambda()
    {
        return [] (const auto& problem,
                   const auto& element,
                   const auto& volVars,
                   const auto& fvGeometry,
                   const auto& scv)
               { return 0.0; };
    }
};

//! Specialization for mpfa schemes
template<class TypeTag>
class TensorLambdaFactory<TypeTag, DiscretizationMethods::CCMpfa>
{
public:

    //! return void lambda here
    static auto getAdvectionLambda()
    {
        return [] (const auto& problem,
                   const auto& element,
                   const auto& volVars,
                   const auto& fvGeometry,
                   const auto& scv)
               { return volVars.permeability(); };
    }

    //! return void lambda here
    static auto getDiffusionLambda(unsigned int phaseIdx, unsigned int compIdx)
    {
        return [phaseIdx, compIdx] (const auto& problem,
                                    const auto& element,
                                    const auto& volVars,
                                    const auto& fvGeometry,
                                    const auto& scv)
               { return volVars.diffusionCoefficient(phaseIdx, compIdx); };
    }

    //! return void lambda here
    static auto getHeatConductionLambda()
    {
        using ThermalConductivityModel = typename GET_PROP_TYPE(TypeTag, ThermalConductivityModel);

        return [] (const auto& problem,
                   const auto& element,
                   const auto& volVars,
                   const auto& fvGeometry,
                   const auto& scv)
               { return ThermalConductivityModel::effectiveThermalConductivity(volVars,
                                                                               problem.spatialParams(),
                                                                               element,
                                                                               fvGeometry,
                                                                               scv); };
    }
};

} // end namespace

#endif