Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
Burgers.hpp
Go to the documentation of this file.
1 
2 // Copyright (c) 2019 Maikel Nadolski
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to deal
6 // in the Software without restriction, including without limitation the rights
7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 // copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 // SOFTWARE.
21 
22 #ifndef FUB_EQUATIONS_BURGERS_HPP
23 #define FUB_EQUATIONS_BURGERS_HPP
24 
25 #include "fub/Direction.hpp"
27 #include "fub/State.hpp"
28 
32 
33 #include <array>
34 
35 namespace fub {
36 template <typename U> struct BurgersVariables { U u; };
37 
38 template <typename... Xs> struct StateTraits<BurgersVariables<Xs...>> {
39  static constexpr auto names = std::make_tuple("U");
40  static constexpr auto pointers_to_member =
41  std::make_tuple(&BurgersVariables<Xs...>::u);
42 
43  template <int Rank> using Depths = BurgersVariables<ScalarDepth>;
44 };
45 
46 struct Burgers1d {
49 
54 
55  static constexpr int Rank() { return 1; }
56 
57  Conservative Flux(Complete state, Direction dir) const noexcept;
58  ConservativeArray Flux(CompleteArray state, Direction dir) const noexcept;
59 };
60 
61 template <> class ExactRiemannSolver<Burgers1d> {
62 public:
63  using Complete = typename Burgers1d::Complete;
65 
67 
68  void SolveRiemannProblem(Complete& state, const Complete& left,
69  const Complete& right, Direction dir) const;
70 
72  const CompleteArray& right, Direction dir) const;
73 
74  std::array<double, 1> ComputeSignals(const Complete& left,
75  const Complete& right,
76  Direction dir) const;
77 
78  std::array<Array1d, 1> ComputeSignals(const CompleteArray& left,
79  const CompleteArray& right,
80  Direction dir) const;
81 };
82 
83 extern template class FluxMethod<Godunov<Burgers1d>>;
84 extern template class FluxMethod<MusclHancock<Burgers1d>>;
85 
86 } // namespace fub
87 
88 #endif
std::array< double, 1 > ComputeSignals(const Complete &left, const Complete &right, Direction dir) const
void SolveRiemannProblem(Complete &state, const Complete &left, const Complete &right, Direction dir) const
ExactRiemannSolver(const Burgers1d &)
Definition: Burgers.hpp:66
typename Burgers1d::CompleteArray CompleteArray
Definition: Burgers.hpp:64
std::array< Array1d, 1 > ComputeSignals(const CompleteArray &left, const CompleteArray &right, Direction dir) const
typename Burgers1d::Complete Complete
Definition: Burgers.hpp:63
void SolveRiemannProblem(CompleteArray &state, const CompleteArray &left, const CompleteArray &right, Direction dir) const
Definition: ExactRiemannSolver.hpp:26
This class applies a base flux nethod on a view of states.
Definition: flux_method/FluxMethod.hpp:57
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
Definition: Burgers.hpp:46
BurgersVariables< ScalarDepth > ConservativeDepths
Definition: Burgers.hpp:47
static constexpr int Rank()
Definition: Burgers.hpp:55
ConservativeArray Flux(CompleteArray state, Direction dir) const noexcept
Conservative Flux(Complete state, Direction dir) const noexcept
::fub::CompleteArray< Burgers1d > CompleteArray
Definition: Burgers.hpp:52
::fub::Complete< Burgers1d > Complete
Definition: Burgers.hpp:50
Definition: Burgers.hpp:36
U u
Definition: Burgers.hpp:36
Definition: StateArray.hpp:178
This type has a constructor which takes an equation and might allocate any dynamically sized member v...
Definition: State.hpp:335
Definition: StateArray.hpp:135
This type has a constructor which takes an equation and might allocate any dynamically sized member v...
Definition: State.hpp:251
Definition: State.hpp:35