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 OneEqModel | ||
10 | * \copydoc Dumux::OneEqResidualImpl | ||
11 | */ | ||
12 | #ifndef DUMUX_STAGGERED_ONEEQ_LOCAL_RESIDUAL_HH | ||
13 | #define DUMUX_STAGGERED_ONEEQ_LOCAL_RESIDUAL_HH | ||
14 | |||
15 | #include <dune/common/hybridutilities.hh> | ||
16 | #include <dumux/common/properties.hh> | ||
17 | #include <dumux/discretization/method.hh> | ||
18 | #include <dumux/freeflow/navierstokes/localresidual.hh> | ||
19 | |||
20 | namespace Dumux { | ||
21 | |||
22 | /*! | ||
23 | * \ingroup OneEqModel | ||
24 | * \brief Element-wise calculation of the residual for one-equation turbulence models | ||
25 | * using the staggered discretization | ||
26 | */ | ||
27 | |||
28 | // forward declaration | ||
29 | template<class TypeTag, class BaseLocalResidual, class DiscretizationMethod> | ||
30 | class OneEqResidualImpl; | ||
31 | |||
32 | template<class TypeTag, class BaseLocalResidual> | ||
33 | class OneEqResidualImpl<TypeTag, BaseLocalResidual, DiscretizationMethods::Staggered> | ||
34 | : public BaseLocalResidual | ||
35 | { | ||
36 | using ParentType = BaseLocalResidual; | ||
37 | |||
38 | using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; | ||
39 | |||
40 | using GridVolumeVariables = typename GridVariables::GridVolumeVariables; | ||
41 | using ElementVolumeVariables = typename GridVolumeVariables::LocalView; | ||
42 | using VolumeVariables = typename GridVolumeVariables::VolumeVariables; | ||
43 | |||
44 | using GridFluxVariablesCache = typename GridVariables::GridFluxVariablesCache; | ||
45 | using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; | ||
46 | using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; | ||
47 | |||
48 | using GridFaceVariables = typename GridVariables::GridFaceVariables; | ||
49 | using ElementFaceVariables = typename GridFaceVariables::LocalView; | ||
50 | |||
51 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
52 | using Problem = GetPropType<TypeTag, Properties::Problem>; | ||
53 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
54 | using Element = typename GridView::template Codim<0>::Entity; | ||
55 | using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; | ||
56 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
57 | using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>; | ||
58 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
59 | using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; | ||
60 | |||
61 | static constexpr int viscosityTildeEqIdx = Indices::viscosityTildeEqIdx - ModelTraits::dim(); | ||
62 | |||
63 | public: | ||
64 |
4/8✓ Branch 1 taken 111720 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 111720 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 111720 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 111720 times.
✗ Branch 11 not taken.
|
446880 | using ParentType::ParentType; |
65 | |||
66 | //! Evaluate fluxes entering or leaving the cell center control volume. | ||
67 | ✗ | CellCenterPrimaryVariables computeStorageForCellCenter(const Problem& problem, | |
68 | const SubControlVolume& scv, | ||
69 | const VolumeVariables& volVars) const | ||
70 | { | ||
71 | 7172568 | CellCenterPrimaryVariables storage = ParentType::computeStorageForCellCenter(problem, scv, volVars); | |
72 | 21517704 | storage[viscosityTildeEqIdx] = volVars.viscosityTilde() * volVars.density(); | |
73 | ✗ | return storage; | |
74 | } | ||
75 | |||
76 | 3973064 | CellCenterPrimaryVariables computeSourceForCellCenter(const Problem& problem, | |
77 | const Element &element, | ||
78 | const FVElementGeometry& fvGeometry, | ||
79 | const ElementVolumeVariables& elemVolVars, | ||
80 | const ElementFaceVariables& elemFaceVars, | ||
81 | const SubControlVolume &scv) const | ||
82 | { | ||
83 | 3973064 | CellCenterPrimaryVariables source = ParentType::computeSourceForCellCenter(problem, element, fvGeometry, | |
84 | elemVolVars, elemFaceVars, scv); | ||
85 | |||
86 | 3973064 | const auto& volVars = elemVolVars[scv]; | |
87 | |||
88 | 11919192 | source[viscosityTildeEqIdx] += volVars.cb1() * (1.0 - volVars.ft2()) | |
89 | 3973064 | * volVars.stressTensorScalarProductTilde() | |
90 | 7946128 | * volVars.viscosityTilde() * volVars.density(); | |
91 | |||
92 | 7946128 | source[viscosityTildeEqIdx] -= (volVars.cw1() * volVars.fW() | |
93 | 3973064 | - volVars.cb1() * volVars.ft2() / problem.karmanConstant() / problem.karmanConstant()) | |
94 | 3973064 | * volVars.viscosityTilde() * volVars.viscosityTilde() | |
95 | 7946128 | / volVars.wallDistance() / volVars.wallDistance() * volVars.density();; | |
96 | |||
97 |
2/2✓ Branch 0 taken 7946128 times.
✓ Branch 1 taken 3973064 times.
|
11919192 | for (unsigned int axisIdx = 0; axisIdx < ModelTraits::dim(); ++axisIdx) |
98 | { | ||
99 | 23838384 | source[viscosityTildeEqIdx] += volVars.cb2() / volVars.sigma() | |
100 | 7946128 | * volVars.storedViscosityTildeGradient()[axisIdx] | |
101 | 15892256 | * volVars.storedViscosityTildeGradient()[axisIdx] | |
102 | 15892256 | * volVars.density(); | |
103 | } | ||
104 | |||
105 | 3973064 | return source; | |
106 | } | ||
107 | }; | ||
108 | } // end namespace Dumux | ||
109 | |||
110 | #endif | ||
111 |