ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
initial_state_sloping_friction.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
14#include <simd.h>
15
16namespace ryujin
17{
18 namespace ShallowWaterInitialStates
19 {
27 template <typename Description, int dim, typename Number>
28 class SlopingFriction : public InitialState<Description, dim, Number>
29 {
30 public:
32 using View = typename HyperbolicSystem::template View<dim, Number>;
33 using state_type = typename View::state_type;
34
35 SlopingFriction(const HyperbolicSystem &hyperbolic_system,
36 const std::string subsection)
37 : InitialState<Description, dim, Number>("sloping friction",
38 subsection)
39 , hyperbolic_system_(hyperbolic_system)
40 {
41 slope_ = 1.;
42 this->add_parameter(
43 "ramp slope",
44 slope_,
45 "The (positive) slope of the inclined plane used to "
46 "define the bathymetry");
47
48 q_0_ = 0.1;
49 this->add_parameter("initial discharge",
50 q_0_,
51 "The initial (unit) discharge in [m^2 / s]");
52 }
53
54 state_type compute(const dealii::Point<dim> & /*point*/,
55 Number /*t*/) final
56 {
57 const auto view = hyperbolic_system_.template view<dim, Number>();
58
59 /*
60 * Water depth profile depends on slope, discharge and Manning's
61 * coefficient. The gamma quantity in ref is fixed to 4. / 3.
62 */
63
64 const Number n = view.manning_friction_coefficient();
65 const Number exponent = 1. / (2. + 4. / 3.);
66
67 Number profile = n * n * q_0_ * q_0_ / slope_;
68 Number h = ryujin::pow(profile, exponent);
69
70 return state_type{{h, q_0_}};
71 }
72
73 auto initial_precomputations(const dealii::Point<dim> &point) ->
75 initial_precomputed_type final
76 {
77 /* Compute bathymetry: */
78 return {compute_bathymetry(point)};
79 }
80
81 private:
82 const HyperbolicSystem &hyperbolic_system_;
83
84 DEAL_II_ALWAYS_INLINE inline Number
85 compute_bathymetry(const dealii::Point<dim> &point) const
86 {
87 return -slope_ * point[0];
88 }
89
90 Number slope_;
91 Number q_0_;
92 };
93
94 } // namespace ShallowWaterInitialStates
95} // namespace ryujin
SlopingFriction(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
auto initial_precomputations(const dealii::Point< dim > &point) -> typename InitialState< Description, dim, Number >::initial_precomputed_type final
typename HyperbolicSystem::template View< dim, Number > View
state_type compute(const dealii::Point< dim > &, Number) final
DEAL_II_HOST_DEVICE T pow(const T x, const T b)
Euler::HyperbolicSystem HyperbolicSystem
Definition description.h:34