14 namespace EulerInitialStates
27 template <
typename Description,
int dim,
typename Number>
37 const std::string subsection)
39 , hyperbolic_system_(hyperbolic_system)
42 if constexpr (!View::have_gamma) {
43 this->add_parameter(
"gamma", gamma_,
"The ratio of specific heats");
46 primitive_inside_[0] = 0.1;
47 primitive_inside_[1] = 0.0;
48 primitive_inside_[2] = 1.0;
50 "primitive state inside",
52 "Initial primitive state (rho, u, p) inside perturbed interface");
54 primitive_outside_[0] = 1.0;
55 primitive_outside_[1] = 0.0;
56 primitive_outside_[2] = 1.0;
58 "primitive state outside",
60 "Initial primitive state (rho, u, p) outside perturbed interface");
62 interface_radius_ = 1.0;
64 "interface radius", interface_radius_,
"Radius of interface");
67 this->add_parameter(
"number of modes",
69 "Number of modes for pertburation of interface");
73 "amplitude", amplitude_,
"Amplitude for interface pertburation");
77 "mach number", mach_number_,
"Mach number of incoming shock front");
80 this->add_parameter(
"shock radius",
82 "Radial location of incoming shock front");
84 const auto convert_states = [&]() {
85 const auto view = hyperbolic_system_.template view<dim, Number>();
86 state_inside_ = view.from_initial_state(primitive_inside_);
87 state_outside_ = view.from_initial_state(primitive_outside_);
89 this->parse_parameters_call_back.connect(convert_states);
95 const auto view = hyperbolic_system_.template view<dim, Number>();
99 const auto r_hat = point / point.norm();
102 if constexpr (View::have_eos_interpolation_b)
103 b = view.eos_interpolation_b();
105 const auto &rho_R = primitive_outside_[0];
106 const auto &u_R = primitive_outside_[1];
107 const auto &p_R = primitive_outside_[2];
109 const Number a_R = std::sqrt(gamma_ * p_R / rho_R / (1 - b * rho_R));
110 const Number mach_R = u_R / a_R;
112 auto S3_ = mach_number_ * a_R;
113 const Number delta_mach = mach_R - mach_number_;
116 rho_R * (gamma_ + Number(1.)) * delta_mach * delta_mach /
117 ((gamma_ - Number(1.)) * delta_mach * delta_mach + Number(2.));
119 (Number(1.) - rho_R / rho_L) * S3_ + rho_R / rho_L * u_R;
120 const Number p_L = p_R *
121 (Number(2.) * gamma_ * delta_mach * delta_mach -
122 (gamma_ - Number(1.))) /
123 (gamma_ + Number(1.));
126 primitive_shock_state[0] = rho_L;
128 for (
unsigned int i = 0; i < dim; ++i) {
129 primitive_shock_state[i + 1] = 0.;
132 if (point.norm() > 0.) {
133 for (
unsigned int i = 0; i < dim; ++i) {
134 primitive_shock_state[i + 1] = -u_L * r_hat[i];
137 primitive_shock_state[1 + dim] = p_L;
139 conserved_shock_state =
140 view.from_initial_state(primitive_shock_state);
144 const double angle = std::acos(std::abs(point[dim - 1]) / point.norm());
146 const auto omega = num_modes_;
147 const double perturbation = amplitude_ * std::cos(omega * angle);
150 (point.norm() > interface_radius_ + perturbation ? state_outside_
153 if (point.norm() > shock_radius_) {
154 full_state = conserved_shock_state;
166 dealii::Tensor<1, 3, Number> primitive_inside_;
167 dealii::Tensor<1, 3, Number> primitive_outside_;
171 double interface_radius_;
174 double shock_radius_;
ICFLike(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
state_type compute(const dealii::Point< dim > &point, Number) final
typename View::state_type state_type
typename Description::HyperbolicSystem HyperbolicSystem
typename Description::template HyperbolicSystemView< dim, Number > View
Euler::HyperbolicSystem HyperbolicSystem