ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
initial_state_contrast.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
11
12namespace ryujin
13{
14 namespace ShallowWaterInitialStates
15 {
22 template <typename Description, int dim, typename Number>
23 class Contrast : public InitialState<Description, dim, Number>
24 {
25 public:
27 using View =
28 typename Description::template HyperbolicSystemView<dim, Number>;
29 using state_type = typename View::state_type;
30
31 Contrast(const HyperbolicSystem &hyperbolic_system,
32 const std::string subsection)
33 : InitialState<Description, dim, Number>("contrast", subsection)
34 , hyperbolic_system_(hyperbolic_system)
35 {
36 primitive_left_[0] = 1.;
37 primitive_left_[1] = 0.0;
38 this->add_parameter("primitive state left",
39 primitive_left_,
40 "Initial 1d primitive state (h, u) on the left");
41
42 primitive_right_[0] = 1.;
43 primitive_right_[1] = 0.0;
44 this->add_parameter("primitive state right",
45 primitive_right_,
46 "Initial 1d primitive state (h, u) on the right");
47 }
48
49 state_type compute(const dealii::Point<dim> &point, Number /*t*/) final
50 {
51 const auto view = hyperbolic_system_.template view<dim, Number>();
52 const auto temp = point[0] > 0. ? primitive_right_ : primitive_left_;
53 return view.from_initial_state(temp);
54 }
55
56 private:
57 const HyperbolicSystem &hyperbolic_system_;
58
59 dealii::Tensor<1, 2, Number> primitive_left_;
60 dealii::Tensor<1, 2, Number> primitive_right_;
61 };
62 } // namespace ShallowWaterInitialStates
63} // namespace ryujin
typename Description::HyperbolicSystem HyperbolicSystem
typename Description::template HyperbolicSystemView< dim, Number > View
state_type compute(const dealii::Point< dim > &point, Number) final
Contrast(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32