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

[PL/RM] Use variables prev for transport porosity.

Removing misuse of the current state varible transport porosity
as temporary previous state storage.
parent 56383707
......@@ -36,6 +36,7 @@ void TransportPorosityFromMassBalance::checkScale() const
PropertyDataType TransportPorosityFromMassBalance::value(
VariableArray const& variable_array,
VariableArray const& variable_array_prev,
ParameterLib::SpatialPosition const& pos, double const t,
double const dt) const
{
......@@ -56,12 +57,22 @@ PropertyDataType TransportPorosityFromMassBalance::value(
std::get<double>(variable_array[static_cast<int>(Variable::porosity)]);
double const phi_tr_prev = std::get<double>(
variable_array[static_cast<int>(Variable::transport_porosity)]);
variable_array_prev[static_cast<int>(Variable::transport_porosity)]);
double const w = dt * (e_dot + p_eff_dot * beta_SR);
return std::clamp(phi_tr_prev + (alpha_b - phi) * w, phi_min_, phi_max_);
}
PropertyDataType TransportPorosityFromMassBalance::value(
VariableArray const& /*variable_array*/,
ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
double const /*dt*/) const
{
OGS_FATAL(
"TransportPorosityFromMassBalance value call requires previous time "
"step values.");
}
PropertyDataType TransportPorosityFromMassBalance::dValue(
VariableArray const& /*variable_array*/,
Variable const /*primary_variable*/,
......
......@@ -48,6 +48,11 @@ public:
}
PropertyDataType value(VariableArray const& variable_array,
ParameterLib::SpatialPosition const& pos,
double const t,
double const dt) const override;
PropertyDataType value(VariableArray const& variable_array,
VariableArray const& variable_array_prev,
ParameterLib::SpatialPosition const& pos,
double const t, double const dt) const override;
PropertyDataType dValue(VariableArray const& variable_array,
......
......@@ -433,18 +433,16 @@ void RichardsMechanicsLocalAssembler<
if (solid_phase.hasProperty(MPL::PropertyType::transport_porosity))
{
double& phi_tr = _ip_data[ip].transport_porosity;
// Use previous time step transport_porosity for
// transport_porosity update, ...
variables[static_cast<int>(MPL::Variable::transport_porosity)] =
variables_prev[static_cast<int>(MPL::Variable::transport_porosity)] =
_ip_data[ip].transport_porosity_prev;
// ... then use new transport_porosity.
phi_tr =
_ip_data[ip].transport_porosity =
solid_phase.property(MPL::PropertyType::transport_porosity)
.template value<double>(variables, x_position, t, dt);
.template value<double>(variables, variables_prev,
x_position, t, dt);
variables[static_cast<int>(MPL::Variable::transport_porosity)] =
phi_tr;
_ip_data[ip].transport_porosity;
}
else
{
......@@ -761,18 +759,15 @@ void RichardsMechanicsLocalAssembler<ShapeFunctionDisplacement,
if (solid_phase.hasProperty(MPL::PropertyType::transport_porosity))
{
double& phi_tr = _ip_data[ip].transport_porosity;
// Use previous time step transport_porosity for
// transport_porosity update, ...
variables[static_cast<int>(MPL::Variable::transport_porosity)] =
variables_prev[static_cast<int>(MPL::Variable::transport_porosity)] =
_ip_data[ip].transport_porosity_prev;
// ... then use new transport_porosity.
phi_tr =
_ip_data[ip].transport_porosity =
solid_phase.property(MPL::PropertyType::transport_porosity)
.template value<double>(variables, x_position, t, dt);
.template value<double>(variables, variables_prev,
x_position, t, dt);
variables[static_cast<int>(MPL::Variable::transport_porosity)] =
phi_tr;
_ip_data[ip].transport_porosity;
}
else
{
......@@ -1462,7 +1457,6 @@ void RichardsMechanicsLocalAssembler<ShapeFunctionDisplacement,
// Swelling and possibly volumetric strain rate update.
auto& sigma_sw = _ip_data[ip].sigma_sw;
double& phi_tr = _ip_data[ip].transport_porosity;
{
auto const& sigma_sw_prev = _ip_data[ip].sigma_sw_prev;
......@@ -1490,16 +1484,16 @@ void RichardsMechanicsLocalAssembler<ShapeFunctionDisplacement,
if (solid_phase.hasProperty(MPL::PropertyType::transport_porosity))
{
// Use previous time step transport_porosity for
// transport_porosity update, ...
variables[static_cast<int>(MPL::Variable::transport_porosity)] =
variables_prev[static_cast<int>(
MPL::Variable::transport_porosity)] =
_ip_data[ip].transport_porosity_prev;
// ... then use new transport_porosity.
phi_tr =
_ip_data[ip].transport_porosity =
solid_phase.property(MPL::PropertyType::transport_porosity)
.template value<double>(variables, x_position, t, dt);
.template value<double>(variables, variables_prev,
x_position, t, dt);
variables[static_cast<int>(MPL::Variable::transport_porosity)] =
phi_tr;
_ip_data[ip].transport_porosity;
}
else
{
......
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