GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/porousmediumflow/solidenergy/localresidual.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 0 0 -%
Branches: 1 2 50.0%

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 SolidEnergyModel
10 * \brief Element-wise calculation of the residual
11 */
12 #ifndef DUMUX_SOLID_ENERGY_LOCAL_RESIDUAL_HH
13 #define DUMUX_SOLID_ENERGY_LOCAL_RESIDUAL_HH
14
15 #include <dumux/common/properties.hh>
16 #include <dumux/common/numeqvector.hh>
17 #include <dumux/discretization/defaultlocaloperator.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup SolidEnergyModel
23 * \brief Element-wise calculation of the residual
24 */
25 template<class TypeTag>
26 class SolidEnergyLocalResidual
27 : public DiscretizationDefaultLocalOperator<TypeTag>
28 {
29 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
30 using ParentType = DiscretizationDefaultLocalOperator<TypeTag>;
31 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
32 using Problem = GetPropType<TypeTag, Properties::Problem>;
33 using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>;
34 using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
35 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
36 using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>;
37 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
38 using FVElementGeometry = typename GridGeometry::LocalView;
39 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
40 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
41 using GridView = typename GridGeometry::GridView;
42 using Element = typename GridView::template Codim<0>::Entity;
43
44 public:
45
1/2
✓ Branch 1 taken 200001 times.
✗ Branch 2 not taken.
246177 using ParentType::ParentType;
46
47 /*!
48 * \brief Evaluate the rate of change of all conservation quantites
49 * \param problem The problem
50 * \param scv The sub control volume
51 * \param volVars The current or previous volVars
52 * \note This function should not include the source and sink terms.
53 * \note The volVars can be different to allow computing
54 * the implicit/explicit euler time derivative here
55 */
56 619024 NumEqVector computeStorage(const Problem& problem,
57 const SubControlVolume& scv,
58 const VolumeVariables& volVars) const
59 {
60 619024 NumEqVector storage;
61 619024 storage[0] = volVars.temperatureSolid()
62 619024 * volVars.solidHeatCapacity()
63 619024 * volVars.solidDensity()
64 619024 * (1.0 - volVars.porosity());
65
66 return storage;
67 }
68
69
70 /*!
71 * \brief Evaluate the energy flux over a face of a sub control volume
72 *
73 * \param problem The problem
74 * \param element The element
75 * \param fvGeometry The finite volume geometry context
76 * \param elemVolVars The volume variables for all flux stencil elements
77 * \param scvf The sub control volume face to compute the flux on
78 * \param elemFluxVarsCache The cache related to flux computation
79 */
80 3313080 NumEqVector computeFlux(const Problem& problem,
81 const Element& element,
82 const FVElementGeometry& fvGeometry,
83 const ElementVolumeVariables& elemVolVars,
84 const SubControlVolumeFace& scvf,
85 const ElementFluxVariablesCache& elemFluxVarsCache) const
86 {
87 3313080 FluxVariables fluxVars;
88 3313080 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
89 3313080 return fluxVars.heatConductionFlux();
90 }
91 };
92
93 } // end namespace Dumux
94
95 #endif
96