ryujin 2.1.1 revision 46bf70e400e423a8ffffe8300887eeb35b8dfb2c
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
10#include <compile_time_options.h>
11
13
14namespace ryujin
15{
16 namespace ShallowWaterInitialStates
17 {
23 template <typename Description, int dim, typename Number>
24 class Soliton : public InitialState<Description, dim, Number>
25 {
26 public:
28 using View =
29 typename Description::template HyperbolicSystemView<dim, Number>;
30 using state_type = typename View::state_type;
31
32 Soliton(const HyperbolicSystem &hyperbolic_system,
33 const std::string subsection)
34 : InitialState<Description, dim, Number>("soliton", subsection)
35 , hyperbolic_system_(hyperbolic_system)
36 {
37 depth_ = 1;
38 this->add_parameter(
39 "still water depth", depth_, "Depth of still water");
40
41 amplitude_ = 0.1;
42 this->add_parameter("amplitude", amplitude_, "Amplitude of soliton");
43 }
44
45 state_type compute(const dealii::Point<dim> &point, Number t) final
46 {
47 const auto view = hyperbolic_system_.template view<dim, Number>();
48 const Number g = view.gravity();
49
50 const auto &x = point[0];
51
52 const Number celerity = std::sqrt(g * (amplitude_ + depth_));
53 const Number width = std::sqrt(
54 3. * amplitude_ / (4. * depth_ * depth_ * (amplitude_ + depth_)));
55 const Number sechSqd =
56 1. / std::pow(cosh(width * (x - celerity * t)), 2);
57
58 /* If there is bathymetry, take max of profile and 0 */
59 const Number profile = depth_ + amplitude_ * sechSqd;
60 const Number h = std::max(profile, Number(0.));
61
62 const Number v = celerity * (profile - depth_) / profile;
63
64 return state_type{{h, h * v}};
65 }
66
67 /* Default bathymetry of 0 */
68
69 private:
70 const HyperbolicSystem &hyperbolic_system_;
71
72 Number depth_;
73 Number amplitude_;
74 };
75
76 } // namespace ShallowWaterInitialStates
77} // 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:34