16 namespace ShallowWaterInitialStates
24 template <
typename Description,
int dim,
typename Number>
34 const std::string subsection)
36 , hyperbolic_system_(hyperbolic_system)
38 dealii::ParameterAcceptor::parse_parameters_call_back.connect(
41 which_case_ =
"transcritical";
42 this->add_parameter(
"flow type",
44 "Either 'transcritical' flow with shock "
45 "or 'subsonic' flow.");
50 AssertThrow(which_case_ ==
"subsonic" || which_case_ ==
"transcritical",
51 dealii::ExcMessage(
"Flow type must be 'transcritical' "
57 const auto view = hyperbolic_system_.template view<dim, Number>();
58 const auto g = view.gravity();
60 const auto x = point[0];
63 const Number xM = 10.;
64 const Number xS = 11.7;
65 const Number zM = 0.2;
66 Number h_inflow = 0.28205279813802181;
67 Number q_inflow = 0.18;
69 zM + 1.5 *
ryujin::pow(q_inflow * q_inflow / g, Number(1. / 3.));
73 if (which_case_ ==
"subsonic") {
76 cBer =
std::pow(q_inflow / h_inflow, 2) / (2. * g) + h_inflow;
80 const Number d = q_inflow * q_inflow / (2. * g);
81 const Number b = compute_bathymetry(point) - cBer;
82 const Number Q = -
std::pow(b, 2) / 9.;
83 const Number R = -(27. * d + 2. *
std::pow(b, 3)) / 54.;
84 const Number theta = acos(
ryujin::pow(-Q, Number(-1.5)) * R);
87 const Number h_initial = h_inflow - compute_bathymetry(point);
94 Number h_exact = 2. * std::sqrt(-Q) * cos(theta / 3.) - b / 3.;
95 if (which_case_ ==
"transcritical") {
96 if (xM <= x && x < xS) {
97 h_exact = 2. * std::sqrt(-Q) *
98 cos((4. * dealii::numbers::PI + theta) / 3.) -
101 h_exact = 0.28205279813802181;
110 initial_precomputed_type
final
113 return {compute_bathymetry(point)};
119 DEAL_II_ALWAYS_INLINE
120 inline Number compute_bathymetry(
const dealii::Point<dim> &point)
const
122 const auto x = point[0];
124 const Number bump = Number(0.2 / 64.) *
std::pow(x - Number(8.), 3) *
128 if (8. <= x && x <= 12.)
133 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