55 const std::string &subsection)
58 , hyperbolic_system_(hyperbolic_system)
61 if constexpr (!View::have_gamma) {
62 this->add_parameter(
"gamma", gamma_,
"The ratio of specific heats");
66 this->add_parameter(
"velocity galilean frame",
68 "Velocity used to apply a Galilean transformation "
69 "to the otherwise stationary solution");
73 "velocity left", velocity_left_,
"Left limit velocity");
75 velocity_right_ = 7. / 27.;
77 "velocity right", velocity_right_,
"Right limit velocity");
81 "density left", density_left_,
"Left limit density");
84 this->add_parameter(
"mu", mu_,
"Shear viscosity");
88 dealii::ParameterAcceptor::parse_parameters_call_back.connect([
this]() {
89 const auto view = hyperbolic_system_.template view<dim, Number>();
91 if constexpr (View::have_gamma) {
92 gamma_ = view.gamma();
96 velocity_left_ > velocity_right_,
97 dealii::ExcMessage(
"The left limiting velocity must be greater "
98 "than the right limiting velocity"));
100 AssertThrow(velocity_left_ > 0.,
102 "The left limiting velocity must be positive"));
108 const double velocity_origin =
109 std::sqrt(velocity_left_ * velocity_right_);
113 const double Pr = 0.75;
114 const double factor = 2. * gamma_ / (gamma_ + 1.)
115 * mu_ / (density_left_ * velocity_left_ * Pr);
117 psi = [=,
this](
double x,
double v) {
119 velocity_left_ / (velocity_left_ - velocity_right_);
121 velocity_right_ / (velocity_left_ - velocity_right_);
122 const double log_l = std::log(velocity_left_ - v) -
123 std::log(velocity_left_ - velocity_origin);
124 const double log_r = std::log(v - velocity_right_) -
125 std::log(velocity_origin - velocity_right_);
127 const double value = factor * (c_l * log_l - c_r * log_r) - x;
129 const double derivative = factor * (-c_l / (velocity_left_ - v) -
130 c_r / (v - velocity_right_));
132 return std::make_tuple(value, derivative);
137 constexpr double tol = 1.e-12;
139 const double x_left = std::get<0>(
140 psi(0., (1. - tol) * velocity_left_ + tol * velocity_right_));
142 const double x_right = std::get<0>(
143 psi(0., tol * velocity_left_ + (1. - tol) * velocity_right_));
145 const double norm = (x_right - x_left) * tol;
149 find_velocity = [=,
this](
double x) {
152 return double(velocity_left_);
154 return double(velocity_right_);
158 0.5 * std::tanh(10. * (x - 0.5 * (x_right + x_left)) /
161 velocity_left_ * (0.5 - nu) + velocity_right_ * (nu + 0.5);
163 auto [f, df] = psi(x, v);
165 while (std::abs(f) > norm) {
166 const double v_next = v - f / df;
169 if (std::abs(v_next - v) <
170 tol * 0.5 * (velocity_right_ + velocity_left_)) {
175 if (v_next < velocity_right_)
176 v = 0.5 * (velocity_right_ + v);
177 else if (v_next > velocity_left_)
178 v = 0.5 * (velocity_left_ + v);
182 const auto [new_f, new_df] = psi(x, v);
194 const auto view = hyperbolic_system_.template view<dim, Number>();
197 const double R_infty = (gamma_ + 1) / (gamma_ - 1);
200 const double x = point[0] - velocity_ * t;
201 const double v = find_velocity(x);
202 Assert(v >= velocity_right_, dealii::ExcInternalError());
203 Assert(v <= velocity_left_, dealii::ExcInternalError());
204 const double rho = density_left_ * velocity_left_ / v;
205 Assert(rho > 0., dealii::ExcInternalError());
206 const double e = 1. / (2. * gamma_) *
207 (R_infty * velocity_left_ * velocity_right_ - v * v);
208 Assert(e > 0., dealii::ExcInternalError());
210 using state_type_1d =
213 state_type_1d result;
214 result[0] = Number(rho);
215 result[1] = Number(rho * (velocity_ + v));
216 if constexpr (View::have_energy_equation)
218 Number(rho * (e + 0.5 * (velocity_ + v) * (velocity_ + v)));
220 return view.expand_state(result);