ryujin 2.1.1 revision 0b194b984a74af675d09b5e928529ca8c7b634f2
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 auto g = view.gravity();
47
48 const auto &x = point[0];
49
50 const auto celerity = std::sqrt(g * (amplitude_ + depth_));
51 const auto width = std::sqrt(
52 3. * amplitude_ / (4. * depth_ * depth_ * (amplitude_ + depth_)));
53 const auto sechSqd = 1. / std::pow(cosh(width * (x - celerity * t)), 2);
54
55 /* If there is bathymetry, take max of profile and 0 */
56 const auto profile = depth_ + amplitude_ * sechSqd;
57 const auto h = std::max(profile, Number(0.));
58
59 const auto v = celerity * (profile - depth_) / profile;
60
61 return state_type{{h, h * v}};
62 }
63
64 /* Default bathymetry of 0 */
65
66 private:
67 const HyperbolicSystem &hyperbolic_system_;
68
69 Number depth_;
70 Number amplitude_;
71 };
72
73 } // namespace ShallowWaterInitialStates
74} // 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