35 const std::string subsection)
37 , hyperbolic_system_(hyperbolic_system)
40 depth_expression_ =
"1.4";
42 "water elevation expression",
44 "A function expression describing the water elevation. When "
45 "bathymetry is 0, this reduces to the water depth.");
47 bathymetry_expression_ =
"0.";
48 this->add_parameter(
"bathymetry expression",
49 bathymetry_expression_,
50 "A function expression describing the bathymetry");
53 velocity_x_expression_ =
"3.0";
55 "velocity x expression",
56 velocity_x_expression_,
57 "A function expression describing the x-component of the velocity");
59 if constexpr (dim > 1) {
60 velocity_y_expression_ =
"0.0";
61 this->add_parameter(
"velocity y expression",
62 velocity_y_expression_,
63 "A function expression describing the "
64 "y-component of the velocity");
71 const auto set_up_muparser = [
this] {
72 using FP = dealii::FunctionParser<dim>;
78 depth_function_ = std::make_unique<FP>(depth_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 bathymetry_function_ = std::make_unique<FP>(bathymetry_expression_);
86 this->parse_parameters_call_back.connect(set_up_muparser);
91 const auto view = hyperbolic_system_.template view<dim, Number>();
95 const Number z = compute_bathymetry(point);
97 depth_function_->set_time(t);
99 std::max(Number(depth_function_->value(point)) - z, Number(0.));
101 velocity_x_function_->set_time(t);
102 full_primitive[1] = velocity_x_function_->value(point);
104 if constexpr (dim > 1) {
105 velocity_y_function_->set_time(t);
106 full_primitive[2] = velocity_y_function_->value(point);
109 return view.from_primitive_state(full_primitive);
114 initial_precomputed_type
final
117 return {compute_bathymetry(point)};
123 std::string depth_expression_;
124 std::string velocity_x_expression_;
125 std::string velocity_y_expression_;
126 std::string bathymetry_expression_;
128 std::unique_ptr<dealii::FunctionParser<dim>> depth_function_;
129 std::unique_ptr<dealii::FunctionParser<dim>> velocity_x_function_;
130 std::unique_ptr<dealii::FunctionParser<dim>> velocity_y_function_;
131 std::unique_ptr<dealii::FunctionParser<dim>> bathymetry_function_;
133 DEAL_II_ALWAYS_INLINE
inline Number
134 compute_bathymetry(
const dealii::Point<dim> &point)
const
136 bathymetry_function_->set_time(0.);
137 return bathymetry_function_->value(point);