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