18 std::numeric_limits<double>::max_exponent * std::numbers::ln2;
22static constexpr double unused_dt = std::numeric_limits<double>::quiet_NaN();
28 double const f,
double const lower_bound,
double const upper_bound)
30 double const range = upper_bound - lower_bound;
31 double const f_normalized = f - lower_bound;
33 if (f_normalized <= 0.0 || f_normalized >= range)
37 return std::pair{f_normalized, range};
41 double const steepness,
42 double const midpoint,
43 double const lower_bound,
44 double const upper_bound,
55 "In the sigmoid property '{:s}', the lower_bound value {} must be "
56 "smaller than the upper_bound value {}.",
79 double const sigmoid_value =
108 double const f = std::get<double>(
value(variable_array, pos, t,
unused_dt));
114 auto const [f_normalized, range] = *state;
116 return steepness_ * f_normalized * (range - f_normalized) / range;
137 double const f = std::get<double>(
value(variable_array, pos, t,
unused_dt));
143 auto const [f_normalized, range] = *state;
146 (range - 2.0 * f_normalized) / (range * range);
virtual PropertyDataType value() const
Sigmoid(std::string name, double const steepness, double const midpoint, double const lower_bound, double const upper_bound, Variable const independent_variable)
PropertyDataType d2Value(VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Default implementation: 2nd derivative of any constant property is zero.
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Variable independent_variable_
double lower_bound_
X_l parameter (lower bound)
bool derivativeVanishes(Variable const variable) const
double upper_bound_
X_u parameter (upper bound)
static constexpr double max_exp_argument
static std::optional< std::pair< double, double > > normalizedState(double const f, double const lower_bound, double const upper_bound)
static constexpr double unused_dt
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 >, Eigen::MatrixXd > PropertyDataType