diff --git a/MaterialLib/MPL/Properties/Exponential.cpp b/MaterialLib/MPL/Properties/Exponential.cpp index 97c1d0d94c4b7d0d4c30f24f1c4b4c7e3893c1db..dc9d0d50a950585487516f6bb4e2d4da7fd7c76d 100644 --- a/MaterialLib/MPL/Properties/Exponential.cpp +++ b/MaterialLib/MPL/Properties/Exponential.cpp @@ -21,7 +21,9 @@ Exponential::Exponential(std::string name, : exponent_data_(v) { name_ = std::move(name); - value_ = property_reference_value; + auto const f = std::get<double>(exponent_data_.factor); + auto const v0 = std::get<double>(exponent_data_.reference_condition); + value_ = std::get<double>(property_reference_value) * std::exp(-f * v0); } PropertyDataType Exponential::value( @@ -29,12 +31,11 @@ PropertyDataType Exponential::value( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - return std::get<double>(value_) * - std::exp( - std::get<double>(exponent_data_.factor) * - (std::get<double>( - variable_array[static_cast<int>(exponent_data_.type)]) - - std::get<double>(exponent_data_.reference_condition))); + auto const f = std::get<double>(exponent_data_.factor); + auto const v = + std::get<double>(variable_array[static_cast<int>(exponent_data_.type)]); + + return std::get<double>(value_) * std::exp(f * v); } PropertyDataType Exponential::dValue( @@ -42,15 +43,16 @@ PropertyDataType Exponential::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - return exponent_data_.type == primary_variable - ? std::get<double>(value_) * - std::get<double>(exponent_data_.factor) * - std::exp( - std::get<double>(exponent_data_.factor) * - (std::get<double>(variable_array[static_cast<int>( - exponent_data_.type)]) - - std::get<double>(exponent_data_.reference_condition))) - : decltype(value_){}; + if (exponent_data_.type != primary_variable) + { + return 0.; + } + + auto const f = std::get<double>(exponent_data_.factor); + auto const v = + std::get<double>(variable_array[static_cast<int>(exponent_data_.type)]); + + return std::get<double>(value_) * f * std::exp(f * v); } PropertyDataType Exponential::d2Value( @@ -58,16 +60,16 @@ PropertyDataType Exponential::d2Value( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - return exponent_data_.type == pv1 && exponent_data_.type == pv2 - ? std::get<double>(value_) * - boost::math::pow<2>( - std::get<double>(exponent_data_.factor)) * - std::exp( - std::get<double>(exponent_data_.factor) * - (std::get<double>(variable_array[static_cast<int>( - exponent_data_.type)]) - - std::get<double>(exponent_data_.reference_condition))) - : decltype(value_){}; + if (exponent_data_.type != pv1 && exponent_data_.type != pv2) + { + return 0.; + } + + auto const f = std::get<double>(exponent_data_.factor); + auto const v = + std::get<double>(variable_array[static_cast<int>(exponent_data_.type)]); + + return std::get<double>(value_) * f * f * std::exp(f * v); } } // namespace MaterialPropertyLib