ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
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 - 2025 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 = typename HyperbolicSystem::template View<dim, Number>;
34 using state_type = typename View::state_type;
36 typename HyperbolicSystem::template View<1, Number>::state_type;
37
38 AstroJet(const HyperbolicSystem &hyperbolic_system,
39 const std::string subsection)
40 : InitialState<Description, dim, Number>("astro jet", subsection)
41 , hyperbolic_system_(hyperbolic_system)
42 {
43 jet_width_ = 0.05;
44 this->add_parameter("jet width",
45 jet_width_,
46 "The width of the jet coming out of boundary");
47
48 jet_state_[0] = 5.0;
49 jet_state_[1] = 30.0;
50 if constexpr (View::have_energy_equation)
51 jet_state_[2] = 0.4127;
52 this->add_parameter(
53 "primitive jet state",
54 jet_state_,
55 "1d primitive state [rho, u, p] for jet state (or [rho, u] for "
56 "the barotropic Euler module)");
57
58 ambient_state_[0] = 5.0;
59 ambient_state_[1] = 0.0;
60 if constexpr (View::have_energy_equation)
61 ambient_state_[2] = 0.4127;
62 this->add_parameter(
63 "primitive ambient right",
64 ambient_state_,
65 "1d primitive state [rho, u, p] for ambient state (or [rho, u] for "
66 "the barotropic Euler module)");
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 jet_width_;
88
89 state_type_1d jet_state_;
90 state_type_1d ambient_state_;
91
92 state_type state_left_;
93 state_type state_right_;
94 };
95 } // namespace EulerInitialStates
96} // namespace ryujin
typename HyperbolicSystem::template View< dim, Number > View
state_type compute(const dealii::Point< dim > &point, Number) final
AstroJet(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
typename Description::HyperbolicSystem HyperbolicSystem
typename HyperbolicSystem::template View< 1, Number >::state_type state_type_1d
Euler::HyperbolicSystem HyperbolicSystem
Definition description.h:34