58 const Number &h)
const
62 const auto &[h_Z, u_Z, a_Z] = riemann_data_Z;
64 const auto left_value =
ScalarNumber(2.) * (std::sqrt(gravity * h) - a_Z);
66 const Number radicand =
68 const Number right_value = (h - h_Z) * std::sqrt(radicand);
70 return dealii::compare_and_apply_mask<
71 dealii::SIMDComparison::less_than_or_equal>(
72 h, h_Z, left_value, right_value);
81 const Number &h)
const
83 const Number &u_i = riemann_data_i[1];
84 const Number &u_j = riemann_data_j[1];
86#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
87 std::cout <<
"f_L --> " << f(riemann_data_i, h) << std::endl;
88 std::cout <<
"f_R --> " << f(riemann_data_j, h) << std::endl;
90 return f(riemann_data_i, h) + f(riemann_data_j, h) + u_j - u_i;
145 const auto gravity_inverse =
ScalarNumber(1.) / gravity;
147 const auto &[h_i, u_i, a_i] = riemann_data_i;
148 const auto &[h_j, u_j, a_j] = riemann_data_j;
150 const Number h_min = std::min(h_i, h_j);
151 const Number h_max = std::max(h_i, h_j);
153#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
154 std::cout << h_min <<
" <- h_min/max -> " << h_max << std::endl;
157 const Number a_min = std::sqrt(gravity * h_min);
158 const Number a_max = std::sqrt(gravity * h_max);
160#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
161 std::cout << a_min <<
" <- a_min/max -> " << a_max << std::endl;
167 const Number x0 = Number(9.) -
ScalarNumber(4.) * sqrt_two;
169 const Number phi_value_min =
170 phi(riemann_data_i, riemann_data_j, x0 * h_min);
171#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
172 std::cout <<
"phi_value_min ->" << phi_value_min << std::endl;
175 const Number phi_value_max =
176 phi(riemann_data_i, riemann_data_j, x0 * h_max);
177#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
178 std::cout <<
"phi_value_max ->" << phi_value_max << std::endl;
188 const Number h_star_left =
191#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
192 std::cout <<
"left: " << h_star_left << std::endl;
197 tmp = Number(1.) + sqrt_two * (u_i - u_j) / (a_min + a_max);
198 const Number h_star_middle = std::sqrt(h_min * h_max) * tmp;
200#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
201 std::cout <<
"middle: " << h_star_middle << std::endl;
206 const auto left_radicand =
210 const auto right_radicand =
211 sqrt_two * std::sqrt(gravity_inverse * h_min) * (u_i - u_j);
213 tmp = std::sqrt(
positive_part(left_radicand + right_radicand));
214 tmp -= sqrt_two * std::sqrt(h_min);
216 const Number h_star_right = tmp * tmp;
218#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
219 std::cout <<
"right: " << h_star_right << std::endl;
224 Number h_star = dealii::compare_and_apply_mask<
225 dealii::SIMDComparison::less_than_or_equal>(
226 Number(0.), phi_value_min, h_star_left, h_star_right);
229 dealii::compare_and_apply_mask<dealii::SIMDComparison::less_than>(
230 phi_value_max, Number(0.), h_star_middle, h_star_right);
239 const state_type &U,
const dealii::Tensor<1, dim, Number> &n_ij)
const
242 const Number h = view_.water_depth_sharp(U);
243 const Number gravity = view_.gravity();
245 const auto velocity = view_.momentum(U) / h;
246 const auto projected_velocity = n_ij * velocity;
247 const auto a = std::sqrt(h * gravity);
249 return {{h, projected_velocity, a}};