Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
perfect_gas/HllemMethod.hpp
Go to the documentation of this file.
1 // Copyright (c) 2020 Maikel Nadolski
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef FUB_EQUATIONS_PERFECT_GAS_HLLEM_HPP
22 #define FUB_EQUATIONS_PERFECT_GAS_HLLEM_HPP
23 
26 
27 namespace fub::perfect_gas {
28 
29 /// \ingroup FluxMethod
30 template <typename EulerEquation, bool Larrouturou = true> struct Hllem {
35 
36  Hllem(const EulerEquation& equation) : equation_{equation} {}
37 
38  const EulerEquation& GetEquation() const noexcept { return equation_; }
39 
40  static constexpr int GetStencilWidth() noexcept { return 1; }
41 
43  Duration dt, double dx, Direction dir);
44 
45  void ComputeNumericFlux(ConservativeArray& flux, Array1d face_fractions,
47  span<const Array1d, 2> volume_fractions, Duration dt,
48  double dx, Direction dir);
49 
52  double dx, Direction dir);
53 
54  double ComputeStableDt(span<const Complete, 2> states, double dx,
55  Direction dir);
56 
58  Direction dir);
59 
61  Array1d face_fraction, span<const Array1d, 2>,
62  double dx, Direction dir);
63 
64  void SolveRiemannProblem(Complete& solution, const Complete& left,
65  const Complete& right, Direction dir);
66 
67  EulerEquation equation_;
75 
81 };
82 
83 extern template struct Hllem<PerfectGas<1>, false>;
84 extern template struct Hllem<PerfectGas<2>, false>;
85 extern template struct Hllem<PerfectGas<3>, false>;
86 
87 extern template struct Hllem<PerfectGas<1>, true>;
88 extern template struct Hllem<PerfectGas<2>, true>;
89 extern template struct Hllem<PerfectGas<3>, true>;
90 
91 /// \ingroup FluxMethod
92 template <typename EulerEquation, bool Larrouturou = true>
94 
95 } // namespace fub::perfect_gas
96 
97 namespace fub {
98 
99 extern template class FluxMethod<perfect_gas::Hllem<PerfectGas<1>, false>>;
100 extern template class FluxMethod<perfect_gas::Hllem<PerfectGas<2>, false>>;
101 extern template class FluxMethod<perfect_gas::Hllem<PerfectGas<3>, false>>;
102 
103 extern template class FluxMethod<perfect_gas::Hllem<PerfectGas<1>, true>>;
104 extern template class FluxMethod<perfect_gas::Hllem<PerfectGas<2>, true>>;
105 extern template class FluxMethod<perfect_gas::Hllem<PerfectGas<3>, true>>;
106 
107 } // namespace fub
108 
109 #endif
This class applies a base flux nethod on a view of states.
Definition: flux_method/FluxMethod.hpp:57
A span is a view over a contiguous sequence of objects, the storage of which is owned by some other o...
Definition: span.hpp:81
Definition: perfect_gas/HllemMethod.hpp:27
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
std::chrono::duration< double > Duration
Definition: Duration.hpp:31
Array< double, 1 > Array1d
Definition: Eigen.hpp:53
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
Definition: perfect_gas/HllemMethod.hpp:30
void SolveRiemannProblem(Complete &solution, const Complete &left, const Complete &right, Direction dir)
static constexpr int GetStencilWidth() noexcept
Definition: perfect_gas/HllemMethod.hpp:40
ConservativeArray fluxR_array_
Definition: perfect_gas/HllemMethod.hpp:79
void ComputeNumericFlux(Conservative &flux, span< const Complete, 2 > stencil, Duration dt, double dx, Direction dir)
Conservative w_hllem_
Definition: perfect_gas/HllemMethod.hpp:74
Conservative flux_hlle_
Definition: perfect_gas/HllemMethod.hpp:72
Complete left_
Definition: perfect_gas/HllemMethod.hpp:68
Array1d ComputeStableDt(span< const CompleteArray, 2 > states, double dx, Direction dir)
Array1d ComputeStableDt(span< const CompleteArray, 2 > states, Array1d face_fraction, span< const Array1d, 2 >, double dx, Direction dir)
Hllem(const EulerEquation &equation)
Definition: perfect_gas/HllemMethod.hpp:36
Conservative w_hlle_
Definition: perfect_gas/HllemMethod.hpp:73
Conservative fluxR_
Definition: perfect_gas/HllemMethod.hpp:71
ConservativeArray fluxL_array_
Definition: perfect_gas/HllemMethod.hpp:78
const EulerEquation & GetEquation() const noexcept
Definition: perfect_gas/HllemMethod.hpp:38
CompleteArray left_array_
Definition: perfect_gas/HllemMethod.hpp:76
ConservativeArray flux_hlle_array_
Definition: perfect_gas/HllemMethod.hpp:80
double ComputeStableDt(span< const Complete, 2 > states, double dx, Direction dir)
CompleteArray right_array_
Definition: perfect_gas/HllemMethod.hpp:77
Conservative fluxL_
Definition: perfect_gas/HllemMethod.hpp:70
void ComputeNumericFlux(ConservativeArray &flux, Array1d face_fractions, span< const CompleteArray, 2 > stencil, span< const Array1d, 2 > volume_fractions, Duration dt, double dx, Direction dir)
EulerEquation equation_
Definition: perfect_gas/HllemMethod.hpp:67
void ComputeNumericFlux(ConservativeArray &flux, span< const CompleteArray, 2 > stencil, Duration dt, double dx, Direction dir)
Complete right_
Definition: perfect_gas/HllemMethod.hpp:69