Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPL] Change implementation of LinearProperty #2415

Merged
merged 4 commits into from Mar 14, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -77,7 +77,8 @@
- Add MFront/TFEL solid constitutive relation support via.
MFrontGenericInterfaceSupport library. CMake option `OGS_USE_MFRONT`. [#2259](https://github.com/ufz/ogs/pull/2259)
- Infrastructure for multi-phase, multi-component material properties library.
[#2303](https://github.com/ufz/ogs/pull/2303)
[#2303](https://github.com/ufz/ogs/pull/2303),
[#2415](https://github.com/ufz/ogs/pull/2415)
- Anisotropic tensors may now be given in given local coordinate system. [#2370](https://github.com/ufz/ogs/pull/2370)
- Non-constant density model implementation in HC process. [#2200](https://github.com/ufz/ogs/pull/2200)
- Add second derivatives of permeability functions in Richards flow. [#2188](https://github.com/ufz/ogs/pull/2188)
@@ -1,7 +1,7 @@
Definition of a linear property:
\f$y(x) = y_{\textrm{ref}} + m (x - x_{\textrm{ref}})\f$
\f$y(x) = y_{\textrm{ref}} (1 + m (x - x_{\textrm{ref}})\f$
where
- \f$y_{\textrm{ref}}\f$ is a reference value, for instance reference density
- \f$m\f$ is the slope of the linear relationship
- \f$m\f$ is a value influencing the slope of the linear relationship
- \f$x_{\textrm{ref}}\f$ is a reference condition, for instance reference
temperatue
temperature
@@ -1 +1,2 @@
The slope \f$m\f$ of the linear relation.
\f$m\f$ is a value influencing the slope of the linear relation. The slope is
\f$y_{\mathrm{ref}} m.\f$
@@ -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){};
}

@@ -24,18 +24,20 @@ TEST(MaterialPropertyLib, LinearProperty)
MaterialPropertyLib::VariableArray variable_array;
variable_array[static_cast<int>(
MaterialPropertyLib::Variable::temperature)] = 303.15;
ASSERT_NEAR(boost::get<double>(linear_property.value(variable_array)),
y_ref + m * (boost::get<double>(variable_array[static_cast<int>(
MaterialPropertyLib::Variable::temperature)]) -
x_ref),
1.e-10);
ASSERT_NEAR(
boost::get<double>(linear_property.value(variable_array)),
y_ref * (1 + m * (boost::get<double>(variable_array[static_cast<int>(
MaterialPropertyLib::Variable::temperature)]) -
x_ref)),
1.e-10);
ASSERT_EQ(
boost::get<double>(linear_property.dValue(
variable_array, MaterialPropertyLib::Variable::phase_pressure)),
0.0);
ASSERT_EQ(boost::get<double>(linear_property.dValue(
variable_array, MaterialPropertyLib::Variable::temperature)),
m);
ASSERT_NEAR(
boost::get<double>(linear_property.dValue(
variable_array, MaterialPropertyLib::Variable::temperature)),
y_ref * m, 1.e-16);
ASSERT_EQ(boost::get<double>(linear_property.d2Value(
variable_array,
MaterialPropertyLib::Variable::temperature,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.