24#ifndef DUMUX_PYTHON_MATERIAL_COMPONENT_HH
25#define DUMUX_PYTHON_MATERIAL_COMPONENT_HH
27#include <dune/python/pybind11/pybind11.h>
28#include <dune/python/pybind11/stl.h>
55struct Name {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template name<DisableStaticAssert>()) {} };
56struct MolarMass {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template molarMass<DisableStaticAssert>()) {} };
57struct VaporPressure {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template vaporPressure<DisableStaticAssert>(0.0)) {} };
60struct LiquidDensity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template liquidDensity<DisableStaticAssert>(0.0, 0.0)) {} };
61struct LiquidMolarDensity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template liquidMolarDensity<DisableStaticAssert>(0.0, 0.0)) {} };
62struct LiquidViscosity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template liquidViscosity<DisableStaticAssert>(0.0, 0.0)) {} };
63struct LiquidEnthalpy {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template liquidEnthalpy<DisableStaticAssert>(0.0, 0.0)) {} };
65struct LiquidHeatCapacity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template liquidHeatCapacity<DisableStaticAssert>(0.0, 0.0)) {} };
68struct GasIsIdeal {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasIsIdeal<DisableStaticAssert>()) {} };
70struct GasDensity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasDensity<DisableStaticAssert>(0.0, 0.0)) {} };
71struct GasMolarDensity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasMolarDensity<DisableStaticAssert>(0.0, 0.0)) {} };
72struct GasViscosity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasViscosity<DisableStaticAssert>(0.0, 0.0)) {} };
73struct GasEnthalpy {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasEnthalpy<DisableStaticAssert>(0.0, 0.0)) {} };
74struct GasInternalEnergy {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasInternalEnergy<DisableStaticAssert>(0.0, 0.0)) {} };
75struct GasHeatCapacity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template gasHeatCapacity<DisableStaticAssert>(0.0, 0.0)) {} };
79struct SolidDensity {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template solidDensity<DisableStaticAssert>(0.0)) {} };
83struct Charge {
template<
class C>
auto operator()(C&& c) ->
decltype(C::template charge<DisableStaticAssert>()) {} };
92template <
class Comp,
class... options>
94 pybind11::class_<Comp, options...> cls)
96 using pybind11::operator
""_a;
98 cls.def(pybind11::init());
101 constexpr auto implements = [](
const auto& c)
103 return !
decltype(
isValid(c)(std::declval<Comp>()))::value;
107 cls.def_property_readonly_static(
"name", &Comp::name);
109 cls.def_property_readonly_static(
"molarMass", &Comp::molarMass);
114 cls.def_property_readonly_static(
"liquidIsCompressible", &Comp::liquidIsCompressible);
116 cls.def_static(
"liquidDensity", &Comp::liquidDensity,
"temperature"_a,
"pressure"_a);
118 cls.def_static(
"liquidMolarDensity", &Comp::liquidMolarDensity,
"temperature"_a,
"pressure"_a);
120 cls.def_static(
"liquidViscosity", &Comp::liquidViscosity,
"temperature"_a,
"pressure"_a);
122 cls.def_static(
"liquidEnthalpy", &Comp::liquidEnthalpy,
"temperature"_a,
"pressure"_a);
124 cls.def_static(
"liquidInternalEnergy", &Comp::liquidInternalEnergy,
"temperature"_a,
"pressure"_a);
126 cls.def_static(
"liquidHeatCapacity", &Comp::liquidHeatCapacity,
"temperature"_a,
"pressure"_a);
128 cls.def_static(
"liquidThermalConductivity", &Comp::liquidThermalConductivity,
"temperature"_a,
"pressure"_a);
130 cls.def_static(
"vaporPressure", &Comp::vaporPressure,
"temperature"_a);
136 cls.def_static(
"gasDensity", &Comp::gasDensity,
"temperature"_a,
"pressure"_a);
138 cls.def_static(
"gasMolarDensity", &Comp::gasMolarDensity,
"temperature"_a,
"pressure"_a);
140 cls.def_property_readonly_static(
"gasIsCompressible", &Comp::gasIsCompressible);
142 cls.def_property_readonly_static(
"gasIsIdeal", &Comp::gasIsIdeal);
144 cls.def_static(
"gasViscosity", &Comp::gasViscosity,
"temperature"_a,
"pressure"_a);
146 cls.def_static(
"gasEnthalpy", &Comp::gasEnthalpy,
"temperature"_a,
"pressure"_a);
148 cls.def_static(
"gasInternalEnergy", &Comp::gasInternalEnergy,
"temperature"_a,
"pressure"_a);
150 cls.def_static(
"gasHeatCapacity", &Comp::gasHeatCapacity,
"temperature"_a,
"pressure"_a);
152 cls.def_static(
"gasThermalConductivity", &Comp::gasThermalConductivity,
"temperature"_a,
"pressure"_a);
158 cls.def_property_readonly_static(
"solidIsCompressible", &Comp::solidIsCompressible);
160 cls.def_property_readonly_static(
"solidDensity", &Comp::solidDensity,
"temperature_a");
162 cls.def_static(
"solidThermalConductivity", &Comp::solidThermalConductivity,
"temperature_a");
164 cls.def_static(
"solidHeatCapacity", &Comp::solidHeatCapacity,
"temperature_a");
170 cls.def_property_readonly_static(
"charge", &Comp::charge);
176 cls.def_property_readonly_static(
"criticalTemperature", &Comp::criticalTemperature);
178 cls.def_property_readonly_static(
"criticalPressure", &Comp::criticalPressure);
A helper function for class member function introspection.
Component traits, i.e. information extracted from components.
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:93
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: python/assembly/fvassembler.hh:30
void registerComponent(pybind11::handle scope, pybind11::class_< Comp, options... > cls)
Definition: component.hh:93
Definition: component.hh:35
Template which always yields a false value.
Definition: typetraits.hh:35
Component traits, i.e. information extracted from components.
Definition: componenttraits.hh:43
Helper struct to deactivate static assertions in component's base classes.
Definition: component.hh:37
Definition: component.hh:55
auto operator()(C &&c) -> decltype(C::template name< DisableStaticAssert >())
Definition: component.hh:55
Definition: component.hh:56
auto operator()(C &&c) -> decltype(C::template molarMass< DisableStaticAssert >())
Definition: component.hh:56
Definition: component.hh:57
auto operator()(C &&c) -> decltype(C::template vaporPressure< DisableStaticAssert >(0.0))
Definition: component.hh:57
Definition: component.hh:59
auto operator()(C &&c) -> decltype(C::template liquidIsCompressible< DisableStaticAssert >())
Definition: component.hh:59
Definition: component.hh:60
auto operator()(C &&c) -> decltype(C::template liquidDensity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:60
Definition: component.hh:61
auto operator()(C &&c) -> decltype(C::template liquidMolarDensity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:61
Definition: component.hh:62
auto operator()(C &&c) -> decltype(C::template liquidViscosity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:62
Definition: component.hh:63
auto operator()(C &&c) -> decltype(C::template liquidEnthalpy< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:63
Definition: component.hh:64
auto operator()(C &&c) -> decltype(C::template liquidInternalEnergy< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:64
Definition: component.hh:65
auto operator()(C &&c) -> decltype(C::template liquidHeatCapacity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:65
Definition: component.hh:66
auto operator()(C &&c) -> decltype(C::template liquidThermalConductivity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:66
Definition: component.hh:68
auto operator()(C &&c) -> decltype(C::template gasIsIdeal< DisableStaticAssert >())
Definition: component.hh:68
Definition: component.hh:69
auto operator()(C &&c) -> decltype(C::template gasIsCompressible< DisableStaticAssert >())
Definition: component.hh:69
Definition: component.hh:70
auto operator()(C &&c) -> decltype(C::template gasDensity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:70
Definition: component.hh:71
auto operator()(C &&c) -> decltype(C::template gasMolarDensity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:71
Definition: component.hh:72
auto operator()(C &&c) -> decltype(C::template gasViscosity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:72
Definition: component.hh:73
auto operator()(C &&c) -> decltype(C::template gasEnthalpy< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:73
Definition: component.hh:74
auto operator()(C &&c) -> decltype(C::template gasInternalEnergy< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:74
Definition: component.hh:75
auto operator()(C &&c) -> decltype(C::template gasHeatCapacity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:75
Definition: component.hh:76
auto operator()(C &&c) -> decltype(C::template gasThermalConductivity< DisableStaticAssert >(0.0, 0.0))
Definition: component.hh:76
Definition: component.hh:78
auto operator()(C &&c) -> decltype(C::template solidIsCompressible< DisableStaticAssert >())
Definition: component.hh:78
Definition: component.hh:79
auto operator()(C &&c) -> decltype(C::template solidDensity< DisableStaticAssert >(0.0))
Definition: component.hh:79
Definition: component.hh:80
auto operator()(C &&c) -> decltype(C::template solidThermalConductivity< DisableStaticAssert >(0.0))
Definition: component.hh:80
Definition: component.hh:81
auto operator()(C &&c) -> decltype(C::template solidHeatCapacity< DisableStaticAssert >(0.0))
Definition: component.hh:81
Definition: component.hh:83
auto operator()(C &&c) -> decltype(C::template charge< DisableStaticAssert >())
Definition: component.hh:83
Definition: component.hh:84
auto operator()(C &&c) -> decltype(C::template criticalTemperature< DisableStaticAssert >())
Definition: component.hh:84
Definition: component.hh:85
auto operator()(C &&c) -> decltype(C::template criticalPressure< DisableStaticAssert >())
Definition: component.hh:85