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 StaggeredFlux | ||
10 | * \brief Specialization of Fourier's Law for the staggered free flow method. | ||
11 | */ | ||
12 | #ifndef DUMUX_DISCRETIZATION_STAGGERED_FOURIERS_LAW_HH | ||
13 | #define DUMUX_DISCRETIZATION_STAGGERED_FOURIERS_LAW_HH | ||
14 | |||
15 | #include <dumux/common/properties.hh> | ||
16 | #include <dumux/common/math.hh> | ||
17 | |||
18 | #include <dumux/discretization/method.hh> | ||
19 | #include <dumux/discretization/extrusion.hh> | ||
20 | #include <dumux/flux/fluxvariablescaching.hh> | ||
21 | |||
22 | namespace Dumux { | ||
23 | |||
24 | // forward declaration | ||
25 | template<class TypeTag, class DiscretizationMethod> | ||
26 | class FouriersLawImplementation; | ||
27 | |||
28 | /*! | ||
29 | * \ingroup StaggeredFlux | ||
30 | * \brief Specialization of Fourier's Law for the staggered free flow method. | ||
31 | */ | ||
32 | template <class TypeTag> | ||
33 | class FouriersLawImplementation<TypeTag, DiscretizationMethods::Staggered> | ||
34 | { | ||
35 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
36 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
37 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
38 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
39 | using Extrusion = Extrusion_t<GridGeometry>; | ||
40 | using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; | ||
41 | using Element = typename GridGeometry::GridView::template Codim<0>::Entity; | ||
42 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
43 | |||
44 | public: | ||
45 | using DiscretizationMethod = DiscretizationMethods::Staggered; | ||
46 | // state the discretization method this implementation belongs to | ||
47 | static constexpr DiscretizationMethod discMethod{}; | ||
48 | |||
49 | //! state the type for the corresponding cache | ||
50 | //! We don't cache anything for this law | ||
51 | using Cache = FluxVariablesCaching::EmptyDiffusionCache; | ||
52 | |||
53 | /*! | ||
54 | * \brief Returns the heat flux within the porous medium | ||
55 | * (in J/s) across the given sub-control volume face. | ||
56 | * \note This law assumes thermal equilibrium between the fluid | ||
57 | * and solid phases, and uses an effective thermal conductivity | ||
58 | * for the overall aggregate. | ||
59 | */ | ||
60 | template<class Problem> | ||
61 | 61148748 | static Scalar flux(const Problem& problem, | |
62 | const Element& element, | ||
63 | const FVElementGeometry& fvGeometry, | ||
64 | const ElementVolumeVariables& elemVolVars, | ||
65 | const SubControlVolumeFace &scvf) | ||
66 | { | ||
67 | 61148748 | Scalar flux(0.0); | |
68 | |||
69 | // conductive energy flux is zero for outflow boundary conditions | ||
70 |
6/6✓ Branch 0 taken 3914440 times.
✓ Branch 1 taken 57234308 times.
✓ Branch 3 taken 1516188 times.
✓ Branch 4 taken 2398252 times.
✓ Branch 5 taken 1516188 times.
✓ Branch 6 taken 2398252 times.
|
61148748 | if (scvf.boundary() && problem.boundaryTypes(element, scvf).isOutflow(Indices::energyEqIdx)) |
71 | 1516188 | return flux; | |
72 | |||
73 | 119265120 | const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); | |
74 | 119265120 | const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()]; | |
75 | 119265120 | const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()]; | |
76 | |||
77 | 59632560 | const Scalar insideTemperature = insideVolVars.temperature(); | |
78 | 59632560 | const Scalar outsideTemperature = outsideVolVars.temperature(); | |
79 | |||
80 | 59632560 | const Scalar insideLambda = insideVolVars.effectiveThermalConductivity() * insideVolVars.extrusionFactor(); | |
81 | 238530240 | const Scalar insideDistance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm(); | |
82 | |||
83 |
2/2✓ Branch 0 taken 2398252 times.
✓ Branch 1 taken 57234308 times.
|
59632560 | if (scvf.boundary()) |
84 | { | ||
85 | 2398252 | flux = insideLambda * (insideTemperature - outsideTemperature) / insideDistance; | |
86 | } | ||
87 | else | ||
88 | { | ||
89 | 114468616 | const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx()); | |
90 | 57234308 | const Scalar outsideLambda = outsideVolVars.effectiveThermalConductivity() * outsideVolVars.extrusionFactor(); | |
91 | 228937232 | const Scalar outsideDistance = (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(); | |
92 |
2/2✓ Branch 0 taken 57207400 times.
✓ Branch 1 taken 26908 times.
|
57234308 | const Scalar avgLambda = harmonicMean(insideLambda, outsideLambda, insideDistance, outsideDistance); |
93 | |||
94 | 57234308 | flux = avgLambda * (insideTemperature - outsideTemperature) / (insideDistance + outsideDistance); | |
95 | } | ||
96 | |||
97 | 59632560 | flux *= Extrusion::area(fvGeometry, scvf); | |
98 | 59632560 | return flux; | |
99 | } | ||
100 | }; | ||
101 | |||
102 | } // end namespace Dumux | ||
103 | |||
104 | #endif | ||
105 |