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