ryujin 2.1.1 revision 863a4d36dcc743d4e1a9b41cfabd03d0aea57863
initial_state_radial_contrast.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2022 - 2024 by the ryujin authors
4//
5
6#pragma once
7
9
10namespace ryujin
11{
12 namespace EulerInitialStates
13 {
28 template <typename Description, int dim, typename Number>
29 class RadialContrast : public InitialState<Description, dim, Number>
30 {
31 public:
33 using View =
34 typename Description::template HyperbolicSystemView<dim, Number>;
35 using state_type = typename View::state_type;
36
37 RadialContrast(const HyperbolicSystem &hyperbolic_system,
38 const std::string &subsection)
39 : InitialState<Description, dim, Number>("radial contrast",
40 subsection)
41 , hyperbolic_system_(hyperbolic_system)
42 {
43 primitive_inner_[0] = 1.4;
44 primitive_inner_[1] = 0.0;
45 primitive_inner_[2] = 1.;
46 this->add_parameter(
47 "primitive state inner",
48 primitive_inner_,
49 "Initial 1d primitive state (rho, u, p) on the inner disk");
50
51 primitive_outer_[0] = 1.4;
52 primitive_outer_[1] = 0.0;
53 primitive_outer_[2] = 1.;
54 this->add_parameter(
55 "primitive state outer",
56 primitive_outer_,
57 "Initial 1d primitive state (rho, u, p) on the outer annulus");
58
59 radius_ = 0.5;
60 this->add_parameter("radius", radius_, "Radius of radial area");
61
62 const auto convert_states = [&]() {
63 const auto view = hyperbolic_system_.template view<dim, Number>();
64 state_inner_ = view.from_initial_state(primitive_inner_);
65 state_outer_ = view.from_initial_state(primitive_outer_);
66 };
67 this->parse_parameters_call_back.connect(convert_states);
68 convert_states();
69 }
70
71 auto compute(const dealii::Point<dim> &point, Number /*t*/)
72 -> state_type final
73 {
74 return (point.norm() > radius_ ? state_outer_ : state_inner_);
75 }
76
77 private:
78 const HyperbolicSystem &hyperbolic_system_;
79
80 dealii::Tensor<1, 3, Number> primitive_inner_;
81 dealii::Tensor<1, 3, Number> primitive_outer_;
82 double radius_;
83
84 state_type state_inner_;
85 state_type state_outer_;
86 };
87 } // namespace EulerInitialStates
88} // namespace ryujin
RadialContrast(const HyperbolicSystem &hyperbolic_system, const std::string &subsection)
typename Description::template HyperbolicSystemView< dim, Number > View
typename Description::HyperbolicSystem HyperbolicSystem
auto compute(const dealii::Point< dim > &point, Number) -> state_type final
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32