32 const std::string subsection)
35 , hyperbolic_system_(hyperbolic_system)
37 dealii::ParameterAcceptor::parse_parameters_call_back.connect(
42 this->add_parameter(
"flow state left",
44 "Initial 1d flow state (h, q) on the left");
47 state_right_[1] = 0.0;
48 this->add_parameter(
"flow state right",
50 "Initial 1d flow state (h, q) on the right");
53 this->add_parameter(
"experimental configuration",
55 "Either 'G1', 'G2', 'G3' or 'none' for bathymetry "
62 which_case_ ==
"G1" || which_case_ ==
"G2" || which_case_ ==
"G3" ||
63 which_case_ ==
"none",
64 dealii::ExcMessage(
"Case must be 'G1', 'G2', 'G3' or 'none'"));
69 const auto view = hyperbolic_system_.template view<dim, Number>();
71 if constexpr (dim == 1) {
72 AssertThrow(
false, dealii::ExcNotImplemented());
76 const auto temp = point[0] > 1.e-8 ? state_right_ : state_left_;
77 return view.expand_state(temp);
82 initial_precomputed_type
final
85 return {compute_bathymetry(point)};
92 inline Number compute_bathymetry(
const dealii::Point<dim> &point)
const
94 const auto &x = point[0], &y = point[1];
98 if (x >= 0. && x <= 326. / 100.)
100 else if (x > 326. / 100.)
101 bath = -0.0404 * (x - 326. / 100.) - 0.00092 * 326. / 100.;
103 if (which_case_ ==
"none")
107 Number obstacle = 0.;
111 if (which_case_ ==
"G1") {
113 Number obstacle_length = 16.3 / 100.;
114 Number obstacle_width = 8. / 100.;
116 Number xc = 205. / 100. + (16.3 / 2. / 100.);
118 if (std::abs((x - xc) / obstacle_length + y / obstacle_width) +
119 std::abs((x - xc) / obstacle_length - y / obstacle_width) <=
121 obstacle = 7. / 100.;
122 }
else if (which_case_ ==
"G2") {
125 double xc = 184.5 / 100. + 31. / 2. / 100.;
126 const double radicand =
127 positive_part(1. - std::pow((x - xc) / (31. / 2. / 100.), 2));
129 const double semi_circle = 7.3 / 100. * std::sqrt(radicand);
131 obstacle = std::max(semi_circle, 0.);
134 double obstacle_length = 16.3 / 100.;
135 double obstacle_width = 8. / 100.;
137 xc = 235. / 100. + (16.3 / 2. / 100.);
139 if (std::abs((x - xc) / obstacle_length + y / obstacle_width) +
140 std::abs((x - xc) / obstacle_length - y / obstacle_width) <=
142 obstacle = 7. / 100.;
143 }
else if (which_case_ ==
"G3") {
146 double xc = 194 / 100. + 31. / 2. / 100.;
147 const double radicand =
148 positive_part(1. - std::pow((x - xc) / (31. / 2. / 100.), 2));
149 const double semi_circle = 7.3 / 100. * std::sqrt(radicand);
151 if (y < semi_circle - 24. / 2. / 100. &&
152 std::abs(x - xc) <= 31. / 2. / 100.)
153 obstacle = 21. / 100.;
155 if (y > -semi_circle + 24. / 2. / 100. &&
156 std::abs(x - xc) <= 31. / 2. / 100.)
157 obstacle = 21. / 100.;
160 double obstacle_length = 16.3 / 100.;
161 double obstacle_width = 8. / 100.;
163 xc = 235. / 100. + (16.3 / 2. / 100.);
165 if (std::abs((x - xc) / obstacle_length + y / obstacle_width) +
166 std::abs((x - xc) / obstacle_length - y / obstacle_width) <=
168 obstacle = 7. / 100.;
171 return bath + obstacle;
174 dealii::Tensor<1, 2, Number> state_left_;
175 dealii::Tensor<1, 2, Number> state_right_;
177 std::string which_case_;
178 std::string flow_type_;