ryujin 2.5.0 revision c64172211cf21344cb9b9b0f3a1266aa6400d392
Loading...
Searching...
No Matches
initial_state_uniform.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2022 - 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 {
24 template <typename Description, int dim, typename Number>
25 class Uniform : public InitialState<Description, dim, Number>
26 {
27 public:
28 using HyperbolicSystem = typename Description::HyperbolicSystem;
29 using View = typename HyperbolicSystem::template View<dim, Number>;
30 using state_type = typename View::state_type;
32 typename HyperbolicSystem::template View<1, Number>::state_type;
33
34 Uniform(const HyperbolicSystem &hyperbolic_system,
35 const std::string subsection)
36 : InitialState<Description, dim, Number>("uniform", subsection)
37 , hyperbolic_system_(hyperbolic_system)
38 {
39 primitive_[0] = 1.4;
40 primitive_[1] = 3.;
41 if constexpr (View::have_energy_equation)
42 primitive_[2] = 1.;
43 this->add_parameter("primitive state",
44 primitive_,
45 "1d primitive state [rho, u, p] (or [rho, u] for "
46 "the barotropic Euler module)");
47
48 const auto convert_states = [&]() {
49 const auto view = hyperbolic_system_.template view<dim, Number>();
50 state_ = view.from_initial_state(primitive_);
51 };
52 this->parse_parameters_call_back.connect(convert_states);
53 convert_states();
54 }
55
56 state_type compute(const dealii::Point<dim> & /*point*/,
57 Number /*t*/) final
58 {
59 return state_;
60 }
61
62 private:
63 const HyperbolicSystem &hyperbolic_system_;
64
65 state_type_1d primitive_;
66
67 state_type state_;
68 };
69 } // namespace EulerInitialStates
70} // namespace ryujin
typename HyperbolicSystem::template View< dim, Number > View
state_type compute(const dealii::Point< dim > &, Number) final
Uniform(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
typename HyperbolicSystem::template View< 1, Number >::state_type state_type_1d
typename Description::HyperbolicSystem HyperbolicSystem