3.1-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 SubControlVolume = typename FVElementGeometry::SubControlVolume;
51 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
53 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
54 using Element = typename GridView::template Codim<0>::Entity;
56
57 static constexpr int dim = GridView::dimension;
58 static constexpr int dimWorld = GridView::dimensionworld;
59
62
63 static constexpr auto numEnergyEqFluid = getPropValue<TypeTag, Properties::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 Scalar tij;
108
109 const auto insideScvIdx = scvf.insideScvIdx();
110 const auto& insideScv = fvGeometry.scv(insideScvIdx);
111 const auto& insideVolVars = elemVolVars[insideScvIdx];
112 Scalar insideLambda = 0.0;
113 Scalar outsideLambda = 0.0;
114
115 // effective diffusion tensors
116 if (phaseIdx != sPhaseIdx)
117 {
118 //when number of energyEq for the fluid are smaller than numPhases that means that we need an effecitve law
119 if (numEnergyEqFluid < ModelTraits::numFluidPhases())
120 {
121 insideLambda += Deprecated::template effectiveThermalConductivity<ThermalConductivityModel>(
122 insideVolVars, problem.spatialParams(), element, fvGeometry, insideScv);
123 }
124 else //numEnergyEqFluid >1
125 {
126 insideLambda += insideVolVars.fluidThermalConductivity(phaseIdx)*insideVolVars.saturation(phaseIdx)*insideVolVars.porosity();
127 }
128 }
129 //solid phase
130 else
131 {
132 insideLambda += insideVolVars.solidThermalConductivity()*(1.0-insideVolVars.porosity());
133 }
134
135 const Scalar ti = computeTpfaTransmissibility(scvf, insideScv, insideLambda, insideVolVars.extrusionFactor());
136
137 // for the boundary (dirichlet) or at branching points we only need ti
138 if (scvf.boundary() || scvf.numOutsideScvs() > 1)
139 {
140 tij = scvf.area()*ti;
141 }
142 // otherwise we compute a tpfa harmonic mean
143 else
144 {
145 const auto outsideScvIdx = scvf.outsideScvIdx();
146 const auto& outsideScv = fvGeometry.scv(outsideScvIdx);
147 const auto& outsideVolVars = elemVolVars[outsideScvIdx];
148
149 // effective diffusion tensors
150 if (phaseIdx != sPhaseIdx)
151 {
152 //when number of energyEq for the fluid are smaller than numPhases that means that we need an effecitve law
153 if (numEnergyEqFluid < ModelTraits::numFluidPhases())
154 {
155 outsideLambda += Deprecated::template effectiveThermalConductivity<ThermalConductivityModel>(
156 outsideVolVars, problem.spatialParams(), element, fvGeometry, outsideScv);
157 }
158 else
159 {
160 outsideLambda += outsideVolVars.fluidThermalConductivity(phaseIdx)*outsideVolVars.saturation(phaseIdx)*outsideVolVars.porosity();
161 }
162 }
163 //solid phase
164 else
165 {
166 outsideLambda +=outsideVolVars.solidThermalConductivity()*(1.0-outsideVolVars.porosity());
167 }
168 Scalar tj;
169 if (dim == dimWorld)
170 // assume the normal vector from outside is anti parallel so we save flipping a vector
171 tj = -1.0*computeTpfaTransmissibility(scvf, outsideScv, outsideLambda, outsideVolVars.extrusionFactor());
172 else
173 tj = computeTpfaTransmissibility(fvGeometry.flipScvf(scvf.index()), outsideScv, outsideLambda, outsideVolVars.extrusionFactor());
174
175 // check for division by zero!
176 if (ti*tj <= 0.0)
177 tij = 0;
178 else
179 tij = scvf.area()*(ti * tj)/(ti + tj);
180 }
181 return tij;
182 }
183};
184
185} // end namespace Dumux
186
187#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
make the local view function available whenever we use the grid geometry
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...