12 namespace EulerInitialStates
26 template <
typename Description,
int dim,
typename Number>
36 const std::string subsection)
38 , hyperbolic_system_(hyperbolic_system)
41 if constexpr (!View::have_gamma) {
42 this->add_parameter(
"gamma", gamma_,
"The ratio of specific heats");
45 primitive_right_[0] = 1.4;
46 primitive_right_[1] = 0.0;
47 primitive_right_[2] = 1.;
48 this->add_parameter(
"primitive state",
50 "Initial 1d primitive state (rho, u, p) before the "
51 "shock (to the right)");
57 "Mach number of shock front (S1, S3 = mach * a_L/R)");
59 const auto compute_and_convert_states = [&]() {
60 const auto view = hyperbolic_system_.template view<dim, Number>();
62 if constexpr (View::have_gamma) {
63 gamma_ = view.gamma();
69 if constexpr (View::have_eos_interpolation_b)
70 b = view.eos_interpolation_b();
72 const auto &rho_R = primitive_right_[0];
73 const auto &u_R = primitive_right_[1];
74 const auto &p_R = primitive_right_[2];
76 const Number a_R = std::sqrt(gamma_ * p_R / rho_R / (1 - b * rho_R));
77 const Number mach_R = u_R / a_R;
79 S3_ = mach_number_ * a_R;
80 const Number delta_mach = mach_R - mach_number_;
83 rho_R * (gamma_ + Number(1.)) * delta_mach * delta_mach /
84 ((gamma_ - Number(1.)) * delta_mach * delta_mach + Number(2.));
86 (Number(1.) - rho_R / rho_L) * S3_ + rho_R / rho_L * u_R;
87 const Number p_L = p_R *
88 (Number(2.) * gamma_ * delta_mach * delta_mach -
89 (gamma_ - Number(1.))) /
90 (gamma_ + Number(1.));
92 primitive_left_[0] = rho_L;
93 primitive_left_[1] = u_L;
94 primitive_left_[2] = p_L;
96 state_left_ = view.from_initial_state(primitive_left_);
97 state_right_ = view.from_initial_state(primitive_right_);
100 this->parse_parameters_call_back.connect(compute_and_convert_states);
101 compute_and_convert_states();
107 const Number position_1d = Number(point[0] - S3_ * t);
108 return (position_1d > 0. ? state_right_ : state_left_);
116 dealii::Tensor<1, 3, Number> primitive_left_;
117 dealii::Tensor<1, 3, Number> primitive_right_;
typename View::state_type state_type
typename Description::HyperbolicSystem HyperbolicSystem
typename Description::template HyperbolicSystemView< dim, Number > View
state_type compute(const dealii::Point< dim > &point, Number t) final
ShockFront(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
Euler::HyperbolicSystem HyperbolicSystem