Skip to content
Snippets Groups Projects
Verified Commit 20a00783 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Lars Bilke
Browse files

[MPL/Exp] Add additive offset.

parent e63a8983
No related branches found
No related tags found
No related merge requests found
Definition of a exponential property: Definition of a exponential property:
\f$y(x) = y_{\textrm{ref}} \exp(m (x - x_{\textrm{ref}}))\f$ \f$y(x) = y_{\textrm{offset}} + y_{\textrm{ref}} \exp(m (x - x_{\textrm{ref}}))\f$
where where
- \f$y_{\textrm{ref}}\f$ is a reference value, for instance reference viscosity - \f$y_{\textrm{ref}}\f$ is a reference value, for instance reference viscosity
- \f$m\f$ is a factor influencing the exponent of the exponential relationship - \f$m\f$ is a factor influencing the exponent of the exponential relationship
......
\copydoc MaterialPropertyLib::Exponential::offset_
...@@ -44,6 +44,10 @@ std::unique_ptr<Exponential> createExponential( ...@@ -44,6 +44,10 @@ std::unique_ptr<Exponential> createExponential(
//! \ogs_file_param{properties__property__Exponential__exponent__factor} //! \ogs_file_param{properties__property__Exponential__exponent__factor}
exponent_data_config.getConfigParameter<double>("factor"); exponent_data_config.getConfigParameter<double>("factor");
auto const offset =
//! \ogs_file_param{properties__property__Exponential__offset}
config.getConfigParameter<double>("offset");
MaterialPropertyLib::Variable exp_data_type = MaterialPropertyLib::Variable exp_data_type =
MaterialPropertyLib::convertStringToVariable(variable_name); MaterialPropertyLib::convertStringToVariable(variable_name);
...@@ -51,6 +55,6 @@ std::unique_ptr<Exponential> createExponential( ...@@ -51,6 +55,6 @@ std::unique_ptr<Exponential> createExponential(
exp_data_type, reference_condition, factor}; exp_data_type, reference_condition, factor};
return std::make_unique<MaterialPropertyLib::Exponential>( return std::make_unique<MaterialPropertyLib::Exponential>(
std::move(property_name), reference_value, exp_data); std::move(property_name), offset, reference_value, exp_data);
} }
} // namespace MaterialPropertyLib } // namespace MaterialPropertyLib
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
namespace MaterialPropertyLib namespace MaterialPropertyLib
{ {
Exponential::Exponential(std::string name, Exponential::Exponential(std::string name,
double const offset,
PropertyDataType const& property_reference_value, PropertyDataType const& property_reference_value,
ExponentData const& v) ExponentData const& v)
: exponent_data_(v) : exponent_data_(v), offset_(offset)
{ {
name_ = std::move(name); name_ = std::move(name);
auto const f = std::get<double>(exponent_data_.factor); auto const f = std::get<double>(exponent_data_.factor);
...@@ -35,7 +36,7 @@ PropertyDataType Exponential::value( ...@@ -35,7 +36,7 @@ PropertyDataType Exponential::value(
auto const v = auto const v =
std::get<double>(variable_array[static_cast<int>(exponent_data_.type)]); std::get<double>(variable_array[static_cast<int>(exponent_data_.type)]);
return std::get<double>(value_) * std::exp(f * v); return offset_ + std::get<double>(value_) * std::exp(f * v);
} }
PropertyDataType Exponential::dValue( PropertyDataType Exponential::dValue(
......
...@@ -22,7 +22,7 @@ struct ExponentData ...@@ -22,7 +22,7 @@ struct ExponentData
}; };
/// The exponential property class. This property calculates the exponential /// The exponential property class. This property calculates the exponential
/// relationship \f$ \alpha(\beta) = /// relationship \f$ \alpha(\beta) = \alpha_{\mathrm{offset}} +
/// \alpha_{\mathrm{ref}} \cdot \exp (-s (\beta - \beta_{\mathrm{ref}})\f$. /// \alpha_{\mathrm{ref}} \cdot \exp (-s (\beta - \beta_{\mathrm{ref}})\f$.
/// The current implementation accepts only the double datatype defined in /// The current implementation accepts only the double datatype defined in
/// PropertyDataType. /// PropertyDataType.
...@@ -33,6 +33,7 @@ public: ...@@ -33,6 +33,7 @@ public:
/// the PropertyDataType definition and sets the protected attribute value_ /// the PropertyDataType definition and sets the protected attribute value_
/// of the base class Property to that value. /// of the base class Property to that value.
Exponential(std::string name, Exponential(std::string name,
double const offset,
PropertyDataType const& property_reference_value, PropertyDataType const& property_reference_value,
ExponentData const& v); ExponentData const& v);
/// This method computes the value of a property \f$\alpha\f$ depending /// This method computes the value of a property \f$\alpha\f$ depending
...@@ -57,5 +58,6 @@ public: ...@@ -57,5 +58,6 @@ public:
private: private:
ExponentData const exponent_data_; ExponentData const exponent_data_;
double const offset_; //< additive offset in units of the property.
}; };
} // namespace MaterialPropertyLib } // namespace MaterialPropertyLib
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment