ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
initial_state_hou_test.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0
3// [LANL Copyright Statement]
4// Copyright (C) 2023 - 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
14#include <deal.II/base/function_parser.h>
15
16namespace ryujin
17{
18 namespace ShallowWaterInitialStates
19 {
25 template <typename Description, int dim, typename Number>
26 class HouTest : public InitialState<Description, dim, Number>
27 {
28 public:
30 using View = typename HyperbolicSystem::template View<dim, Number>;
31 using state_type = typename View::state_type;
32
33 HouTest(const HyperbolicSystem &hyperbolic_system, const std::string s)
34 : InitialState<Description, dim, Number>("hou test", s)
35 , hyperbolic_system(hyperbolic_system)
36 {
37 depth_ = 35;
38 this->add_parameter("reservoir water depth",
39 depth_,
40 "Depth of water in reservoir behind dam");
41 }
42
43 state_type compute(const dealii::Point<dim> &point, Number /*t*/) final
44 {
45 if constexpr (dim == 1) {
46 AssertThrow(false, dealii::ExcNotImplemented());
47 __builtin_trap();
48
49 } else {
50 const Number x = point[0];
51
52 const Number bath = compute_bathymetry(point);
53
54 /* Set water depth behind resevoir */
55 Number h = 0.;
56 if (x < -100.)
57 h = std::max(depth_ - bath, Number(0.));
58
59 return state_type{{h, 0.}};
60 }
61 }
62
63 auto initial_precomputations(const dealii::Point<dim> &point) ->
65 initial_precomputed_type final
66 {
67 /* Compute bathymetry: */
68 return {compute_bathymetry(point)};
69 }
70
71 private:
72 const HyperbolicSystem &hyperbolic_system;
73 Number depth_;
74
75 DEAL_II_ALWAYS_INLINE inline Number
76 compute_bathymetry(const dealii::Point<dim> &point) const
77 {
78 const Number x = point[0];
79 const Number y = point[1];
80
81 Number base;
82 {
83 Number base1 = std::pow(x + 250., 2) / 1600. + std::pow(y, 2) / 400.;
84 Number base2 = std::pow(x, 2) / 225. + std::pow(y - 50., 2) / 225.;
85 Number base3 =
86 std::pow(x - 250., 2) / 1225. + std::pow(y, 2) / 225. - 10.;
87
88 base = std::min(base1, base2);
89 base = std::min(base, base3);
90 }
91
92 Number bumps;
93 {
94 Number bump1 =
95 80. - std::pow(x + 250., 2) / 50. - std::pow(y, 2) / 50.;
96
97 Number bump2 = (std::pow(x - 200., 2) + std::pow(y + 10., 2) <= 1000.)
98 ? 10.
99 : 0.;
100 Number bump3 = (std::abs(x - 380.) <= 40. && std::abs(y - 50.) <= 40.)
101 ? 20.
102 : 0.;
103
104 bumps = std::max(bump1, bump2);
105 bumps = std::max(bumps, bump3);
106 }
107 return std::max(base, bumps);
108 }
109 };
110
111 } // namespace ShallowWaterInitialStates
112} // namespace ryujin
typename Description::HyperbolicSystem HyperbolicSystem
HouTest(const HyperbolicSystem &hyperbolic_system, const std::string s)
typename HyperbolicSystem::template View< dim, Number > View
auto initial_precomputations(const dealii::Point< dim > &point) -> typename InitialState< Description, dim, Number >::initial_precomputed_type final
state_type compute(const dealii::Point< dim > &point, Number) final
Euler::HyperbolicSystem HyperbolicSystem
Definition description.h:34