10#include <compile_time_options.h>
18 namespace ShallowWaterInitialStates
26 template <
typename Description,
int dim,
typename Number>
36 const std::string subsection)
38 , hyperbolic_system_(hyperbolic_system)
40 dealii::ParameterAcceptor::parse_parameters_call_back.connect(
43 which_case_ =
"transcritical";
44 this->add_parameter(
"flow type",
46 "Either 'transcritical' flow with shock "
47 "or 'subsonic' flow.");
52 AssertThrow(which_case_ ==
"subsonic" || which_case_ ==
"transcritical",
53 dealii::ExcMessage(
"Flow type must be 'transcritical' "
59 const auto view = hyperbolic_system_.template view<dim, Number>();
60 const auto g = view.gravity();
62 const auto x = point[0];
65 const Number xM = 10.;
66 const Number xS = 11.7;
67 const Number zM = 0.2;
68 Number h_inflow = 0.28205279813802181;
69 Number q_inflow = 0.18;
71 zM + 1.5 *
ryujin::pow(q_inflow * q_inflow / g, Number(1. / 3.));
75 if (which_case_ ==
"subsonic") {
78 cBer =
std::pow(q_inflow / h_inflow, 2) / (2. * g) + h_inflow;
82 const Number d = q_inflow * q_inflow / (2. * g);
83 const Number b = compute_bathymetry(point) - cBer;
84 const Number Q = -
std::pow(b, 2) / 9.;
85 const Number R = -(27. * d + 2. *
std::pow(b, 3)) / 54.;
86 const Number theta = acos(
ryujin::pow(-Q, Number(-1.5)) * R);
89 const Number h_initial = h_inflow - compute_bathymetry(point);
96 Number h_exact = 2. * std::sqrt(-Q) * cos(theta / 3.) - b / 3.;
97 if (which_case_ ==
"transcritical") {
98 if (xM <= x && x < xS) {
99 h_exact = 2. * std::sqrt(-Q) *
100 cos((4. * dealii::numbers::PI + theta) / 3.) -
103 h_exact = 0.28205279813802181;
112 initial_precomputed_type
final
115 return {compute_bathymetry(point)};
121 DEAL_II_ALWAYS_INLINE
122 inline Number compute_bathymetry(
const dealii::Point<dim> &point)
const
124 const auto x = point[0];
126 const Number bump = Number(0.2 / 64.) *
std::pow(x - Number(8.), 3) *
130 if (8. <= x && x <= 12.)
135 std::string which_case_;
typename View::state_type state_type
typename Description::HyperbolicSystem HyperbolicSystem
state_type compute(const dealii::Point< dim > &point, Number t) final
typename Description::template HyperbolicSystemView< dim, Number > View
auto initial_precomputations(const dealii::Point< dim > &point) -> typename InitialState< Description, dim, Number >::initial_precomputed_type final
void parse_parameters_callback()
FlowOverBump(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
T pow(const T x, const T b)
Euler::HyperbolicSystem HyperbolicSystem