ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
initial_state_soliton.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0
3// [LANL Copyright Statement]
4// Copyright (C) 2022 - 2024 by the ryujin authors
5// Copyright (C) 2023 - 2024 by Triad National Security, LLC
6//
7
8#pragma once
9
11
12namespace ryujin
13{
14 namespace ShallowWaterInitialStates
15 {
21 template <typename Description, int dim, typename Number>
22 class Soliton : public InitialState<Description, dim, Number>
23 {
24 public:
26 using View =
27 typename Description::template HyperbolicSystemView<dim, Number>;
28 using state_type = typename View::state_type;
29
30 Soliton(const HyperbolicSystem &hyperbolic_system,
31 const std::string subsection)
32 : InitialState<Description, dim, Number>("soliton", subsection)
33 , hyperbolic_system_(hyperbolic_system)
34 {
35 depth_ = 1;
36 this->add_parameter(
37 "still water depth", depth_, "Depth of still water");
38
39 amplitude_ = 0.1;
40 this->add_parameter("amplitude", amplitude_, "Amplitude of soliton");
41 }
42
43 state_type compute(const dealii::Point<dim> &point, Number t) final
44 {
45 const auto view = hyperbolic_system_.template view<dim, Number>();
46 const Number g = view.gravity();
47
48 const auto &x = point[0];
49
50 const Number celerity = std::sqrt(g * (amplitude_ + depth_));
51 const Number width = std::sqrt(
52 3. * amplitude_ / (4. * depth_ * depth_ * (amplitude_ + depth_)));
53 const Number sechSqd =
54 1. / std::pow(cosh(width * (x - celerity * t)), 2);
55
56 /* If there is bathymetry, take max of profile and 0 */
57 const Number profile = depth_ + amplitude_ * sechSqd;
58 const Number h = std::max(profile, Number(0.));
59
60 const Number v = celerity * (profile - depth_) / profile;
61
62 return state_type{{h, h * v}};
63 }
64
65 /* Default bathymetry of 0 */
66
67 private:
68 const HyperbolicSystem &hyperbolic_system_;
69
70 Number depth_;
71 Number amplitude_;
72 };
73
74 } // namespace ShallowWaterInitialStates
75} // namespace ryujin
state_type compute(const dealii::Point< dim > &point, Number t) final
typename Description::template HyperbolicSystemView< dim, Number > View
Soliton(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
typename Description::HyperbolicSystem HyperbolicSystem
T pow(const T x, const T b)
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32