3.6-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, class DiscretizationMethod>
37class FouriersLawNonEquilibriumImplementation;
38
43template <class TypeTag>
44class FouriersLawNonEquilibriumImplementation<TypeTag, DiscretizationMethods::CCTpfa>
45{
50 using FVElementGeometry = typename GridGeometry::LocalView;
51 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
52 using Extrusion = Extrusion_t<GridGeometry>;
53 using GridView = typename GridGeometry::GridView;
54 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
55 using Element = typename GridView::template Codim<0>::Entity;
57
58 static constexpr int dim = GridView::dimension;
59 static constexpr int dimWorld = GridView::dimensionworld;
60
62
63 static constexpr auto numEnergyEqSolid = getPropValue<TypeTag, Properties::NumEnergyEqSolid>();
64 static constexpr auto numEnergyEqFluid = getPropValue<TypeTag, Properties::NumEnergyEqFluid>();
65 static constexpr auto numEnergyEq = numEnergyEqSolid + numEnergyEqFluid;
66 static constexpr auto sPhaseIdx = ModelTraits::numFluidPhases();
67
68public:
71 static constexpr DiscretizationMethod discMethod{};
72
74
79 static Scalar flux(const Problem& problem,
80 const Element& element,
81 const FVElementGeometry& fvGeometry,
82 const ElementVolumeVariables& elemVolVars,
83 const SubControlVolumeFace& scvf,
84 const int phaseIdx,
85 const ElementFluxVarsCache& elemFluxVarsCache)
86 {
87 Scalar tInside = 0.0;
88 Scalar tOutside = 0.0;
89 // get the inside/outside temperatures
90 if (phaseIdx < numEnergyEqFluid)
91 {
92 tInside += elemVolVars[scvf.insideScvIdx()].temperatureFluid(phaseIdx);
93 tOutside += elemVolVars[scvf.outsideScvIdx()].temperatureFluid(phaseIdx);
94 }
95 else //temp solid
96 {
97 tInside += elemVolVars[scvf.insideScvIdx()].temperatureSolid();
98 tOutside += elemVolVars[scvf.outsideScvIdx()].temperatureSolid();
99 }
100
101 Scalar tij = calculateTransmissibility(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx);
102 return tij*(tInside - tOutside);
103 }
104
106 static Scalar calculateTransmissibility(const Problem& problem,
107 const Element& element,
108 const FVElementGeometry& fvGeometry,
109 const ElementVolumeVariables& elemVolVars,
110 const SubControlVolumeFace& scvf,
111 const int phaseIdx)
112 {
113 const auto insideScvIdx = scvf.insideScvIdx();
114 const auto& insideScv = fvGeometry.scv(insideScvIdx);
115 const auto& insideVolVars = elemVolVars[insideScvIdx];
116 const auto computeLambda = [&](const auto& v){
117 if constexpr (numEnergyEq == 1)
118 return v.effectiveThermalConductivity();
119 else if constexpr (numEnergyEqFluid == 1)
120 return (phaseIdx != sPhaseIdx)
121 ? v.effectiveFluidThermalConductivity()
122 : v.effectiveSolidThermalConductivity();
123 else
124 return v.effectivePhaseThermalConductivity(phaseIdx);
125 };
126
127 const auto insideLambda = computeLambda(insideVolVars);
128 const Scalar ti = computeTpfaTransmissibility(fvGeometry, scvf, insideScv, insideLambda, insideVolVars.extrusionFactor());
129
130 // for the boundary (dirichlet) or at branching points we only need ti
131 if (scvf.boundary() || scvf.numOutsideScvs() > 1)
132 return Extrusion::area(fvGeometry, scvf)*ti;
133 else // otherwise we compute a tpfa harmonic mean
134 {
135 const auto outsideScvIdx = scvf.outsideScvIdx();
136 const auto& outsideScv = fvGeometry.scv(outsideScvIdx);
137 const auto& outsideVolVars = elemVolVars[outsideScvIdx];
138 const auto outsideLambda = computeLambda(outsideVolVars);
139
140 Scalar tj;
141 if (dim == dimWorld)
142 // assume the normal vector from outside is anti parallel so we save flipping a vector
143 tj = -1.0*computeTpfaTransmissibility(fvGeometry, scvf, outsideScv, outsideLambda, outsideVolVars.extrusionFactor());
144 else
145 tj = computeTpfaTransmissibility(fvGeometry, fvGeometry.flipScvf(scvf.index()), outsideScv, outsideLambda, outsideVolVars.extrusionFactor());
146
147 // check for division by zero!
148 if (ti*tj <= 0.0)
149 return 0.0;
150 else
151 return Extrusion::area(fvGeometry, scvf)*(ti * tj)/(ti + tj);
152 }
153 }
154};
155
156} // end namespace Dumux
157
158#endif
Helper classes to compute the integration elements.
The available discretization methods in Dumux.
Classes related to flux variables caching.
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:48
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:251
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
Definition: method.hh:37
Definition: box/fourierslawnonequilibrium.hh:42
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:106
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVarsCache &elemFluxVarsCache)
Returns the heat flux within a fluid or solid phase (in J/s) across the given sub-control volume face...
Definition: cctpfa/fourierslawnonequilibrium.hh:79
Definition: fluxvariablescaching.hh:68
Declares all properties used in Dumux.
Free functions to evaluate the transmissibilities associated with flux evaluations across sub-control...