ryujin 2.1.1 revision 9dcb748690310d6a540ebb8b066d1a0834fc7604
initial_state_uniform.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: MIT
3// Copyright (C) 2020 - 2023 by the ryujin authors
4//
5
6#pragma once
7
8#include "hyperbolic_system.h"
9#include <initial_state.h>
10
11namespace ryujin
12{
13 namespace ShallowWater
14 {
20 template <int dim, typename Number, typename state_type>
21 class Uniform : public InitialState<dim, Number, state_type, 1>
22 {
23 public:
24 Uniform(const HyperbolicSystem &hyperbolic_system,
25 const std::string subsection)
26 : InitialState<dim, Number, state_type, 1>("uniform", subsection)
27 , hyperbolic_system(hyperbolic_system)
28 {
29 primitive_[0] = 1.;
30 primitive_[1] = 5.0;
31 this->add_parameter(
32 "primitive state", primitive_, "Initial 1d primitive state (h, u)");
33 }
34
35 state_type compute(const dealii::Point<dim> & /*point*/,
36 Number /*t*/) final
37 {
38 const auto temp = hyperbolic_system.from_primitive_state(primitive_);
39 return hyperbolic_system.template expand_state<dim>(temp);
40 }
41
42 /* Default bathymetry of 0 */
43
44 private:
45 const HyperbolicSystem &hyperbolic_system;
46
47 dealii::Tensor<1, 2, Number> primitive_;
48 };
49
50 } // namespace ShallowWater
51} // namespace ryujin
typename HyperbolicSystemView::state_type state_type
dealii::Tensor< 1, problem_dim, Number > from_primitive_state(const dealii::Tensor< 1, problem_dim, Number > &primitive_state) const
Uniform(const HyperbolicSystem &hyperbolic_system, const std::string subsection)
state_type compute(const dealii::Point< dim > &, Number) final