39 const std::string &subsection)
40 :
InitialState<Description, dim, Number>(
"four state contrast",
42 , hyperbolic_system_(hyperbolic_system)
44 primitive_bottom_left_[0] = 1.4;
45 primitive_bottom_left_[1] = 0.;
46 primitive_bottom_left_[2] = 0.;
47 if constexpr (View::have_energy_equation)
48 primitive_bottom_left_[3] = 1.;
49 this->add_parameter(
"primitive state bottom left",
50 primitive_bottom_left_,
51 "Primitive state [rho, u, v, p] on bottom left (or "
52 "[rho, u] for the barotropic Euler module)");
54 primitive_bottom_right_[0] = 1.4;
55 primitive_bottom_right_[1] = 0.;
56 primitive_bottom_right_[2] = 0.;
57 if constexpr (View::have_energy_equation)
58 primitive_bottom_right_[3] = 1.;
59 this->add_parameter(
"primitive state bottom right",
60 primitive_bottom_right_,
61 "Primitive state [rho, u, v, p] on bottom right "
62 "(or [rho, u] for the barotropic Euler module)");
64 primitive_top_left_[0] = 1.4;
65 primitive_top_left_[1] = 0.;
66 primitive_top_left_[2] = 0.;
67 if constexpr (View::have_energy_equation)
68 primitive_top_left_[3] = 1.;
69 this->add_parameter(
"primitive state top left",
71 "Primitive state [rho, u, v, p] on top left (or "
72 "[rho, u] for the barotropic Euler module)");
74 primitive_top_right_[0] = 1.4;
75 primitive_top_right_[1] = 0.;
76 primitive_top_right_[2] = 0.;
77 if constexpr (View::have_energy_equation)
78 primitive_top_right_[3] = 1.;
79 this->add_parameter(
"primitive state top right",
81 "Primitive state [rho, u, v, p] on top right (or "
82 "[rho, u] for the barotropic Euler module)");
84 const auto convert_states = [&]() {
85 const auto view = hyperbolic_system_.template view<dim, Number>();
86 if constexpr (dim != 1) {
88 view.from_initial_state(primitive_bottom_left_);
90 view.from_initial_state(primitive_bottom_right_);
91 state_top_left_ = view.from_initial_state(primitive_top_left_);
92 state_top_right_ = view.from_initial_state(primitive_top_right_);
95 this->parse_parameters_call_back.connect(convert_states);
101 if constexpr (dim == 1) {
102 AssertThrow(
false, dealii::ExcNotImplemented());
107 const auto top = point[0] >= 0. ? state_top_right_ : state_top_left_;
109 point[0] >= 0. ? state_bottom_right_ : state_bottom_left_;
110 return (point[1] >= 0. ? top : bottom);