36 const std::string subsection)
37 :
InitialState<Description, dim, Number>(
"shock front", 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.;
51 "1d primitive state [rho, u, p] (for the Noble-Abel gas EOS) "
52 "before the shock (to the right)");
58 "Mach number of shock front (S1, S3 = mach * a_L/R)");
60 const auto compute_and_convert_states = [&]() {
61 const auto view = hyperbolic_system_.template view<dim, Number>();
63 if constexpr (View::have_gamma) {
64 gamma_ = view.gamma();
70 if constexpr (View::have_covolume_constant)
71 b = view.eos_covolume_constant();
73 const auto &rho_R = primitive_right_[0];
74 const auto &u_R = primitive_right_[1];
75 const auto &p_R = primitive_right_[2];
77 const Number a_R = std::sqrt(gamma_ * p_R / rho_R / (1 - b * rho_R));
78 const Number mach_R = u_R / a_R;
80 S3_ = mach_number_ * a_R;
81 const Number delta_mach = mach_R - mach_number_;
84 rho_R * (gamma_ + Number(1.)) * delta_mach * delta_mach /
85 ((gamma_ - Number(1.)) * delta_mach * delta_mach + Number(2.));
87 (Number(1.) - rho_R / rho_L) * S3_ + rho_R / rho_L * u_R;
88 const Number p_L = p_R *
89 (Number(2.) * gamma_ * delta_mach * delta_mach -
90 (gamma_ - Number(1.))) /
91 (gamma_ + Number(1.));
96 if constexpr (View::have_energy_equation) {
98 view.from_initial_state(state_type_1d{{rho_L, u_L, p_L}});
100 view.from_initial_state(state_type_1d{{rho_R, u_R, p_R}});
102 state_left_ = view.from_initial_state(state_type_1d{{rho_L, u_L}});
103 state_right_ = view.from_initial_state(state_type_1d{{rho_R, u_R}});
107 this->parse_parameters_call_back.connect(compute_and_convert_states);
108 compute_and_convert_states();