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-FileCopyrightText: 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 | 62256998 | static Scalar flux(const Problem& problem, | |
62 | const Element& element, | ||
63 | const FVElementGeometry& fvGeometry, | ||
64 | const ElementVolumeVariables& elemVolVars, | ||
65 | const SubControlVolumeFace &scvf) | ||
66 | { | ||
67 |
2/2✓ Branch 0 taken 3974190 times.
✓ Branch 1 taken 58282808 times.
|
62256998 | Scalar flux(0.0); |
68 | |||
69 | // conductive energy flux is zero for outflow boundary conditions | ||
70 |
5/5✓ Branch 0 taken 3974190 times.
✓ Branch 1 taken 58282808 times.
✓ Branch 2 taken 1497968 times.
✓ Branch 3 taken 2389034 times.
✓ Branch 4 taken 87188 times.
|
62256998 | if (scvf.boundary() && problem.boundaryTypes(element, scvf).isOutflow(Indices::energyEqIdx)) |
71 | 1540188 | return flux; | |
72 | |||
73 | 60716810 | const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); | |
74 | 60716810 | const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()]; | |
75 | 60716810 | const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()]; | |
76 | |||
77 | 60716810 | const Scalar insideTemperature = insideVolVars.temperature(); | |
78 | 60716810 | const Scalar outsideTemperature = outsideVolVars.temperature(); | |
79 | |||
80 | 60716810 | const Scalar insideLambda = insideVolVars.effectiveThermalConductivity() * insideVolVars.extrusionFactor(); | |
81 |
2/2✓ Branch 0 taken 87188 times.
✓ Branch 1 taken 1379840 times.
|
122900648 | const Scalar insideDistance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm(); |
82 | |||
83 |
2/2✓ Branch 0 taken 2434002 times.
✓ Branch 1 taken 58282808 times.
|
60716810 | if (scvf.boundary()) |
84 | { | ||
85 | 2434002 | flux = insideLambda * (insideTemperature - outsideTemperature) / insideDistance; | |
86 | } | ||
87 | else | ||
88 | { | ||
89 | 58282808 | const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx()); | |
90 | 58282808 | const Scalar outsideLambda = outsideVolVars.effectiveThermalConductivity() * outsideVolVars.extrusionFactor(); | |
91 |
2/2✓ Branch 0 taken 58255900 times.
✓ Branch 1 taken 26908 times.
|
174848424 | const Scalar outsideDistance = (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(); |
92 | 58282808 | const Scalar avgLambda = harmonicMean(insideLambda, outsideLambda, insideDistance, outsideDistance); | |
93 | |||
94 | 58282808 | flux = avgLambda * (insideTemperature - outsideTemperature) / (insideDistance + outsideDistance); | |
95 | } | ||
96 | |||
97 | 60716810 | flux *= Extrusion::area(fvGeometry, scvf); | |
98 | 60716810 | return flux; | |
99 | } | ||
100 | }; | ||
101 | |||
102 | } // end namespace Dumux | ||
103 | |||
104 | #endif | ||
105 |