ryujin 2.1.1 revision 863a4d36dcc743d4e1a9b41cfabd03d0aea57863
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 - 2024 by the ryujin authors
4//
5
6#pragma once
7
9
10namespace ryujin
11{
12 namespace EulerInitialStates
13 {
23 template <typename Description, int dim, typename Number>
24 class Uniform : public InitialState<Description, dim, Number>
25 {
26 public:
28 using View =
29 typename Description::template HyperbolicSystemView<dim, Number>;
30 using state_type = typename View::state_type;
31
32 Uniform(const HyperbolicSystem &hyperbolic_system,
33 const std::string subsection)
34 : InitialState<Description, dim, Number>("uniform", subsection)
35 , hyperbolic_system_(hyperbolic_system)
36 {
37 primitive_[0] = 1.4;
38 primitive_[1] = 3.;
39 primitive_[2] = 1.;
40 this->add_parameter("primitive state",
41 primitive_,
42 "Initial 1d primitive state (rho, u, p)");
43
44 const auto convert_states = [&]() {
45 const auto view = hyperbolic_system_.template view<dim, Number>();
46 state_ = view.from_initial_state(primitive_);
47 };
48 this->parse_parameters_call_back.connect(convert_states);
49 convert_states();
50 }
51
52 state_type compute(const dealii::Point<dim> & /*point*/,
53 Number /*t*/) final
54 {
55 return state_;
56 }
57
58 private:
59 const HyperbolicSystem &hyperbolic_system_;
60
61 dealii::Tensor<1, 3, Number> primitive_;
62
63 state_type state_;
64 };
65 } // namespace EulerInitialStates
66} // namespace ryujin
typename Description::template HyperbolicSystemView< dim, Number > View
state_type compute(const dealii::Point< dim > &, Number) final
Uniform(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
typename Description::HyperbolicSystem HyperbolicSystem
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32