Commit c9a3f692 authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov
Browse files

[MPL] Replace liquid sat. rate with increment.

parent 7acf4160
Pipeline #1415 passed with stages
in 17 minutes and 12 seconds
......@@ -24,10 +24,21 @@ LinearSaturationSwellingStress::LinearSaturationSwellingStress(
name_ = std::move(name);
}
PropertyDataType LinearSaturationSwellingStress::value(
const VariableArray& /*variable_array*/,
const ParameterLib::SpatialPosition& /*pos*/, const double /*t*/,
const double /*dt*/) const
{
OGS_FATAL(
"LinearSaturationSwellingStress value call requires previous time step "
"values.");
}
PropertyDataType LinearSaturationSwellingStress::value(
const VariableArray& variable_array,
const VariableArray& variable_array_prev,
const ParameterLib::SpatialPosition& /*pos*/, const double /*t*/,
const double dt) const
const double /*dt*/) const
{
// Sl <= S_max is guaranteed by the saturation property or
// the saturation calculation.
......@@ -39,12 +50,10 @@ PropertyDataType LinearSaturationSwellingStress::value(
return 0.0;
}
const double dS =
dt *
std::get<double>(
variable_array[static_cast<int>(Variable::liquid_saturation_rate)]);
const double Sl_prev = std::get<double>(
variable_array_prev[static_cast<int>(Variable::liquid_saturation)]);
return coefficient_ * dS;
return coefficient_ * (Sl - Sl_prev);
}
PropertyDataType LinearSaturationSwellingStress::dValue(
......
......@@ -77,8 +77,14 @@ public:
}
}
PropertyDataType value(VariableArray const& variable_array,
ParameterLib::SpatialPosition const& pos,
double const t,
double const dt) const override;
/// \return \f$\Delta {{\sigma}}^{\text{sw}} \f$.
PropertyDataType value(VariableArray const& variable_array,
VariableArray const& variable_array_prev,
ParameterLib::SpatialPosition const& pos,
double const t,
double const dt) const override;
......
......@@ -37,7 +37,7 @@ TEST(MaterialPropertyLib, LinearSaturationSwellingStress)
" <reference_saturation> 0.65 </reference_saturation>"
"</property>";
auto const swelling_stress_rate =
auto const swelling_stress_increment =
createLinearSaturationSwellingStressModel(xml);
double const coefficient = 1.0e+6;
......@@ -49,20 +49,21 @@ TEST(MaterialPropertyLib, LinearSaturationSwellingStress)
const double dS = S1 - S0;
MaterialPropertyLib::VariableArray variable_array;
variable_array[static_cast<int>(
MaterialPropertyLib::Variable::liquid_saturation_rate)] = dS / dt;
MaterialPropertyLib::VariableArray variable_array_prev;
variable_array[static_cast<int>(
MaterialPropertyLib::Variable::liquid_saturation)] = S1;
variable_array_prev[static_cast<int>(
MaterialPropertyLib::Variable::liquid_saturation)] = S0;
ParameterLib::SpatialPosition const pos;
double const time = std::numeric_limits<double>::quiet_NaN();
double d_sw_expected = coefficient * dS;
double d_sw = std::get<double>(
swelling_stress_rate->value(variable_array, pos, time, dt));
double d_sw = std::get<double>(swelling_stress_increment->value(
variable_array, variable_array_prev, pos, time, dt));
ASSERT_LE(std::fabs(d_sw_expected - d_sw), 1e-19)
<< "for expected swelling stress rate" << d_sw_expected
<< " for computed swelling stress rate." << d_sw_expected;
<< "for expected swelling stress increment" << d_sw_expected
<< " for computed swelling stress increment." << d_sw_expected;
double dsw_dS = std::get<double>(swelling_stress_rate->dValue(
double dsw_dS = std::get<double>(swelling_stress_increment->dValue(
variable_array, MaterialPropertyLib::Variable::liquid_saturation, pos,
time, dt));
double dsw_dS_expected = coefficient;
......@@ -74,15 +75,17 @@ TEST(MaterialPropertyLib, LinearSaturationSwellingStress)
double const S2 = 0.3;
variable_array[static_cast<int>(
MaterialPropertyLib::Variable::liquid_saturation)] = S2;
variable_array_prev[static_cast<int>(
MaterialPropertyLib::Variable::liquid_saturation)] = S1;
d_sw = std::get<double>(
swelling_stress_rate->value(variable_array, pos, time, dt));
d_sw = std::get<double>(swelling_stress_increment->value(
variable_array, variable_array_prev, pos, time, dt));
d_sw_expected = 0.0;
ASSERT_LE(std::fabs(d_sw_expected - d_sw), 1e-19)
<< "for expected swelling stress rate" << d_sw_expected
<< " for computed swelling stress rate." << d_sw_expected;
<< "for expected swelling stress increment" << d_sw_expected
<< " for computed swelling stress increment." << d_sw_expected;
dsw_dS = std::get<double>(swelling_stress_rate->dValue(
dsw_dS = std::get<double>(swelling_stress_increment->dValue(
variable_array, MaterialPropertyLib::Variable::liquid_saturation, pos,
time, dt));
dsw_dS_expected = 0.0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment