3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
cctpfa/fourierslawnonequilibrium.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_DISCRETIZATION_CC_TPFA_FOURIERS_LAW_NONEQUILIBRIUM_HH
25#define DUMUX_DISCRETIZATION_CC_TPFA_FOURIERS_LAW_NONEQUILIBRIUM_HH
26
32
33namespace Dumux {
34
35// forward declaration
36template<class TypeTag, DiscretizationMethod discMethod>
37class FouriersLawNonEquilibriumImplementation;
38
43template <class TypeTag>
45{
49 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
50 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
52 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
53 using Element = typename GridView::template Codim<0>::Entity;
55
56 static constexpr int dim = GridView::dimension;
57 static constexpr int dimWorld = GridView::dimensionworld;
58
60
61 static constexpr auto numEnergyEqSolid = getPropValue<TypeTag, Properties::NumEnergyEqSolid>();
62 static constexpr auto numEnergyEqFluid = getPropValue<TypeTag, Properties::NumEnergyEqFluid>();
63 static constexpr auto numEnergyEq = numEnergyEqSolid + numEnergyEqFluid;
64 static constexpr auto sPhaseIdx = ModelTraits::numFluidPhases();
65
66public:
69
71
73 static Scalar flux(const Problem& problem,
74 const Element& element,
75 const FVElementGeometry& fvGeometry,
76 const ElementVolumeVariables& elemVolVars,
77 const SubControlVolumeFace& scvf,
78 const int phaseIdx,
79 const ElementFluxVarsCache& elemFluxVarsCache)
80 {
81 Scalar tInside = 0.0;
82 Scalar tOutside = 0.0;
83 // get the inside/outside temperatures
84 if (phaseIdx < numEnergyEqFluid)
85 {
86 tInside += elemVolVars[scvf.insideScvIdx()].temperatureFluid(phaseIdx);
87 tOutside += elemVolVars[scvf.outsideScvIdx()].temperatureFluid(phaseIdx);
88 }
89 else //temp solid
90 {
91 tInside += elemVolVars[scvf.insideScvIdx()].temperatureSolid();
92 tOutside += elemVolVars[scvf.outsideScvIdx()].temperatureSolid();
93 }
94
95 Scalar tij = calculateTransmissibility(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx);
96 return tij*(tInside - tOutside);
97 }
98
100 static Scalar calculateTransmissibility(const Problem& problem,
101 const Element& element,
102 const FVElementGeometry& fvGeometry,
103 const ElementVolumeVariables& elemVolVars,
104 const SubControlVolumeFace& scvf,
105 const int phaseIdx)
106 {
107 const auto insideScvIdx = scvf.insideScvIdx();
108 const auto& insideScv = fvGeometry.scv(insideScvIdx);
109 const auto& insideVolVars = elemVolVars[insideScvIdx];
110 const auto computeLambda = [&](const auto& v){
111 if constexpr (numEnergyEq == 1)
112 return v.effectiveThermalConductivity();
113 else if constexpr (numEnergyEqFluid == 1)
114 return (phaseIdx != sPhaseIdx)
115 ? v.effectiveFluidThermalConductivity()
116 : v.effectiveSolidThermalConductivity();
117 else
118 return v.effectivePhaseThermalConductivity(phaseIdx);
119 };
120
121 const auto insideLambda = computeLambda(insideVolVars);
122 const Scalar ti = computeTpfaTransmissibility(scvf, insideScv, insideLambda, insideVolVars.extrusionFactor());
123
124 // for the boundary (dirichlet) or at branching points we only need ti
125 if (scvf.boundary() || scvf.numOutsideScvs() > 1)
126 return scvf.area()*ti;
127 else // otherwise we compute a tpfa harmonic mean
128 {
129 const auto outsideScvIdx = scvf.outsideScvIdx();
130 const auto& outsideScv = fvGeometry.scv(outsideScvIdx);
131 const auto& outsideVolVars = elemVolVars[outsideScvIdx];
132 const auto outsideLambda = computeLambda(outsideVolVars);
133
134 Scalar tj;
135 if (dim == dimWorld)
136 // assume the normal vector from outside is anti parallel so we save flipping a vector
137 tj = -1.0*computeTpfaTransmissibility(scvf, outsideScv, outsideLambda, outsideVolVars.extrusionFactor());
138 else
139 tj = computeTpfaTransmissibility(fvGeometry.flipScvf(scvf.index()), outsideScv, outsideLambda, outsideVolVars.extrusionFactor());
140
141 // check for division by zero!
142 if (ti*tj <= 0.0)
143 return 0.0;
144 else
145 return scvf.area()*(ti * tj)/(ti + tj);
146 }
147 }
148};
149
150} // end namespace Dumux
151
152#endif
Helpers for deprecation.
The available discretization methods in Dumux.
Classes related to flux variables caching.
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
Tensor::field_type computeTpfaTransmissibility(const SubControlVolumeFace &scvf, const SubControlVolume &scv, const Tensor &T, typename SubControlVolume::Traits::Scalar extrusionFactor)
Free function to evaluate the Tpfa transmissibility associated with the flux (in the form of flux = T...
Definition: tpfa/computetransmissibility.hh:47
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Definition: fourierslawnonequilibrium.hh:36
Fourier's law for cell-centered finite volume schemes with two-point flux approximation.
Definition: cctpfa/fourierslawnonequilibrium.hh:45
static Scalar calculateTransmissibility(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx)
Compute transmissibilities.
Definition: cctpfa/fourierslawnonequilibrium.hh:100
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVarsCache &elemFluxVarsCache)
Compute the heat condution flux assuming thermal equilibrium.
Definition: cctpfa/fourierslawnonequilibrium.hh:73
Definition: fluxvariablescaching.hh:65
Declares all properties used in Dumux.
Free functions to evaluate the transmissibilities associated with flux evaluations across sub-control...