Skip to content
Snippets Groups Projects
Commit 1b8b9f52 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Use Eigen vectors/matrices for MPL Property types.

parent 78a4d6a8
No related branches found
No related tags found
No related merge requests found
......@@ -56,21 +56,20 @@ PropertyDataType RelPermBrooksCorey::value(
if (s_eff >= 1.0)
{
// fully saturated medium
return Pair{{1.0, k_rel_min_GR}};
return Eigen::Vector2d{1.0, k_rel_min_GR};
}
if (s_eff <= 0.0)
{
// dry medium
return Pair{{k_rel_min_LR, 1.0}};
return Eigen::Vector2d{k_rel_min_LR, 1.0};
}
auto const k_rel_LR = std::pow(s_eff, (2. + 3. * lambda) / lambda);
auto const k_rel_GR = (1. - s_eff) * (1. - s_eff) *
(1. - std::pow(s_eff, (2. + lambda) / lambda));
const Pair kRel = {std::max(k_rel_LR, k_rel_min_LR),
std::max(k_rel_GR, k_rel_min_GR)};
return kRel;
return Eigen::Vector2d{std::max(k_rel_LR, k_rel_min_LR),
std::max(k_rel_GR, k_rel_min_GR)};
}
PropertyDataType RelPermBrooksCorey::dValue(
VariableArray const& variable_array, Variable const primary_variable,
......@@ -89,7 +88,7 @@ PropertyDataType RelPermBrooksCorey::dValue(
auto const s_eff = (s_L - s_L_res) / (s_L_max - s_L_res);
if ((s_eff < 0.) || (s_eff > 1.))
return Pair{0., 0.};
return Eigen::Vector2d{0., 0.};
auto const d_se_d_sL = 1. / (s_L_max - s_L_res);
auto const dk_rel_LRdse =
......@@ -103,9 +102,7 @@ PropertyDataType RelPermBrooksCorey::dValue(
_2L_L * std::pow(s_eff, _2L_L - 1.) * (1. - s_eff) * (1. - s_eff);
auto const dk_rel_GRdsL = dk_rel_GRdse * d_se_d_sL;
const Pair dkReldsL = {{dk_rel_LRdsL, dk_rel_GRdsL}};
return dkReldsL;
return Eigen::Vector2d{dk_rel_LRdsL, dk_rel_GRdsL};
}
} // namespace MaterialPropertyLib
......@@ -37,12 +37,12 @@ PropertyDataType RelPermLiakopoulos::value(
if (s_L <= s_L_res)
{
return Pair{0., 1.};
return Eigen::Vector2d{0., 1.};
}
if (s_L >= 1.)
{
return Pair{1., k_rel_min_GR};
return Eigen::Vector2d{1., k_rel_min_GR};
}
auto const a = _parameter_a;
......@@ -55,11 +55,10 @@ PropertyDataType RelPermLiakopoulos::value(
auto const k_rel_GR = (1. - s_eff) * (1. - s_eff) *
(1. - std::pow(s_eff, (2. + lambda) / lambda));
const Pair kRel = {std::max(k_rel_LR, 0.),
std::max(k_rel_GR, k_rel_min_GR)};
return kRel;
return Eigen::Vector2d{std::max(k_rel_LR, 0.),
std::max(k_rel_GR, k_rel_min_GR)};
}
PropertyDataType RelPermLiakopoulos::dValue(
VariableArray const& variable_array, Variable const primary_variable,
ParameterLib::SpatialPosition const& pos, double const t) const
......@@ -90,9 +89,7 @@ PropertyDataType RelPermLiakopoulos::dValue(
_2L_L * std::pow(s_eff, _2L_L - 1.) * s_G_eff * s_G_eff;
auto const dk_rel_GRdsL = dk_rel_GRdse * _dse_dsL;
const Pair dkReldsL = {{dk_rel_LRdsL, dk_rel_GRdsL}};
return dkReldsL;
return Eigen::Vector2d{dk_rel_LRdsL, dk_rel_GRdsL};
}
} // namespace MaterialPropertyLib
......@@ -134,12 +134,10 @@ void HeatTransportBHELocalAssemblerSoil<ShapeFunction, IntegrationMethod>::
medium.property(MaterialPropertyLib::PropertyType::porosity)
.template value<double>(vars, pos, t);
auto const velocity_arr =
auto const velocity =
liquid_phase
.property(MaterialPropertyLib::PropertyType::phase_velocity)
.value(vars, pos, t);
auto const velocity = Eigen::Map<Eigen::Vector3d const>(
std::get<MaterialPropertyLib::Vector>(velocity_arr).data());
.template value<Eigen::Vector3d>(vars, pos, t);
// calculate the hydrodynamic thermodispersion tensor
auto const thermal_conductivity =
......
......@@ -146,7 +146,7 @@ void TwoPhaseFlowWithPPLocalAssembler<
auto const k_rel =
medium.property(MPL::PropertyType::relative_permeability)
.template value<MPL::Pair>(variables, pos, t);
.template value<Eigen::Vector2d>(variables, pos, t);
auto const k_rel_wet = k_rel[0];
auto const k_rel_nonwet = k_rel[1];
......
......@@ -99,14 +99,13 @@ TEST(MaterialPropertyLib, RelPermBrooksCorey)
medium
->property(
MaterialPropertyLib::PropertyType::relative_permeability)
.template value<MaterialPropertyLib::Pair>(variable_array, pos,
time);
.template value<Eigen::Vector2d>(variable_array, pos, time);
auto dk_rel_ds_L =
medium
->property(
MaterialPropertyLib::PropertyType::relative_permeability)
.template dValue<MaterialPropertyLib::Pair>(
.template dValue<Eigen::Vector2d>(
variable_array,
MaterialPropertyLib::Variable::liquid_saturation, pos,
time);
......@@ -122,4 +121,4 @@ TEST(MaterialPropertyLib, RelPermBrooksCorey)
ASSERT_NEAR(dk_rel_L_ds_L, ref_dk_rel_L_ds_L[idx], 1.0e-10);
ASSERT_NEAR(dk_rel_G_ds_L, ref_dk_rel_G_ds_L[idx], 1.0e-10);
}
}
\ No newline at end of file
}
......@@ -86,14 +86,13 @@ TEST(MaterialPropertyLib, RelPermLiakopoulos)
medium
->property(
MaterialPropertyLib::PropertyType::relative_permeability)
.template value<MaterialPropertyLib::Pair>(variable_array, pos,
time);
.template value<Eigen::Vector2d>(variable_array, pos, time);
auto dk_rel_ds_L =
medium
->property(
MaterialPropertyLib::PropertyType::relative_permeability)
.template dValue<MaterialPropertyLib::Pair>(
.template dValue<Eigen::Vector2d>(
variable_array,
MaterialPropertyLib::Variable::liquid_saturation, pos,
time);
......@@ -109,4 +108,4 @@ TEST(MaterialPropertyLib, RelPermLiakopoulos)
ASSERT_NEAR(dk_rel_L_ds_L, ref_dk_rel_L_ds_L[idx], 1.0e-10);
ASSERT_NEAR(dk_rel_G_ds_L, ref_dk_rel_G_ds_L[idx], 1.0e-10);
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment