3#include <deal.II/base/config.h>
5#include <deal.II/base/exceptions.h>
6#include <deal.II/base/tensor.h>
7#include <deal.II/base/vectorization.h>
59 m.heat_capacity_ratio()
62 m.specific_gas_constant()
73 m.heat_capacity_ratio()
76 m.specific_isobaric_heat()
79 m.stiffening_pressure()
90 m.heat_capacity_ratio()
93 m.specific_isobaric_heat()
96 m.stiffening_pressure()
116 template <EOSIsValueView ValueView, IdealGasIsMaterialView MaterialView>
117 static inline DEAL_II_ALWAYS_INLINE
121 return (material_view.heat_capacity_ratio() - 1.) *
122 (value_view.total_energy() -
123 value_view.density() * 0.5 *
140 static inline DEAL_II_ALWAYS_INLINE
143 const GradientView &gradient_view,
144 const MaterialView &material_view)
147 1. / value_view.density() *
148 (gradient_view.grad_total_energy() -
149 1. / value_view.density() * value_view.total_energy() * gradient_view.grad_density());
151 return (material_view.heat_capacity_ratio() - 1.0) / material_view.specific_gas_constant() *
164 template <EOSIsValueView ValueView, IdealGasIsMaterialView MaterialView>
165 static inline DEAL_II_ALWAYS_INLINE
169 return std::sqrt(material_view.heat_capacity_ratio() *
181 template <EOSIsValueView ValueView, IdealGasIsMaterialView MaterialView>
182 static inline DEAL_II_ALWAYS_INLINE
184 temperature(
const ValueView &value_view,
const MaterialView &material_view)
187 (material_view.specific_gas_constant() * value_view.density());
199 template <
typename ValueType, EOSIsValueView ValueView, IdealGasIsMaterialView MaterialView>
200 static inline DEAL_II_ALWAYS_INLINE
204 const MaterialView &material_view)
206 return pressure / (material_view.heat_capacity_ratio() - 1.);
216 template <
typename ValueView, IdealGasIsMaterialView MaterialView>
217 static inline DEAL_II_ALWAYS_INLINE
222 (value_view.density() * (material_view.heat_capacity_ratio() - 1.));
236 template <EOSIsValueView ValueView, StiffenedGasIsMaterialView MaterialView>
237 static inline DEAL_II_ALWAYS_INLINE
241 return (material_view.heat_capacity_ratio() - 1.) *
242 (value_view.total_energy() -
243 value_view.density() * 0.5 *
245 material_view.heat_capacity_ratio() * material_view.stiffening_pressure();
261 static inline DEAL_II_ALWAYS_INLINE
264 const GradientView &gradient_view,
265 const MaterialView &material_view)
267 const auto inv_rho = 1. / value_view.density();
270 inv_rho * (gradient_view.grad_total_energy() -
271 inv_rho * value_view.total_energy() * gradient_view.grad_density());
273 return material_view.heat_capacity_ratio() / material_view.specific_isobaric_heat() *
275 material_view.stiffening_pressure() * inv_rho * inv_rho *
276 gradient_view.grad_density());
288 template <EOSIsValueView ValueView, StiffenedGasIsMaterialView MaterialView>
289 static inline DEAL_II_ALWAYS_INLINE
294 material_view.heat_capacity_ratio() *
296 value_view.density());
308 template <EOSIsValueView ValueView, StiffenedGasIsMaterialView MaterialView>
309 static inline DEAL_II_ALWAYS_INLINE
311 temperature(
const ValueView &value_view,
const MaterialView &material_view)
314 material_view.stiffening_pressure()) *
315 material_view.heat_capacity_ratio() /
316 (material_view.specific_isobaric_heat() * value_view.density() *
317 (material_view.heat_capacity_ratio() - 1.));
329 template <
typename ValueType, EOSIsValueView ValueView, StiffenedGasIsMaterialView MaterialView>
330 static inline DEAL_II_ALWAYS_INLINE
334 const MaterialView &material_view)
337 material_view.heat_capacity_ratio() * material_view.stiffening_pressure()) /
338 (material_view.heat_capacity_ratio() - 1.);
348 template <
typename ValueView, StiffenedGasIsMaterialView MaterialView>
349 static inline DEAL_II_ALWAYS_INLINE
354 material_view.heat_capacity_ratio() * material_view.stiffening_pressure()) /
355 (value_view.density() * (material_view.heat_capacity_ratio() - 1.));
369 template <EOSIsValueView ValueView, NobleAbelStiffenedGasIsMaterialView MaterialView>
370 static inline DEAL_II_ALWAYS_INLINE
374 return ((material_view.heat_capacity_ratio() - 1.) *
375 (value_view.total_energy() -
376 0.5 * value_view.density() *
378 value_view.density() * material_view.heat_bound()) -
379 material_view.heat_capacity_ratio() * material_view.stiffening_pressure() *
380 (1. - value_view.density() * material_view.covolume())) /
381 (1. - value_view.density() * material_view.covolume());
397 static inline DEAL_II_ALWAYS_INLINE
400 const GradientView &gradient_view,
401 const MaterialView &material_view)
403 const auto inv_rho = 1. / value_view.density();
406 inv_rho * (gradient_view.grad_total_energy() -
407 inv_rho * value_view.total_energy() * gradient_view.grad_density());
409 return material_view.heat_capacity_ratio() / material_view.specific_isobaric_heat() *
411 material_view.stiffening_pressure() * inv_rho * inv_rho *
412 gradient_view.grad_density());
424 template <EOSIsValueView ValueView, NobleAbelStiffenedGasIsMaterialView MaterialView>
425 static inline DEAL_II_ALWAYS_INLINE
430 material_view.heat_capacity_ratio() *
432 (value_view.density() * (1. - value_view.density() * material_view.covolume())));
444 template <EOSIsValueView ValueView, NobleAbelStiffenedGasIsMaterialView MaterialView>
445 static inline DEAL_II_ALWAYS_INLINE
447 temperature(
const ValueView &value_view,
const MaterialView &material_view)
450 material_view.stiffening_pressure()) *
451 (1. / value_view.density() - material_view.covolume()) *
452 material_view.heat_capacity_ratio() / (material_view.heat_capacity_ratio() - 1.) *
453 material_view.specific_isobaric_heat();
466 template <
typename ValueType,
469 static inline DEAL_II_ALWAYS_INLINE
472 const ValueView &value_view,
473 const MaterialView &material_view)
476 material_view.heat_capacity_ratio() * material_view.stiffening_pressure()) /
477 (material_view.heat_capacity_ratio() - 1.) *
478 (1. - value_view.density() * material_view.covolume()) +
479 value_view.density() * material_view.heat_bound();
489 template <
typename ValueView, NobleAbelStiffenedGasIsMaterialView MaterialView>
490 static inline DEAL_II_ALWAYS_INLINE
495 material_view.heat_capacity_ratio() * material_view.stiffening_pressure()) /
496 (material_view.heat_capacity_ratio() - 1.) *
497 (1. / value_view.density() - material_view.covolume()) +
498 material_view.heat_bound();
505 template <
typename T>
509 } -> std::convertible_to<
const std::array<CompressibleFlow::EquationOfState,
510 std::tuple_size_v<
decltype(T::supported_eos)>> &>;
521 template <
typename Derived, CompressibleFlow::EquationOfState EOS>
525 return std::ranges::find(Derived::supported_eos, EOS) != Derived::supported_eos.end();
545 template <
typename Derived,
typename F>
546 inline DEAL_II_ALWAYS_INLINE
decltype(
auto)
549 auto check_support = [](CompressibleFlow::EquationOfState type) {
552 if (type == CompressibleFlow::EquationOfState::ideal_gas)
553 return supports_eos<Derived, CompressibleFlow::EquationOfState::ideal_gas>();
554 if (type == CompressibleFlow::EquationOfState::stiffened_gas)
555 return supports_eos<Derived, CompressibleFlow::EquationOfState::stiffened_gas>();
556 if (type == CompressibleFlow::EquationOfState::noble_abel_stiffened_gas)
558 CompressibleFlow::EquationOfState::noble_abel_stiffened_gas>();
566 case CompressibleFlow::EquationOfState::ideal_gas:
567 if constexpr (check_support(CompressibleFlow::EquationOfState::ideal_gas))
571 case CompressibleFlow::EquationOfState::stiffened_gas:
572 if constexpr (check_support(CompressibleFlow::EquationOfState::stiffened_gas))
576 case CompressibleFlow::EquationOfState::noble_abel_stiffened_gas:
577 if constexpr (check_support(CompressibleFlow::EquationOfState::noble_abel_stiffened_gas))
585 AssertThrow(
false, dealii::ExcMessage(
"The provided EOS is not supported by this View."));
598 template <
int dim, ArithmeticType ValueType,
typename Derived>
604 return dispatch_eos<Derived>(
eos_type(), [&](
auto eos) ->
decltype(
auto) {
612 return dispatch_eos<Derived>(
eos_type(), [&](
auto eos) ->
decltype(
auto) {
620 return dispatch_eos<Derived>(
eos_type(), [&](
auto eos) ->
decltype(
auto) {
628 return dispatch_eos<Derived>(
eos_type(), [&](
auto eos) ->
decltype(
auto) {
636 return dispatch_eos<Derived>(
eos_type(), [&](
auto eos) ->
decltype(
auto) {
645 return static_cast<const Derived &
>(*this).eos_type();
651 return static_cast<const Derived &
>(*this);
663 template <
int dim,
typename Derived>
669 return dispatch_eos<Derived>(
eos_type(), [&](
auto eos) ->
decltype(
auto) {
678 return static_cast<const Derived &
>(*this);
684 return static_cast<const Derived &
>(*this).eos_type();
Definition equation_of_state.hpp:40
Definition equation_of_state.hpp:23
Concept ensuring a type defines a specific, compatible supported_eos array.
Definition equation_of_state.hpp:506
Definition equation_of_state.hpp:57
Definition equation_of_state.hpp:88
Definition equation_of_state.hpp:71
Definition equation_of_state.hpp:17
DEAL_II_ALWAYS_INLINE decltype(auto) dispatch_eos(CompressibleFlow::EquationOfState eos_type, F &&f)
Definition equation_of_state.hpp:547
constexpr bool supports_eos()
Dispatch helper function that checks at compile-time whether an equation of state is supported.
Definition equation_of_state.hpp:523
dealii::VectorizedArray< number, N > scalar_product(const dealii::VectorizedArray< number, N > &scalar, const dealii::Tensor< 1, 1, dealii::VectorizedArray< number, N > > &vec)
Definition dealii_tensor.hpp:60
dealii::Tensor< 1, n_rows, number > matrix_vector_product(const dealii::Tensor< 1, n_rows, dealii::Tensor< 1, n_columns, number > > &matrix, const dealii::Tensor< 1, n_columns, number > &vector)
Definition dealii_tensor.hpp:80
Definition equation_of_state.hpp:665
const Derived & derived() const
Definition equation_of_state.hpp:676
decltype(auto) grad_temperature() const
Definition equation_of_state.hpp:667
decltype(auto) eos_type() const
Definition equation_of_state.hpp:682
Definition equation_of_state.hpp:600
const Derived & derived() const
Definition equation_of_state.hpp:649
decltype(auto) speed_of_sound() const
Definition equation_of_state.hpp:618
decltype(auto) specific_inner_energy() const
Definition equation_of_state.hpp:634
decltype(auto) eos_type() const
Definition equation_of_state.hpp:643
decltype(auto) temperature() const
Definition equation_of_state.hpp:610
decltype(auto) pressure() const
Definition equation_of_state.hpp:602
decltype(auto) inner_energy_from_pressure(const ValueType &pressure) const
Definition equation_of_state.hpp:626
Definition equation_of_state.hpp:107
static DEAL_II_ALWAYS_INLINE auto inner_energy_from_pressure(const ValueType &pressure, const ValueView &, const MaterialView &material_view)
Definition equation_of_state.hpp:202
static DEAL_II_ALWAYS_INLINE auto grad_temperature(const ValueView &value_view, const GradientView &gradient_view, const MaterialView &material_view)
Definition equation_of_state.hpp:142
static DEAL_II_ALWAYS_INLINE auto temperature(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:184
static DEAL_II_ALWAYS_INLINE auto speed_of_sound(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:167
static DEAL_II_ALWAYS_INLINE auto thermodynamic_pressure(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:119
static DEAL_II_ALWAYS_INLINE auto specific_inner_energy(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:219
Definition equation_of_state.hpp:360
static DEAL_II_ALWAYS_INLINE auto temperature(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:447
static DEAL_II_ALWAYS_INLINE auto specific_inner_energy(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:492
static DEAL_II_ALWAYS_INLINE auto thermodynamic_pressure(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:372
static DEAL_II_ALWAYS_INLINE auto speed_of_sound(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:427
static DEAL_II_ALWAYS_INLINE auto grad_temperature(const ValueView &value_view, const GradientView &gradient_view, const MaterialView &material_view)
Definition equation_of_state.hpp:399
static DEAL_II_ALWAYS_INLINE auto inner_energy_from_pressure(const ValueType &pressure, const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:471
Definition equation_of_state.hpp:227
static DEAL_II_ALWAYS_INLINE auto specific_inner_energy(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:351
static DEAL_II_ALWAYS_INLINE auto inner_energy_from_pressure(const ValueType &pressure, const ValueView &, const MaterialView &material_view)
Definition equation_of_state.hpp:332
static DEAL_II_ALWAYS_INLINE auto temperature(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:311
static DEAL_II_ALWAYS_INLINE auto thermodynamic_pressure(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:239
static DEAL_II_ALWAYS_INLINE auto speed_of_sound(const ValueView &value_view, const MaterialView &material_view)
Definition equation_of_state.hpp:291
static DEAL_II_ALWAYS_INLINE auto grad_temperature(const ValueView &value_view, const GradientView &gradient_view, const MaterialView &material_view)
Definition equation_of_state.hpp:263