14 #include <Eigen/Dense>
32 std::variant<double, Eigen::Matrix<double, 2, 1>,
33 Eigen::Matrix<double, 3, 1>, Eigen::Matrix<double, 2, 2>,
34 Eigen::Matrix<double, 3, 3>, Eigen::Matrix<double, 4, 1>,
35 Eigen::Matrix<double, 6, 1>>;
78 double const t,
double const dt)
const;
84 double const t,
double const dt)
const;
92 double const t,
double const dt)
const;
99 double const t,
double const dt)
const;
106 double const t,
double const dt)
const;
114 template <
typename T>
116 double const t)
const
122 catch (std::bad_variant_access
const&)
125 "The initial value of {:s} does not hold requested type '{:s}' "
133 template <
typename T>
141 return std::get<T>(
value());
143 catch (std::bad_variant_access
const&)
146 "The value of {:s} does not hold requested type '{:s}' but a "
154 template <
typename T>
158 double const dt)
const
166 value(variable_array, variable_array_prev, pos, t, dt));
168 catch (std::bad_variant_access
const&)
171 "The value of {:s} is not of the requested type '{:s}' but a "
176 variable_array_prev, pos, t, dt)
180 template <
typename T>
183 double const dt)
const
190 return std::get<T>(
value(variable_array, pos, t, dt));
192 catch (std::bad_variant_access
const&)
195 "The value of {:s} is not of the requested type '{:s}' but a "
204 template <
typename T>
208 double const dt)
const
215 return std::get<T>(
dValue(variable_array, variable_array_prev,
216 variable, pos, t, dt));
218 catch (std::bad_variant_access
const&)
221 "The first derivative value of {:s} is not of the requested "
222 "type '{:s}' but a {:s}.",
226 [
dValue(variable_array, variable, pos, t, dt).index()]);
229 template <
typename T>
232 double const dt)
const
239 return std::get<T>(
dValue(variable_array, variable, pos, t, dt));
241 catch (std::bad_variant_access
const&)
244 "The first derivative value of {:s} is not of the requested "
245 "type '{:s}' but a {:s}.",
249 [
dValue(variable_array, variable, pos, t, dt).index()]);
252 template <
typename T>
256 double const dt)
const
264 d2Value(variable_array, variable1, variable2, pos, t, dt));
266 catch (std::bad_variant_access
const&)
269 "The second derivative value of {:s} is not of the requested "
270 "type '{:s}' but a {:s}.",
274 variable2, pos, t, dt)
287 std::variant<Medium*, Phase*, Component*>
scale_;
303 "scalar",
"2-vector",
"3-vector",
"2x2-matrix",
304 "3x3-matrix",
"2D-Kelvin vector",
"3D-Kelvin vector"};
306 std::variant_size_v<PropertyDataType>,
307 "The array of property data type names has different size "
308 "than the PropertyDataType variant type.");
314 std::variant<Medium*, Phase*, Component*>
317 for (std::size_t i = 0; i < properties.size(); ++i)
319 if (new_properties[i] !=
nullptr)
321 properties[i] = std::move(new_properties[i]);
322 properties[i]->setScale(scale_pointer);
void DBUG(char const *fmt, Args const &... args)
void WARN(char const *fmt, Args const &... args)
virtual void checkScale() const
virtual PropertyDataType d2Value(VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
Default implementation: 2nd derivative of any constant property is zero.
std::string description() const
static constexpr std::array property_data_type_names_
Corresponds to the PropertyDataType.
T dValue(VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
T value(VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
T d2Value(VariableArray const &variable_array, Variable const &variable1, Variable const &variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
PropertyDataType value_
The single value of a property.
T dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
T initialValue(ParameterLib::SpatialPosition const &pos, double const t) const
virtual PropertyDataType value() const
void setScale(std::variant< Medium *, Phase *, Component * > scale)
T value(VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
std::variant< Medium *, Phase *, Component * > scale_
virtual PropertyDataType initialValue(ParameterLib::SpatialPosition const &pos, double const t) const
virtual PropertyDataType dValue(VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
std::array< std::unique_ptr< Property >, PropertyType::number_of_properties > PropertyArray
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)
PropertyDataType fromVector(std::vector< double > const &values)
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 > > PropertyDataType
std::array< VariableType, static_cast< int >(Variable::number_of_variables)> VariableArray
void scale(PETScVector &x, double const a)