14 namespace ShallowWaterInitialStates
28 template <
typename Description,
int dim,
typename Number>
38 const std::string subsection)
40 , hyperbolic_system_(hyperbolic_system)
44 "free surface radius", a_,
"Radius of the circular free surface");
48 "water height", h_0_,
"Water height at central point");
50 if constexpr (dim == 1) {
54 "paraboloid length", length_,
"Length of 1D paraboloid");
57 this->add_parameter(
"speed", B_,
"The 1D paraboloid speed");
61 this->add_parameter(
"eta", eta_,
"The eta parameter");
67 const auto view = hyperbolic_system_.template view<dim, Number>();
70 const auto z = compute_bathymetry(point);
71 const auto g = view.gravity();
72 const Number omega = std::sqrt(2. * g * h_0_) / a_;
73 const Number &x = point[0];
76 Number h, v_x, v_y = 0.;
80 if constexpr (dim == 1) {
82 const Number k = view.manning_friction_coefficient();
83 const Number p = std::sqrt(8. * g * h_0_) / a_;
84 const Number s = std::sqrt(p * p - k * k) / 2.;
87 (a_ * a_ * B_ * B_) / (8. * g * g * h_0_) * std::exp(-k * t);
88 term1 *= (1. / 4. * k * k - s * s) * std::cos(2. * s * t) -
89 s * k * sin(2. * s * t);
91 const auto term2 = -(B_ * B_ / (4. * g)) * std::exp(-k * t);
93 auto term3 = -(B_ / g) * std::exp(-1. / 2. * k * t);
94 term3 *= (s * std::cos(s * t) + 1. / 2. * k * std::sin(s * t)) *
95 (point[0] - 1. / 2. * length_);
97 auto htilde = h_0_ - compute_bathymetry(point);
98 htilde += term1 + term2 + term3;
100 h = std::max(htilde, Number(0.));
101 v_x = B_ * std::exp(-1. / 2. * k * t) * std::sin(s * t);
104 }
else if constexpr (dim == 2) {
106 const Number &y = point[1];
108 const Number elevation =
109 eta_ * h_0_ / (a_ * a_) *
110 (2. * x * std::cos(omega * t) + 2. * y * std::sin(omega * t));
112 h = std::max(elevation - z, Number(0.));
113 v_x = -eta_ * omega * std::sin(omega * t);
114 v_y = eta_ * omega * std::cos(omega * t);
119 AssertThrow(
false, dealii::ExcNotImplemented());
127 initial_precomputed_type
final
130 return {compute_bathymetry(point)};
136 DEAL_II_ALWAYS_INLINE
inline Number
137 compute_bathymetry(
const dealii::Point<dim> &point)
const
139 if constexpr (dim == 1)
140 return h_0_ / (a_ * a_) *
std::pow(point[0] - 0.5 * length_, 2);
142 return -h_0_ * (Number(1.) - point.norm_square() / (a_ * a_));
typename Description::HyperbolicSystem HyperbolicSystem
typename View::state_type state_type
Paraboloid(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
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
T pow(const T x, const T b)
Euler::HyperbolicSystem HyperbolicSystem