From 92d0c0c3ed81d777a60aaa8b9d21521f2ce3090a Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 12 Mar 2019 17:18:07 +0100
Subject: [PATCH] [MPL] Change LinearProperty implementation.

reference_value * (1 + slope * (independent_variable - independent_variable_reference_condition))
---
 MaterialLib/MPL/Properties/LinearProperty.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/MaterialLib/MPL/Properties/LinearProperty.cpp b/MaterialLib/MPL/Properties/LinearProperty.cpp
index a55af89e615..a8e7a4a75b3 100644
--- a/MaterialLib/MPL/Properties/LinearProperty.cpp
+++ b/MaterialLib/MPL/Properties/LinearProperty.cpp
@@ -23,18 +23,20 @@ LinearProperty::LinearProperty(PropertyDataType const& property_reference_value,
 PropertyDataType LinearProperty::value(
     VariableArray const& variable_array) const
 {
-    return boost::get<double>(_value) +
-           boost::get<double>(_independent_variable.slope) *
-               (boost::get<double>(variable_array[static_cast<int>(
-                    _independent_variable.type)]) -
-                boost::get<double>(_independent_variable.reference_condition));
+    return boost::get<double>(_value) *
+           (1 + boost::get<double>(_independent_variable.slope) *
+                    (boost::get<double>(variable_array[static_cast<int>(
+                         _independent_variable.type)]) -
+                     boost::get<double>(
+                         _independent_variable.reference_condition)));
 }
 
 PropertyDataType LinearProperty::dValue(VariableArray const& /*variable_array*/,
                                         Variable const primary_variable) const
 {
     return _independent_variable.type == primary_variable
-               ? _independent_variable.slope
+               ? boost::get<double>(_value) *
+                     boost::get<double>(_independent_variable.slope)
                : decltype(_value){};
 }
 
-- 
GitLab