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 NavierStokesModel | ||
10 | * \copydoc Dumux::NavierStokesBoundaryTypes | ||
11 | */ | ||
12 | #ifndef FREEFLOW_NAVIERSTOKES_MOMENTUM_BOUNDARY_TYPES_HH | ||
13 | #define FREEFLOW_NAVIERSTOKES_MOMENTUM_BOUNDARY_TYPES_HH | ||
14 | |||
15 | #include <dumux/common/boundarytypes.hh> | ||
16 | |||
17 | namespace Dumux { | ||
18 | |||
19 | /*! | ||
20 | * \ingroup NavierStokesModel | ||
21 | * \brief Class to specify the type of a boundary condition for the Navier-Stokes model. | ||
22 | */ | ||
23 | template <int size> | ||
24 | class NavierStokesMomentumBoundaryTypes : public BoundaryTypes<size> | ||
25 | { | ||
26 | using ParentType = BoundaryTypes<size>; | ||
27 | |||
28 | public: | ||
29 | 6840674 | NavierStokesMomentumBoundaryTypes() | |
30 | 6840674 | { | |
31 |
4/4✓ Branch 0 taken 11321336 times.
✓ Branch 1 taken 5530396 times.
✓ Branch 2 taken 2242986 times.
✓ Branch 3 taken 2129420 times.
|
21224138 | for (int eqIdx=0; eqIdx < size; ++eqIdx) |
32 | 28766928 | resetEq(eqIdx); | |
33 | } | ||
34 | |||
35 | /*! | ||
36 | * \brief Reset the boundary types for one equation. | ||
37 | */ | ||
38 | void resetEq(const int eqIdx) | ||
39 | { | ||
40 | 14383464 | ParentType::resetEq(eqIdx); | |
41 | |||
42 | 14383464 | boundaryInfo_[eqIdx].isSymmetry = false; | |
43 | 28766928 | boundaryInfo_[eqIdx].isBeaversJoseph = false; | |
44 | } | ||
45 | |||
46 | /*! | ||
47 | * \brief Sets a symmetry boundary condition for all equations | ||
48 | */ | ||
49 | void setAllSymmetry() | ||
50 | { | ||
51 | for (int eqIdx=0; eqIdx < size; ++eqIdx) | ||
52 | { | ||
53 | resetEq(eqIdx); | ||
54 | boundaryInfo_[eqIdx].isSymmetry = true; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | /*! | ||
59 | * \brief Returns true if the there is a symmetry boundary condition | ||
60 | */ | ||
61 | bool isSymmetry() const | ||
62 | { return boundaryInfo_[0].isSymmetry; } | ||
63 | |||
64 | /*! | ||
65 | * \brief Set a boundary condition for a single equation to | ||
66 | * Beavers-Joseph(-Saffmann) (special case of Dirichlet b.c.). | ||
67 | */ | ||
68 | void setBeaversJoseph(const int eqIdx) | ||
69 | { | ||
70 | resetEq(eqIdx); | ||
71 | boundaryInfo_[eqIdx].isBeaversJoseph = true; | ||
72 | } | ||
73 | |||
74 | /*! | ||
75 | * \brief Returns true if an equation is used to specify a | ||
76 | * Beavers-Joseph(-Saffman) boundary condition. | ||
77 | * | ||
78 | * \param eqIdx The index of the equation | ||
79 | */ | ||
80 | bool isBeaversJoseph(const int eqIdx) const | ||
81 | { return boundaryInfo_[eqIdx].isBeaversJoseph; } | ||
82 | |||
83 | /*! | ||
84 | * \brief Returns true if some equation is used to specify a | ||
85 | * Beavers-Joseph(-Saffman) boundary condition. | ||
86 | */ | ||
87 | bool hasBeaversJoseph() const | ||
88 | { | ||
89 | for (int i = 0; i < size; ++i) | ||
90 | if (boundaryInfo_[i].isBeaversJoseph) | ||
91 | return true; | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | protected: | ||
96 | //! use bitfields to minimize the size | ||
97 | struct NavierStokesBoundaryInfo | ||
98 | { | ||
99 | bool isSymmetry : 1; | ||
100 | bool isBeaversJoseph : 1; | ||
101 | }; | ||
102 | |||
103 | std::array<NavierStokesBoundaryInfo, size> boundaryInfo_; | ||
104 | }; | ||
105 | |||
106 | } // end namespace Dumux | ||
107 | |||
108 | #endif | ||
109 |