31 const std::string subsection)
32 :
InitialState<Description, dim, Number>(
"function", subsection)
33 , hyperbolic_system_(hyperbolic_system)
35 density_expression_ =
"1.4";
36 this->add_parameter(
"density expression",
38 "A function expression describing the density");
40 velocity_x_expression_ =
"3.0";
42 "velocity x expression",
43 velocity_x_expression_,
44 "A function expression describing the x-component of the velocity");
46 if constexpr (dim > 1) {
47 velocity_y_expression_ =
"0.0";
48 this->add_parameter(
"velocity y expression",
49 velocity_y_expression_,
50 "A function expression describing the "
51 "y-component of the velocity");
54 if constexpr (dim > 2) {
55 velocity_z_expression_ =
"0.0";
56 this->add_parameter(
"velocity z expression",
57 velocity_z_expression_,
58 "A function expression describing the "
59 "z-component of the velocity");
62 if constexpr (View::have_energy_equation) {
63 pressure_expression_ =
"1.0";
64 this->add_parameter(
"pressure expression",
66 "A function expression describing the pressure");
71 const auto set_up_muparser = [
this] {
72 using FP = dealii::FunctionParser<dim>;
78 density_function_ = std::make_unique<FP>(density_expression_);
79 velocity_x_function_ = std::make_unique<FP>(velocity_x_expression_);
80 if constexpr (dim > 1)
81 velocity_y_function_ = std::make_unique<FP>(velocity_y_expression_);
82 if constexpr (dim > 2)
83 velocity_z_function_ = std::make_unique<FP>(velocity_z_expression_);
84 if constexpr (View::have_energy_equation)
85 pressure_function_ = std::make_unique<FP>(pressure_expression_);
89 this->parse_parameters_call_back.connect(set_up_muparser);
94 const auto view = hyperbolic_system_.template view<dim, Number>();
97 density_function_->set_time(t);
98 full_primitive_state[0] = density_function_->value(point);
100 velocity_x_function_->set_time(t);
101 full_primitive_state[1] = velocity_x_function_->value(point);
103 if constexpr (dim > 1) {
104 velocity_y_function_->set_time(t);
105 full_primitive_state[2] = velocity_y_function_->value(point);
107 if constexpr (dim > 2) {
108 velocity_z_function_->set_time(t);
109 full_primitive_state[3] = velocity_z_function_->value(point);
112 if constexpr (View::have_energy_equation) {
113 pressure_function_->set_time(t);
114 full_primitive_state[1 + dim] = pressure_function_->value(point);
117 return view.from_initial_state(full_primitive_state);