version 3.10-dev
freeflow/navierstokes/boundarytypes.hh
Go to the documentation of this file.
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//
12#ifndef FREEFLOW_NAVIERSTOKES_BOUNDARY_TYPES_HH
13#define FREEFLOW_NAVIERSTOKES_BOUNDARY_TYPES_HH
14
17
18namespace Dumux {
19
24template <int numEq>
26{
28
29public:
31 {
32 for (int eqIdx=0; eqIdx < numEq; ++eqIdx)
33 resetEq(eqIdx);
34 }
35
39 void resetEq(const int eqIdx)
40 {
42
43 boundaryInfo_[eqIdx].isSymmetry = false;
44 boundaryInfo_[eqIdx].isBeaversJoseph = false;
45 boundaryInfo_[eqIdx].isOutflow = false;
46 }
47
52 {
53 for (int eqIdx=0; eqIdx < numEq; ++eqIdx)
54 {
55 resetEq(eqIdx);
56 boundaryInfo_[eqIdx].isSymmetry = true;
57 }
58 }
59
63 bool isSymmetry() const
64 { return boundaryInfo_[0].isSymmetry; }
65
69 template<class T = void>
71 {
72 static_assert(AlwaysFalse<T>::value, "Setting all boundary types to Dirichlet not permitted!");
73 }
74
78 template<class T = void>
80 {
81 static_assert(AlwaysFalse<T>::value, "Setting all boundary types to Neumann not permitted!");
82 }
83
88 void setBeaversJoseph(const int eqIdx)
89 {
90 resetEq(eqIdx);
91 boundaryInfo_[eqIdx].isBeaversJoseph = true;
92 }
93
100 bool isBeaversJoseph(const int eqIdx) const
101 { return boundaryInfo_[eqIdx].isBeaversJoseph; }
102
107 bool hasBeaversJoseph() const
108 {
109 for (int i = 0; i < numEq; ++i)
111 return true;
112 return false;
113 }
114
118 void setOutflow(const int eqIdx)
119 {
120 resetEq(eqIdx);
121 boundaryInfo_[eqIdx].isOutflow = true;
122 }
123
128 bool isOutflow(const int eqIdx) const
129 { return boundaryInfo_[eqIdx].isOutflow; }
130
134 bool hasOutflow() const
135 {
136 for (int i = 0; i < numEq; ++i)
138 return true;
139 return false;
140 }
141
142protected:
145 {
146 bool isSymmetry : 1;
147 bool isOutflow : 1;
149 };
150
151 std::array<NavierStokesBoundaryInfo, numEq> boundaryInfo_;
152};
153
154} // end namespace Dumux
155
156#endif
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:26
void resetEq(int eqIdx)
Reset the boundary types for one equation.
Definition: common/boundarytypes.hh:51
Class to specify the type of a boundary condition for the Navier-Stokes model.
Definition: freeflow/navierstokes/boundarytypes.hh:26
void setAllSymmetry()
Sets a symmetry boundary condition for all equations.
Definition: freeflow/navierstokes/boundarytypes.hh:51
void resetEq(const int eqIdx)
Reset the boundary types for one equation.
Definition: freeflow/navierstokes/boundarytypes.hh:39
bool hasBeaversJoseph() const
Returns true if some equation is used to specify a Beavers-Joseph(-Saffman) boundary condition.
Definition: freeflow/navierstokes/boundarytypes.hh:107
void setAllNeumann()
Prevent setting all boundary conditions to Neumann.
Definition: freeflow/navierstokes/boundarytypes.hh:79
std::array< NavierStokesBoundaryInfo, numEq > boundaryInfo_
Definition: freeflow/navierstokes/boundarytypes.hh:151
bool isOutflow(const int eqIdx) const
Returns true if an outflow boundary condition was set.
Definition: freeflow/navierstokes/boundarytypes.hh:128
NavierStokesBoundaryTypes()
Definition: freeflow/navierstokes/boundarytypes.hh:30
void setOutflow(const int eqIdx)
Set an outflow boundary condition.
Definition: freeflow/navierstokes/boundarytypes.hh:118
void setBeaversJoseph(const int eqIdx)
Set a boundary condition for a single equation to Beavers-Joseph(-Saffmann) (special case of Dirichle...
Definition: freeflow/navierstokes/boundarytypes.hh:88
void setAllDirichlet()
Prevent setting all boundary conditions to Dirichlet.
Definition: freeflow/navierstokes/boundarytypes.hh:70
bool isSymmetry() const
Returns true if the there is a symmetry boundary condition.
Definition: freeflow/navierstokes/boundarytypes.hh:63
bool isBeaversJoseph(const int eqIdx) const
Returns true if an equation is used to specify a Beavers-Joseph(-Saffman) boundary condition.
Definition: freeflow/navierstokes/boundarytypes.hh:100
bool hasOutflow() const
Returns true if some equation has an outflow boundary condition.
Definition: freeflow/navierstokes/boundarytypes.hh:134
Class to specify the type of a boundary.
Type traits.
Definition: adapt.hh:17
Template which always yields a false value.
Definition: common/typetraits/typetraits.hh:24
use bitfields to minimize the size
Definition: freeflow/navierstokes/boundarytypes.hh:145
bool isBeaversJoseph
Definition: freeflow/navierstokes/boundarytypes.hh:148
bool isSymmetry
Definition: freeflow/navierstokes/boundarytypes.hh:146
bool isOutflow
Definition: freeflow/navierstokes/boundarytypes.hh:147