ryujin 2.1.1 revision 46bf70e400e423a8ffffe8300887eeb35b8dfb2c
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
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 Contrast : 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 Contrast(const HyperbolicSystem &hyperbolic_system,
34 const std::string subsection)
35 : InitialState<Description, dim, Number>("contrast", subsection)
36 , hyperbolic_system_(hyperbolic_system)
37 {
38 primitive_left_[0] = 1.;
39 primitive_left_[1] = 0.0;
40 this->add_parameter("primitive state left",
41 primitive_left_,
42 "Initial 1d primitive state (h, u) on the left");
43
44 primitive_right_[0] = 1.;
45 primitive_right_[1] = 0.0;
46 this->add_parameter("primitive state right",
47 primitive_right_,
48 "Initial 1d primitive state (h, u) on the right");
49 }
50
51 state_type compute(const dealii::Point<dim> &point, Number /*t*/) final
52 {
53 const auto view = hyperbolic_system_.template view<dim, Number>();
54 const auto temp = point[0] > 0. ? primitive_right_ : primitive_left_;
55 return view.from_initial_state(temp);
56 }
57
58 private:
59 const HyperbolicSystem &hyperbolic_system_;
60
61 dealii::Tensor<1, 2, Number> primitive_left_;
62 dealii::Tensor<1, 2, Number> primitive_right_;
63 };
64 } // namespace ShallowWaterInitialStates
65} // 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:34