14 namespace ShallowWaterInitialStates
21 template <
typename Description,
int dim,
typename Number>
31 const std::string subsection)
34 , hyperbolic_system_(hyperbolic_system)
36 dealii::ParameterAcceptor::parse_parameters_call_back.connect(
41 this->add_parameter(
"flow state left",
43 "Initial 1d flow state (h, q) on the left");
46 state_right_[1] = 0.0;
47 this->add_parameter(
"flow state right",
49 "Initial 1d flow state (h, q) on the right");
52 this->add_parameter(
"experimental configuration",
54 "Either 'G1', 'G2', 'G3' or 'none' for bathymetry "
61 which_case_ ==
"G1" || which_case_ ==
"G2" || which_case_ ==
"G3" ||
62 which_case_ ==
"none",
63 dealii::ExcMessage(
"Case must be 'G1', 'G2', 'G3' or 'none'"));
68 const auto view = hyperbolic_system_.template view<dim, Number>();
70 if constexpr (dim == 1) {
71 AssertThrow(
false, dealii::ExcNotImplemented());
75 const auto temp = point[0] > 1.e-8 ? state_right_ : state_left_;
76 return view.expand_state(temp);
81 initial_precomputed_type
final
84 return {compute_bathymetry(point)};
91 inline Number compute_bathymetry(
const dealii::Point<dim> &point)
const
93 const auto &x = point[0], &y = point[1];
97 if (x >= 0. && x <= 326. / 100.)
99 else if (x > 326. / 100.)
100 bath = -0.0404 * (x - 326. / 100.) - 0.00092 * 326. / 100.;
102 if (which_case_ ==
"none")
106 Number obstacle = 0.;
110 if (which_case_ ==
"G1") {
112 Number obstacle_length = 16.3 / 100.;
113 Number obstacle_width = 8. / 100.;
115 Number xc = 205. / 100. + (16.3 / 2. / 100.);
117 if (std::abs((x - xc) / obstacle_length + y / obstacle_width) +
118 std::abs((x - xc) / obstacle_length - y / obstacle_width) <=
120 obstacle = 7. / 100.;
121 }
else if (which_case_ ==
"G2") {
124 double xc = 184.5 / 100. + 31. / 2. / 100.;
125 const double radicand =
128 const double semi_circle = 7.3 / 100. * std::sqrt(radicand);
130 obstacle = std::max(semi_circle, 0.);
133 double obstacle_length = 16.3 / 100.;
134 double obstacle_width = 8. / 100.;
136 xc = 235. / 100. + (16.3 / 2. / 100.);
138 if (std::abs((x - xc) / obstacle_length + y / obstacle_width) +
139 std::abs((x - xc) / obstacle_length - y / obstacle_width) <=
141 obstacle = 7. / 100.;
142 }
else if (which_case_ ==
"G3") {
145 double xc = 194 / 100. + 31. / 2. / 100.;
146 const double radicand =
148 const double semi_circle = 7.3 / 100. * std::sqrt(radicand);
150 if (y < semi_circle - 24. / 2. / 100. &&
151 std::abs(x - xc) <= 31. / 2. / 100.)
152 obstacle = 21. / 100.;
154 if (y > -semi_circle + 24. / 2. / 100. &&
155 std::abs(x - xc) <= 31. / 2. / 100.)
156 obstacle = 21. / 100.;
159 double obstacle_length = 16.3 / 100.;
160 double obstacle_width = 8. / 100.;
162 xc = 235. / 100. + (16.3 / 2. / 100.);
164 if (std::abs((x - xc) / obstacle_length + y / obstacle_width) +
165 std::abs((x - xc) / obstacle_length - y / obstacle_width) <=
167 obstacle = 7. / 100.;
170 return bath + obstacle;
173 dealii::Tensor<1, 2, Number> state_left_;
174 dealii::Tensor<1, 2, Number> state_right_;
176 std::string which_case_;
177 std::string flow_type_;
typename Description::template HyperbolicSystemView< dim, Number > View
auto initial_precomputations(const dealii::Point< dim > &point) -> typename InitialState< Description, dim, Number >::initial_precomputed_type final
typename View::state_type state_type
TankExperiments(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
state_type compute(const dealii::Point< dim > &point, Number) final
typename Description::HyperbolicSystem HyperbolicSystem
void parse_parameters_callback()
T pow(const T x, const T b)
DEAL_II_ALWAYS_INLINE Number positive_part(const Number number)
Euler::HyperbolicSystem HyperbolicSystem