From 68cfe35933c4b7ea55b4e15ca084cf0ac3f392ab Mon Sep 17 00:00:00 2001 From: Norbert Grunwald <Norbert.Grunwald@ufz.de> Date: Wed, 21 Aug 2019 09:00:00 +0200 Subject: [PATCH] position and time passed to dValue --- MaterialLib/MPL/Components/GetThermalExpansivity.cpp | 3 ++- MaterialLib/MPL/Properties/ExponentialProperty.cpp | 8 ++++---- MaterialLib/MPL/Properties/ExponentialProperty.h | 4 +++- MaterialLib/MPL/Properties/LinearProperty.cpp | 8 +++++--- MaterialLib/MPL/Properties/LinearProperty.h | 9 ++++++--- MaterialLib/MPL/Properties/ParameterProperty.cpp | 4 +++- MaterialLib/MPL/Properties/ParameterProperty.h | 4 +++- MaterialLib/MPL/Property.cpp | 4 +++- MaterialLib/MPL/Property.h | 10 +++++++--- ProcessLib/HT/StaggeredHTFEM-impl.h | 6 ++++-- 10 files changed, 40 insertions(+), 20 deletions(-) diff --git a/MaterialLib/MPL/Components/GetThermalExpansivity.cpp b/MaterialLib/MPL/Components/GetThermalExpansivity.cpp index 55a20255a44..34df14075a8 100644 --- a/MaterialLib/MPL/Components/GetThermalExpansivity.cpp +++ b/MaterialLib/MPL/Components/GetThermalExpansivity.cpp @@ -39,7 +39,8 @@ double getThermalExpansivity(Phase const& phase, VariableArray const& vars, ? 0.0 : -phase.property(MaterialPropertyLib::PropertyType::density) .template dValue<double>( - vars, MaterialPropertyLib::Variable::temperature) / + vars, MaterialPropertyLib::Variable::temperature, + pos, t) / density; } } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/ExponentialProperty.cpp b/MaterialLib/MPL/Properties/ExponentialProperty.cpp index 07802b9f2b7..c58847e5ef1 100644 --- a/MaterialLib/MPL/Properties/ExponentialProperty.cpp +++ b/MaterialLib/MPL/Properties/ExponentialProperty.cpp @@ -9,16 +9,15 @@ * */ -#include <cmath> #include <boost/math/special_functions/pow.hpp> +#include <cmath> #include "MaterialLib/MPL/Properties/ExponentialProperty.h" namespace MaterialPropertyLib { ExponentialProperty::ExponentialProperty( - PropertyDataType const& property_reference_value, - ExponentData const& v) + PropertyDataType const& property_reference_value, ExponentData const& v) : _exponent_data(v) { _value = property_reference_value; @@ -38,7 +37,8 @@ PropertyDataType ExponentialProperty::value( } PropertyDataType ExponentialProperty::dValue( - VariableArray const& variable_array, Variable const primary_variable) const + VariableArray const& variable_array, Variable const primary_variable, + ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/) const { return _exponent_data.type == primary_variable ? -std::get<double>(_value) * diff --git a/MaterialLib/MPL/Properties/ExponentialProperty.h b/MaterialLib/MPL/Properties/ExponentialProperty.h index 4169461db31..6a43c100b9c 100644 --- a/MaterialLib/MPL/Properties/ExponentialProperty.h +++ b/MaterialLib/MPL/Properties/ExponentialProperty.h @@ -44,7 +44,9 @@ public: /// This method will compute the derivative of a property with respect /// to the given primary variable. PropertyDataType dValue(VariableArray const& variable_array, - Variable const primary_variable) const override; + Variable const primary_variable, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const override; /// This method will compute the second derivative of a /// property with respect to the given primary variables pv1 and pv2. PropertyDataType d2Value(VariableArray const& variable_array, diff --git a/MaterialLib/MPL/Properties/LinearProperty.cpp b/MaterialLib/MPL/Properties/LinearProperty.cpp index bb09815239d..a8cbbd3a3aa 100644 --- a/MaterialLib/MPL/Properties/LinearProperty.cpp +++ b/MaterialLib/MPL/Properties/LinearProperty.cpp @@ -33,9 +33,11 @@ PropertyDataType LinearProperty::value( std::get<double>(_independent_variable.reference_condition))); } - -PropertyDataType LinearProperty::dValue(VariableArray const& /*variable_array*/, - Variable const primary_variable) const +PropertyDataType LinearProperty::dValue( + VariableArray const& /*variable_array*/, + Variable const primary_variable, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const { return _independent_variable.type == primary_variable ? std::get<double>(_value) * diff --git a/MaterialLib/MPL/Properties/LinearProperty.h b/MaterialLib/MPL/Properties/LinearProperty.h index f7543c56efe..6c0a9ef3213 100644 --- a/MaterialLib/MPL/Properties/LinearProperty.h +++ b/MaterialLib/MPL/Properties/LinearProperty.h @@ -38,13 +38,16 @@ public: /// This method computes the value of a property depending linearly on /// the value of the given primary variable. PropertyDataType value(VariableArray const& variable_array, - ParameterLib::SpatialPosition const& pos, - double const t) const override; + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const override; /// This method will compute the derivative of a property with respect to /// the given primary variable. PropertyDataType dValue(VariableArray const& variable_array, - Variable const primary_variable) const override; + Variable const primary_variable, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const override; + /// This method will compute the second derivative of a /// property with respect to the given primary variables pv1 and pv2. PropertyDataType d2Value(VariableArray const& variable_array, diff --git a/MaterialLib/MPL/Properties/ParameterProperty.cpp b/MaterialLib/MPL/Properties/ParameterProperty.cpp index 5406b62396c..18ead32d3a2 100644 --- a/MaterialLib/MPL/Properties/ParameterProperty.cpp +++ b/MaterialLib/MPL/Properties/ParameterProperty.cpp @@ -29,7 +29,9 @@ PropertyDataType ParameterProperty::value( PropertyDataType ParameterProperty::dValue( VariableArray const& /*variable_array*/, - Variable const /*primary_variable*/) const + Variable const /*primary_variable*/, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const { return double{}; } diff --git a/MaterialLib/MPL/Properties/ParameterProperty.h b/MaterialLib/MPL/Properties/ParameterProperty.h index 923e8d52683..ae42ead8232 100644 --- a/MaterialLib/MPL/Properties/ParameterProperty.h +++ b/MaterialLib/MPL/Properties/ParameterProperty.h @@ -36,7 +36,9 @@ public: /// This method will compute the derivative of a property with respect to /// the given primary variable. PropertyDataType dValue(VariableArray const& variable_array, - Variable const primary_variable) const override; + Variable const primary_variable, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const override; /// This method will compute the second derivative of a /// property with respect to the given primary variables pv1 and pv2. PropertyDataType d2Value(VariableArray const& variable_array, diff --git a/MaterialLib/MPL/Property.cpp b/MaterialLib/MPL/Property.cpp index 2572850b43e..9892ba51435 100644 --- a/MaterialLib/MPL/Property.cpp +++ b/MaterialLib/MPL/Property.cpp @@ -35,7 +35,9 @@ PropertyDataType Property::value(VariableArray const& /*variable_array*/, /// The default implementation of this method only returns the /// property value derivative without altering it. PropertyDataType Property::dValue(VariableArray const& /*variable_array*/, - Variable const /*variable*/) const + Variable const /*variable*/, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/) const { return _dvalue; } diff --git a/MaterialLib/MPL/Property.h b/MaterialLib/MPL/Property.h index 6525d1cec66..8368560ec64 100644 --- a/MaterialLib/MPL/Property.h +++ b/MaterialLib/MPL/Property.h @@ -65,7 +65,9 @@ public: /// This virtual method will compute the derivative of a property /// with respect to the given variable pv. virtual PropertyDataType dValue(VariableArray const& variable_array, - Variable const variable) const; + Variable const variable, + ParameterLib::SpatialPosition const& pos, + double const t) const; /// This virtual method will compute the second derivative of a /// property with respect to the given variables pv1 and pv2. virtual PropertyDataType d2Value(VariableArray const& variable_array, @@ -89,9 +91,11 @@ public: } template <typename T> - T dValue(VariableArray const& variable_array, Variable const variable) const + T dValue(VariableArray const& variable_array, Variable const variable, + ParameterLib::SpatialPosition const& pos, + double const t) const { - return std::get<T>(dValue(variable_array, variable)); + return std::get<T>(dValue(variable_array, variable, pos, t)); } template <typename T> T d2Value(VariableArray const& variable_array, diff --git a/ProcessLib/HT/StaggeredHTFEM-impl.h b/ProcessLib/HT/StaggeredHTFEM-impl.h index 08ef5e22382..1caf535f550 100644 --- a/ProcessLib/HT/StaggeredHTFEM-impl.h +++ b/ProcessLib/HT/StaggeredHTFEM-impl.h @@ -113,7 +113,8 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>:: const double dfluid_density_dp = liquid_phase.property(MaterialPropertyLib::PropertyType::density) .template dValue<double>( - vars, MaterialPropertyLib::Variable::phase_pressure); + vars, MaterialPropertyLib::Variable::phase_pressure, pos, + t); // Use the viscosity model to compute the viscosity auto const viscosity = @@ -161,7 +162,8 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>:: liquid_phase .property(MaterialPropertyLib::PropertyType::density) .template dValue<double>( - vars, MaterialPropertyLib::Variable::temperature); + vars, MaterialPropertyLib::Variable::temperature, pos, + t); double T0_int_pt = 0.; NumLib::shapeFunctionInterpolate(local_T0, N, T0_int_pt); auto const biot_constant = -- GitLab