OGS
PorosityFromMassBalance.cpp
Go to the documentation of this file.
1
11
12#include <algorithm>
13#include <cmath>
14
16
17namespace MaterialPropertyLib
18{
20{
21 if (!std::holds_alternative<Medium*>(scale_))
22 {
24 "The property 'PorosityFromMassBalance' is "
25 "implemented on the 'medium' scales only.");
26 }
27}
28
30 VariableArray const& /*variable_array*/,
31 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
32 double const /*dt*/) const
33{
35 "PorosityFromMassBalance value call requires previous time step "
36 "values.");
37}
38
40 VariableArray const& variable_array,
41 VariableArray const& variable_array_prev,
42 ParameterLib::SpatialPosition const& pos, double const t,
43 double const dt) const
44{
45 double const beta_SR = variable_array.grain_compressibility;
46 auto const alpha_b =
47 std::get<Medium*>(scale_)
49 .template value<double>(variable_array, pos, t, dt);
50
51 double const e = variable_array.volumetric_strain;
52 double const e_prev = variable_array_prev.volumetric_strain;
53 double const delta_e = e - e_prev;
54
55 double const p_eff = variable_array.effective_pore_pressure;
56 double const p_eff_prev = variable_array_prev.effective_pore_pressure;
57 double const delta_p_eff = p_eff - p_eff_prev;
58
59 double const phi_prev = variable_array_prev.porosity;
60
61 double const w = delta_e + delta_p_eff * beta_SR;
62 return std::clamp((phi_prev + alpha_b * w) / (1 + w), phi_min_, phi_max_);
63}
64
66 VariableArray const& /*variable_array*/, Variable const /*variable*/,
67 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
68 double const /*dt*/) const
69{
70 OGS_FATAL("PorosityFromMassBalance derivatives are not implemented.");
71}
72
73} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
virtual PropertyDataType value() const
Definition Property.cpp:76
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 >, Eigen::MatrixXd > PropertyDataType
Definition Property.h:31