ryujin 2.1.1 revision 3913ebe5e1d74c8fef21bcd286906a244031ce08
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
8#include <compile_time_options.h>
9
11
12namespace ryujin
13{
14 namespace EulerInitialStates
15 {
28 template <typename Description, int dim, typename Number>
29 class AstroJet : 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 AstroJet(const HyperbolicSystem &hyperbolic_system,
38 const std::string subsection)
39 : InitialState<Description, dim, Number>("astro jet", subsection)
40 , hyperbolic_system_(hyperbolic_system)
41 {
42 gamma_ = 5. / 3.;
43 if constexpr (!View::have_gamma) {
44 this->add_parameter("gamma", gamma_, "The ratio of specific heats");
45 }
46
47 jet_width_ = 0.05;
48 this->add_parameter("jet width",
49 jet_width_,
50 "The width of the jet coming out of boundary");
51
52 jet_state_[0] = 5.0;
53 jet_state_[1] = 30.0;
54 jet_state_[2] = 0.4127;
55 this->add_parameter(
56 "primitive jet state",
57 jet_state_,
58 "Initial primitive state (rho, u, p) for jet state");
59
60 ambient_state_[0] = 5.0;
61 ambient_state_[1] = 0.0;
62 ambient_state_[2] = 0.4127;
63 this->add_parameter(
64 "primitive ambient right",
65 ambient_state_,
66 "Initial primitive state (rho, u, p) for ambient state");
67
68 const auto convert_states = [&]() {
69 const auto view = hyperbolic_system_.template view<dim, Number>();
70 state_left_ = view.from_initial_state(jet_state_);
71 state_right_ = view.from_initial_state(ambient_state_);
72 };
73 this->parse_parameters_call_back.connect(convert_states);
74 convert_states();
75 }
76
77 state_type compute(const dealii::Point<dim> &point, Number /*t*/) final
78 {
79 return (point[0] < 1.e-12 && std::abs(point[1]) <= jet_width_
80 ? state_left_
81 : state_right_);
82 }
83
84 private:
85 const HyperbolicSystem &hyperbolic_system_;
86
87 Number gamma_;
88 Number jet_width_;
89
90 dealii::Tensor<1, 3, Number> jet_state_;
91 dealii::Tensor<1, 3, Number> ambient_state_;
92
93 state_type state_left_;
94 state_type state_right_;
95 };
96 } // namespace EulerInitialStates
97} // 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:34