12#include <similie/exterior/form.hpp>
14#include <Kokkos_Core.hpp>
24template <
class Dimension>
27 using continuous_dimension_type = Dimension;
30struct ParameterConcept
32 template <
class Element,
class Component>
33 constexpr double operator()(Element, Component)
const
40struct HamiltonianPhysicsConcept
42 static constexpr std::size_t N = 1;
43 static constexpr bool IS_LINEAR =
true;
50 template <
class Element>
55 (state.potential[0] * state.potential[0] + state.moments[0] * state.moments[0])
58 template <
class Index,
class Element>
59 KOKKOS_FUNCTION
constexpr double dhamiltonian_dmoments(State
const& state, Element)
const
61 return state.moments[Index::value];
63 template <
class Index,
class Element>
64 KOKKOS_FUNCTION
constexpr double dhamiltonian_dpotential(State
const& state, Element)
const
66 return state.potential[Index::value];
68 template <
class Row,
class Column,
class Element>
69 KOKKOS_FUNCTION
constexpr double jacobian(State
const&, Element)
const
71 return Row::value == Column::value ? 1 : 0;
73 template <
class Index,
class Element>
74 KOKKOS_FUNCTION
constexpr double dhamiltonian_dmoments_value(State
const&, Element)
const
78 template <
class Index,
class Element>
79 KOKKOS_FUNCTION
constexpr double dhamiltonian_dpotential_value(State
const&, Element)
const
87template <
class Hamiltonian,
class Index,
class Element>
88concept HasMomentCoefficientConcept =
requires(
90 typename Hamiltonian::State
const& state,
91 Element element) { h.template dhamiltonian_dmoments_value<Index>(state, element); };
93template <
class Hamiltonian,
class Index,
class Element>
94concept HasPotentialCoefficientConcept =
requires(
96 typename Hamiltonian::State
const& state,
97 Element element) { h.template dhamiltonian_dpotential_value<Index>(state, element); };
105template <
class Physics>
107 typename Physics::State;
108 requires std::same_as<std::remove_cv_t<
decltype(Physics::N)>, std::size_t>;
109 requires std::same_as<std::remove_cv_t<
decltype(Physics::IS_LINEAR)>,
bool>;
110 typename std::integral_constant<std::size_t, Physics::N>;
111 typename std::bool_constant<Physics::IS_LINEAR>;
114template <
class Physics,
class Element>
118 Physics
const& physics,
119 typename Physics::State
const& state,
122 physics.hamiltonian(state, element)
123 } -> std::same_as<sil::exterior::Form<double>>;
125 physics.template dhamiltonian_dmoments<
126 std::integral_constant<std::size_t, 0>>(state, element)
127 } -> std::same_as<double>;
129 physics.template dhamiltonian_dpotential<
130 std::integral_constant<std::size_t, 0>>(state, element)
131 } -> std::same_as<double>;
133 physics.template jacobian<
134 std::integral_constant<std::size_t, 0>,
135 std::integral_constant<std::size_t, 0>>(state, element)
136 } -> std::same_as<double>;
139template <
class Equations,
class Element>
141 Equations
const& equations,
142 typename Equations::State
const& state,
145 equations.template dpotential_dt<std::integral_constant<std::size_t, 0>>(state, element)
146 } -> std::same_as<double>;
148 equations.template dmoments_dt<std::integral_constant<std::size_t, 0>>(state, element)
149 } -> std::same_as<double>;
151 equations.template jacobian<
152 std::integral_constant<std::size_t, 0>,
153 std::integral_constant<std::size_t, 0>>(state, element)
154 } -> std::same_as<double>;
157template <
class Equations,
class Element>
159 Equations
const& equations,
160 typename Equations::State
const& state,
163 equations.template potential_grad<std::integral_constant<std::size_t, 0>>(state, element)
164 } -> std::same_as<double>;
166 equations.template moments_div<std::integral_constant<std::size_t, 0>>(state, element)
167 } -> std::same_as<double>;
171template <
class Law,
class Element>
173 =
requires(Law
const& law,
typename Law::State
const& state, Element element) {
174 typename std::integral_constant<std::size_t, Law::N>;
177 } -> std::same_as<sil::exterior::Form<std::array<double, Law::N>>>;
178 { law.value(state, element) } -> std::same_as<std::array<double, Law::N * Law::N>>;
179 { law.jacobian(state, element) } -> std::same_as<std::array<double, Law::N * Law::N>>;
181 law.inverse(state, element)
182 } -> std::same_as<sil::exterior::Form<std::array<double, Law::N>>>;
184 law.inverse_value(state, element)
185 } -> std::same_as<std::array<double, Law::N * Law::N>>;