Line | Branch | Exec | Source |
---|---|---|---|
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 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup BoxFlux | ||
10 | * \brief This file contains the data which is required to calculate | ||
11 | * energy fluxes due to molecular diffusion with Fourier's law. | ||
12 | */ | ||
13 | #ifndef DUMUX_DISCRETIZATION_BOX_FOURIERS_LAW_HH | ||
14 | #define DUMUX_DISCRETIZATION_BOX_FOURIERS_LAW_HH | ||
15 | |||
16 | #include <dumux/common/math.hh> | ||
17 | #include <dumux/common/properties.hh> | ||
18 | #include <dumux/discretization/method.hh> | ||
19 | #include <dumux/discretization/extrusion.hh> | ||
20 | #include <dumux/flux/facetensoraverage.hh> | ||
21 | |||
22 | namespace Dumux { | ||
23 | |||
24 | // forward declaration | ||
25 | template<class TypeTag, class DiscretizationMethod> | ||
26 | class FouriersLawImplementation; | ||
27 | |||
28 | /*! | ||
29 | * \ingroup BoxFlux | ||
30 | * \brief Specialization of Fourier's Law for the box method. | ||
31 | */ | ||
32 | template <class TypeTag> | ||
33 | class FouriersLawImplementation<TypeTag, DiscretizationMethods::Box> | ||
34 | { | ||
35 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
36 | using Problem = GetPropType<TypeTag, Properties::Problem>; | ||
37 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
38 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
39 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
40 | using Extrusion = Extrusion_t<GridGeometry>; | ||
41 | using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; | ||
42 | using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; | ||
43 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
44 | using Element = typename GridView::template Codim<0>::Entity; | ||
45 | |||
46 | public: | ||
47 | /*! | ||
48 | * \brief Returns the heat flux within the porous medium | ||
49 | * (in J/s) across the given sub-control volume face. | ||
50 | * \note This law assumes thermal equilibrium between the fluid | ||
51 | * and solid phases, and uses an effective thermal conductivity | ||
52 | * for the overall aggregate. | ||
53 | */ | ||
54 | 134609236 | static Scalar flux(const Problem& problem, | |
55 | const Element& element, | ||
56 | const FVElementGeometry& fvGeometry, | ||
57 | const ElementVolumeVariables& elemVolVars, | ||
58 | const SubControlVolumeFace& scvf, | ||
59 | const ElementFluxVariablesCache& elemFluxVarsCache) | ||
60 | { | ||
61 | // get inside and outside diffusion tensors and calculate the harmonic mean | ||
62 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 130358388 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 130358388 times.
|
269218472 | const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); |
63 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 130358388 times.
✓ Branch 2 taken 130358388 times.
✗ Branch 3 not taken.
|
134609236 | const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx()); |
64 |
1/2✓ Branch 0 taken 130358388 times.
✗ Branch 1 not taken.
|
134609236 | const auto& insideVolVars = elemVolVars[insideScv]; |
65 |
1/2✓ Branch 0 taken 130358388 times.
✗ Branch 1 not taken.
|
134609236 | const auto& outsideVolVars = elemVolVars[outsideScv]; |
66 | |||
67 | // effective diffusion tensors | ||
68 |
1/2✓ Branch 0 taken 130358388 times.
✗ Branch 1 not taken.
|
134609236 | auto insideLambda = insideVolVars.effectiveThermalConductivity(); |
69 |
1/2✓ Branch 0 taken 130358388 times.
✗ Branch 1 not taken.
|
134609236 | auto outsideLambda = outsideVolVars.effectiveThermalConductivity(); |
70 | |||
71 | // scale by extrusion factor | ||
72 | 134609236 | insideLambda *= insideVolVars.extrusionFactor(); | |
73 | 134609236 | outsideLambda *= outsideVolVars.extrusionFactor(); | |
74 | |||
75 | // the resulting averaged diffusion tensor | ||
76 |
2/4✓ Branch 0 taken 130358388 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 130358388 times.
✗ Branch 3 not taken.
|
269218472 | const auto lambda = faceTensorAverage(insideLambda, outsideLambda, scvf.unitOuterNormal()); |
77 | |||
78 | // evaluate gradTemp at integration point | ||
79 | 134609236 | const auto& fluxVarsCache = elemFluxVarsCache[scvf]; | |
80 | |||
81 | // compute the temperature gradient with the shape functions | ||
82 | 134609236 | Dune::FieldVector<Scalar, GridView::dimensionworld> gradTemp(0.0); | |
83 |
4/4✓ Branch 0 taken 520729712 times.
✓ Branch 1 taken 130358388 times.
✓ Branch 2 taken 520729712 times.
✓ Branch 3 taken 130358388 times.
|
1344640776 | for (auto&& scv : scvs(fvGeometry)) |
84 | 2688555760 | gradTemp.axpy(elemVolVars[scv].temperature(), fluxVarsCache.gradN(scv.indexInElement())); | |
85 | |||
86 | // compute the heat conduction flux | ||
87 | 269323272 | return -1.0*vtmv(scvf.unitOuterNormal(), lambda, gradTemp)*Extrusion::area(fvGeometry, scvf); | |
88 | } | ||
89 | }; | ||
90 | |||
91 | } // end namespace Dumux | ||
92 | |||
93 | #endif | ||
94 |