ryujin 2.1.1 revision dbf0e3ba7acdb60b6d558e4257815df4a8f8daf9
initial_state_ritter_dam_break.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 {
24 template <typename Description, int dim, typename Number>
25 class RitterDamBreak : public InitialState<Description, dim, Number>
26 {
27 public:
29 using View =
30 typename Description::template HyperbolicSystemView<dim, Number>;
31 using state_type = typename View::state_type;
32
33 RitterDamBreak(const HyperbolicSystem &hyperbolic_system,
34 const std::string subsection)
35 : InitialState<Description, dim, Number>("ritter dam break",
36 subsection)
37 , hyperbolic_system_(hyperbolic_system)
38 {
39 dealii::ParameterAcceptor::parse_parameters_call_back.connect(
41
42 t_initial_ = 0.1;
43 this->add_parameter("time initial",
44 t_initial_,
45 "Time at which initial state is prescribed");
46
47 left_depth = 0.005;
48 this->add_parameter("left water depth",
49 left_depth,
50 "Depth of water to the left of pseudo-dam (x<0)");
51 }
52
54 {
55 AssertThrow(t_initial_ > 0.,
56 dealii::ExcMessage("Expansion must be computed at an "
57 "initial time greater than 0."));
58 }
59
60 state_type compute(const dealii::Point<dim> &point, Number t) final
61 {
62 const auto view = hyperbolic_system_.template view<dim, Number>();
63 const auto g = view.gravity();
64
65 const auto x = point[0];
66
67 const Number aL = std::sqrt(g * left_depth);
68 const Number xA = -(t + t_initial_) * aL;
69 const Number xB = Number(2.) * (t + t_initial_) * aL;
70
71 const Number tmp = aL - x / (2. * (t + t_initial_));
72
73 const Number h_expansion = 4. / (9. * g) * tmp * tmp;
74 const Number v_expansion = 2. / 3. * (x / (t + t_initial_) + aL);
75
76 if (x <= xA)
77 return state_type{{left_depth, Number(0.)}};
78 else if (x <= xB)
79 return state_type{{h_expansion, h_expansion * v_expansion}};
80 else
81 return state_type{{Number(0.), Number(0.)}};
82 }
83
84 /* Default bathymetry of 0 */
85
86 private:
87 const HyperbolicSystem &hyperbolic_system_;
88
89 Number t_initial_;
90 Number left_depth;
91 };
92
93 } // namespace ShallowWaterInitialStates
94} // namespace ryujin
typename Description::template HyperbolicSystemView< dim, Number > View
state_type compute(const dealii::Point< dim > &point, Number t) final
RitterDamBreak(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:34