ryujin 2.5.0 revision c64172211cf21344cb9b9b0f3a1266aa6400d392
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 - 2026 by the ryujin authors
4//
5
6#pragma once
7
8#include <ryujin/base/compile_time_options.h>
10
11namespace ryujin
12{
13 namespace EulerInitialStates
14 {
27 template <typename Description, int dim, typename Number>
28 class AstroJet : public InitialState<Description, dim, Number>
29 {
30 public:
31 using HyperbolicSystem = typename Description::HyperbolicSystem;
32 using View = typename HyperbolicSystem::template View<dim, Number>;
33 using state_type = typename View::state_type;
35 typename HyperbolicSystem::template View<1, Number>::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 jet_width_ = 0.05;
43 this->add_parameter("jet width",
44 jet_width_,
45 "The width of the jet coming out of boundary");
46
47 jet_state_[0] = 5.0;
48 jet_state_[1] = 30.0;
49 if constexpr (View::have_energy_equation)
50 jet_state_[2] = 0.4127;
51 this->add_parameter(
52 "primitive jet state",
53 jet_state_,
54 "1d primitive state [rho, u, p] for jet state (or [rho, u] for "
55 "the barotropic Euler module)");
56
57 ambient_state_[0] = 5.0;
58 ambient_state_[1] = 0.0;
59 if constexpr (View::have_energy_equation)
60 ambient_state_[2] = 0.4127;
61 this->add_parameter(
62 "primitive ambient right",
63 ambient_state_,
64 "1d primitive state [rho, u, p] for ambient state (or [rho, u] for "
65 "the barotropic Euler module)");
66
67 const auto convert_states = [&]() {
68 const auto view = hyperbolic_system_.template view<dim, Number>();
69 state_left_ = view.from_initial_state(jet_state_);
70 state_right_ = view.from_initial_state(ambient_state_);
71 };
72 this->parse_parameters_call_back.connect(convert_states);
73 convert_states();
74 }
75
76 state_type compute(const dealii::Point<dim> &point, Number /*t*/) final
77 {
78 return (point[0] < 1.e-12 && std::abs(point[1]) <= jet_width_
79 ? state_left_
80 : state_right_);
81 }
82
83 private:
84 const HyperbolicSystem &hyperbolic_system_;
85
86 Number jet_width_;
87
88 state_type_1d jet_state_;
89 state_type_1d ambient_state_;
90
91 state_type state_left_;
92 state_type state_right_;
93 };
94 } // namespace EulerInitialStates
95} // 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