ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
initial_state_astro_jet.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2023 - 2024 by the ryujin authors
4//
5
6#pragma once
7
9
10namespace ryujin
11{
12 namespace EulerInitialStates
13 {
26 template <typename Description, int dim, typename Number>
27 class AstroJet : public InitialState<Description, dim, Number>
28 {
29 public:
31 using View =
32 typename Description::template HyperbolicSystemView<dim, Number>;
33 using state_type = typename View::state_type;
34
35 AstroJet(const HyperbolicSystem &hyperbolic_system,
36 const std::string subsection)
37 : InitialState<Description, dim, Number>("astro jet", subsection)
38 , hyperbolic_system_(hyperbolic_system)
39 {
40 gamma_ = 5. / 3.;
41 if constexpr (!View::have_gamma) {
42 this->add_parameter("gamma", gamma_, "The ratio of specific heats");
43 }
44
45 jet_width_ = 0.05;
46 this->add_parameter("jet width",
47 jet_width_,
48 "The width of the jet coming out of boundary");
49
50 jet_state_[0] = 5.0;
51 jet_state_[1] = 30.0;
52 jet_state_[2] = 0.4127;
53 this->add_parameter(
54 "primitive jet state",
55 jet_state_,
56 "Initial primitive state (rho, u, p) for jet state");
57
58 ambient_state_[0] = 5.0;
59 ambient_state_[1] = 0.0;
60 ambient_state_[2] = 0.4127;
61 this->add_parameter(
62 "primitive ambient right",
63 ambient_state_,
64 "Initial primitive state (rho, u, p) for ambient state");
65
66 const auto convert_states = [&]() {
67 const auto view = hyperbolic_system_.template view<dim, Number>();
68 state_left_ = view.from_initial_state(jet_state_);
69 state_right_ = view.from_initial_state(ambient_state_);
70 };
71 this->parse_parameters_call_back.connect(convert_states);
72 convert_states();
73 }
74
75 state_type compute(const dealii::Point<dim> &point, Number /*t*/) final
76 {
77 return (point[0] < 1.e-12 && std::abs(point[1]) <= jet_width_
78 ? state_left_
79 : state_right_);
80 }
81
82 private:
83 const HyperbolicSystem &hyperbolic_system_;
84
85 Number gamma_;
86 Number jet_width_;
87
88 dealii::Tensor<1, 3, Number> jet_state_;
89 dealii::Tensor<1, 3, Number> ambient_state_;
90
91 state_type state_left_;
92 state_type state_right_;
93 };
94 } // namespace EulerInitialStates
95} // namespace ryujin
state_type compute(const dealii::Point< dim > &point, Number) final
AstroJet(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
typename Description::template HyperbolicSystemView< dim, Number > View
typename Description::HyperbolicSystem HyperbolicSystem
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32