3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
flux/box/fourierslaw.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 *****************************************************************************/
25#ifndef DUMUX_DISCRETIZATION_BOX_FOURIERS_LAW_HH
26#define DUMUX_DISCRETIZATION_BOX_FOURIERS_LAW_HH
27
28#include <dumux/common/math.hh>
33
34namespace Dumux {
35
36// forward declaration
37template<class TypeTag, class DiscretizationMethod>
39
44template <class TypeTag>
45class FouriersLawImplementation<TypeTag, DiscretizationMethods::Box>
46{
50 using FVElementGeometry = typename GridGeometry::LocalView;
51 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
52 using Extrusion = Extrusion_t<GridGeometry>;
53 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
54 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
56 using Element = typename GridView::template Codim<0>::Entity;
57
58public:
66 static Scalar flux(const Problem& problem,
67 const Element& element,
68 const FVElementGeometry& fvGeometry,
69 const ElementVolumeVariables& elemVolVars,
70 const SubControlVolumeFace& scvf,
71 const ElementFluxVariablesCache& elemFluxVarsCache)
72 {
73 // get inside and outside diffusion tensors and calculate the harmonic mean
74 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
75 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
76 const auto& insideVolVars = elemVolVars[insideScv];
77 const auto& outsideVolVars = elemVolVars[outsideScv];
78
79 // effective diffusion tensors
80 auto insideLambda = insideVolVars.effectiveThermalConductivity();
81 auto outsideLambda = outsideVolVars.effectiveThermalConductivity();
82
83 // scale by extrusion factor
84 insideLambda *= insideVolVars.extrusionFactor();
85 outsideLambda *= outsideVolVars.extrusionFactor();
86
87 // the resulting averaged diffusion tensor
88 const auto lambda = faceTensorAverage(insideLambda, outsideLambda, scvf.unitOuterNormal());
89
90 // evaluate gradTemp at integration point
91 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
92
93 // compute the temperature gradient with the shape functions
94 Dune::FieldVector<Scalar, GridView::dimensionworld> gradTemp(0.0);
95 for (auto&& scv : scvs(fvGeometry))
96 gradTemp.axpy(elemVolVars[scv].temperature(), fluxVarsCache.gradN(scv.indexInElement()));
97
98 // comute the heat conduction flux
99 return -1.0*vtmv(scvf.unitOuterNormal(), lambda, gradTemp)*Extrusion::area(scvf);
100 }
101};
102
103} // end namespace Dumux
104
105#endif
Define some often used mathematical functions.
Helper classes to compute the integration elements.
The available discretization methods in Dumux.
A free function to average a Tensor at an interface.
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:863
Definition: adapt.hh:29
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:177
Scalar faceTensorAverage(const Scalar T1, const Scalar T2, const Dune::FieldVector< Scalar, dim > &normal)
Average of a discontinuous scalar field at discontinuity interface (for compatibility reasons with th...
Definition: facetensoraverage.hh:41
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
forward declaration of the method-specific implementation
Definition: flux/box/fourierslaw.hh:38
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache)
Returns the heat flux within the porous medium (in J/s) across the given sub-control volume face.
Definition: flux/box/fourierslaw.hh:66
Declares all properties used in Dumux.