Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
ideal_gas_mix/MusclHancockPrimMethod.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_IDEAL_GAS_MIX_MUSCL_HANCOCK_PRIM_HPP
22 #define FUB_EQUATIONS_IDEAL_GAS_MIX_MUSCL_HANCOCK_PRIM_HPP
23 
26 
27 namespace fub {
28 namespace ideal_gas {
29 template <int Rank> struct Primitive {
30  double pressure;
31  Eigen::Array<double, Rank, 1> velocity;
32  double temperature;
33  Eigen::Array<double, Eigen::Dynamic, 1> mass_fractions;
34 };
35 
36 template <int Rank> struct PrimitiveArray {
41 };
42 
43 /// \ingroup FluxMethod
44 ///
45 /// This is a variation of the Muscl Hancock Method where the reconstruction at
46 /// the half time level is based on the primitive variables (p, u, T, Y) instead
47 /// of on conservative variables.
48 template <int Rank> class MusclHancockPrimitive {
49 public:
55 
56  explicit MusclHancockPrimitive(const IdealGasMix<Rank>& equation);
57 
58  [[nodiscard]] static constexpr int GetStencilWidth() noexcept { return 2; }
59 
60  /// Returns a stable time step estimate based on HLL signal velocities.
61  [[nodiscard]] double ComputeStableDt(span<const Complete, 4> states,
62  double dx, Direction dir) noexcept;
63 
64  /// Returns an array of stable time step estimates based on HLL signal
65  /// velocities.
67  Array1d face_fraction,
68  span<const Array1d, 4> volume_fraction,
69  double dx, Direction dir) noexcept;
70 
72  double dx, Direction dir) noexcept;
73 
75  Duration dt, double dx, Direction dir);
76 
79  double dx, Direction dir);
80 
81  void ComputeNumericFlux(ConservativeArray& flux, Array1d face_fractions,
83  span<const Array1d, 4> volume_fractions, Duration dt,
84  double dx, Direction dir);
85 
86  [[nodiscard]] const Equation& GetEquation() const noexcept {
87  return hll_.GetEquation();
88  }
89  [[nodiscard]] Equation& GetEquation() noexcept { return hll_.GetEquation(); }
90 
91 private:
99  std::array<Complete, 2> stencil_{GetEquation(), GetEquation()};
100 
106  std::array<CompleteArray, 2> stencil_array_{GetEquation(), GetEquation()};
107 };
108 
109 /// \ingroup FluxMethod
110 template <int Rank>
112 
113 extern template class MusclHancockPrimitive<1>;
114 extern template class MusclHancockPrimitive<2>;
115 extern template class MusclHancockPrimitive<3>;
116 } // namespace ideal_gas
117 
121 
122 }
123 
124 #endif
This class applies a base flux nethod on a view of states.
Definition: flux_method/FluxMethod.hpp:57
Definition: HllMethod.hpp:139
This is a variation of the Muscl Hancock Method where the reconstruction at the half time level is ba...
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:48
std::array< CompleteArray, 2 > stencil_array_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:106
Equation & GetEquation() noexcept
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:89
Primitive< Rank > dpdt
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:95
Primitive< Rank > pR
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:98
void ComputeNumericFlux(ConservativeArray &flux, Array1d face_fractions, span< const CompleteArray, 4 > stencil, span< const Array1d, 4 > volume_fractions, Duration dt, double dx, Direction dir)
Array1d ComputeStableDt(span< const CompleteArray, 4 > states, double dx, Direction dir) noexcept
PrimitiveArray< Rank > pR_array_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:105
Primitive< Rank > pL
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:96
static constexpr int GetStencilWidth() noexcept
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:58
MusclHancockPrimitive(const IdealGasMix< Rank > &equation)
void ComputeNumericFlux(ConservativeArray &flux, span< const CompleteArray, 4 > stencil, Duration dt, double dx, Direction dir)
Hll< IdealGasMix< Rank >, Signals > hll_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:93
PrimitiveArray< Rank > pM_array_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:104
Primitive< Rank > dpdx
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:94
void ComputeNumericFlux(Conservative &flux, span< const Complete, 4 > stencil, Duration dt, double dx, Direction dir)
Array1d ComputeStableDt(span< const CompleteArray, 4 > states, Array1d face_fraction, span< const Array1d, 4 > volume_fraction, double dx, Direction dir) noexcept
Returns an array of stable time step estimates based on HLL signal velocities.
double ComputeStableDt(span< const Complete, 4 > states, double dx, Direction dir) noexcept
Returns a stable time step estimate based on HLL signal velocities.
PrimitiveArray< Rank > dpdx_array_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:101
PrimitiveArray< Rank > dpdt_array_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:102
Primitive< Rank > pM
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:97
const Equation & GetEquation() const noexcept
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:86
std::array< Complete, 2 > stencil_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:99
PrimitiveArray< Rank > pL_array_
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:103
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
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
std::conditional_t< N==1||M==1, Eigen::Array< T, N, M >, Eigen::Array< T, N, M, Eigen::RowMajor > > Array
Definition: Eigen.hpp:50
Array< double, Eigen::Dynamic > ArrayXd
Definition: Eigen.hpp:57
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
This is a customization point for equations which can define two signal velocities for usage with the...
Definition: EinfeldtSignalVelocities.hpp:37
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:36
Array1d pressure
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:37
ArrayXd mass_fractions
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:40
Array1d temperature
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:39
Array< double, Rank > velocity
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:38
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:29
Eigen::Array< double, Rank, 1 > velocity
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:31
double temperature
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:32
double pressure
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:30
Eigen::Array< double, Eigen::Dynamic, 1 > mass_fractions
Definition: ideal_gas_mix/MusclHancockPrimMethod.hpp:33