OGS
ConstitutiveSetting.cpp
Go to the documentation of this file.
1
11#include "ConstitutiveSetting.h"
12
13#include <Eigen/LU>
14
18
20{
21namespace ConstitutiveStress_StrainTemperature
22{
23template <int DisplacementDim>
25{
26 INFO(
27 "Checking correct model evaluation order in the constitutive setting.");
28
29 using namespace boost::mp11;
30
31 constexpr auto D = DisplacementDim;
32
33 using Inputs = mp_list<SpaceTimeData, MediaData, TemperatureData<D>,
35
36 using InputsAndPrevState = mp_append<Inputs, StatefulDataPrev<D>>;
37
38 bool const is_correct = ProcessLib::Graph::isEvalOrderCorrectRT<
39 ConstitutiveModels<DisplacementDim>, InputsAndPrevState>();
40
41 if (!is_correct)
42 {
43 OGS_FATAL("The constitutive setting has a wrong evaluation order.");
44 }
45
46 INFO("Model evaluation order is correct.");
47
48 return is_correct;
49}
50
51template <int DisplacementDim>
53 ConstitutiveModels<DisplacementDim>& models, double const t,
54 double const dt, ParameterLib::SpatialPosition const& x_position,
55 MediaData const& media_data, TemperatureData<DisplacementDim> const& T_data,
57 StatefulDataPrev<DisplacementDim>& prev_state) const
58{
59 [[maybe_unused]] static const bool model_order_correct =
61
62 // Set eps_m_prev from potentially non-zero eps and sigma_sw from
63 // restart.
64 SpaceTimeData const x_t{x_position, t, dt};
66 std::get<ElasticTangentStiffnessModel<DisplacementDim>>(models).eval(
67 x_t, T_data, C_el_data);
68
69 auto const& eps = std::get<StrainData<DisplacementDim>>(state).eps;
70 auto const& sigma_sw =
71 std::get<SwellingDataStateful<DisplacementDim>>(state).sigma_sw;
72 std::get<PrevState<MechanicalStrainData<DisplacementDim>>>(prev_state)
73 ->eps_m.noalias() =
74 media_data.solid.hasProperty(
76 ? eps + C_el_data.C_el.inverse() * sigma_sw
77 : eps;
78}
79
80template <int DisplacementDim>
82 ConstitutiveModels<DisplacementDim>& models, double const t,
83 double const dt, ParameterLib::SpatialPosition const& x_position,
84 MaterialPropertyLib::Medium const& medium,
87 KelvinVector<DisplacementDim> const& eps_arg,
89 StatefulDataPrev<DisplacementDim> const& prev_state,
94{
95 auto const aux_data = std::tuple{SpaceTimeData{x_position, t, dt},
96 MediaData{medium}, T_data, p_cap_data};
97
98 auto const mat_state_tuple = std::tie(mat_state);
99
100 // TODO will eps lag one iteration behind? (since it's not updated after
101 // solving the global equation system)
102 std::get<StrainData<DisplacementDim>>(state).eps.noalias() = eps_arg;
103
104 ProcessLib::Graph::evalAllInOrder(models, aux_data, cd, mat_state_tuple,
105 out, prev_state, state, tmp);
106
107 // TODO why not ordinary state tracking for BishopsPrevModel?
108
109 {
110 auto const& biot_data = std::get<BiotData>(tmp);
111 auto const& poro_data = std::get<PorosityData>(state);
112
113 if (biot_data() < poro_data.phi)
114 {
115 OGS_FATAL(
116 "ThermoRichardsMechanics: Biot-coefficient {} is smaller than "
117 "porosity {} in element/integration point {}/{}.",
118 biot_data(), poro_data.phi, *x_position.getElementID(),
119 *x_position.getIntegrationPoint());
120 }
121 }
122}
123
124template struct ConstitutiveSetting<2>;
125template struct ConstitutiveSetting<3>;
126
127} // namespace ConstitutiveStress_StrainTemperature
128} // namespace ProcessLib::ThermoRichardsMechanics
#define OGS_FATAL(...)
Definition Error.h:26
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
bool hasProperty(PropertyType const &p) const
Definition Phase.cpp:69
std::optional< std::size_t > getElementID() const
std::optional< unsigned > getIntegrationPoint() const
void evalAllInOrder(Functions &fs, Tuples &... ts)
Definition Apply.h:294
std::tuple< ElasticTangentStiffnessModel< DisplacementDim >, BiotModel, SolidCompressibilityModel< DisplacementDim, SolidConstitutiveRelation< DisplacementDim > >, SaturationModel< DisplacementDim >, BishopsModel, BishopsPrevModel, PorosityModel< DisplacementDim >, SwellingModel< DisplacementDim >, SolidThermalExpansionModel< DisplacementDim >, SolidMechanicsModel< DisplacementDim >, LiquidDensityModel< DisplacementDim >, SolidDensityModel< DisplacementDim >, GravityModel< DisplacementDim >, LiquidViscosityModel< DisplacementDim >, TransportPorosityModel< DisplacementDim >, PermeabilityModel< DisplacementDim >, ThermoOsmosisModel< DisplacementDim >, DarcyLawModel< DisplacementDim >, TRMHeatStorageAndFluxModel< DisplacementDim >, TRMVaporDiffusionModel< DisplacementDim >, FluidThermalExpansionModel< DisplacementDim >, TRMStorageModel< DisplacementDim >, EqPModel< DisplacementDim >, EqTModel< DisplacementDim > > ConstitutiveModels
Constitutive models used for assembly.
std::tuple< DarcyLawData< DisplacementDim >, LiquidDensityData, LiquidViscosityData, SolidDensityData, PermeabilityData< DisplacementDim > > OutputData
Data that is needed for output purposes, but not directly for the assembly.
std::tuple< SaturationData, PorosityData, TransportPorosityData, StrainData< DisplacementDim >, SwellingDataStateful< DisplacementDim >, MechanicalStrainData< DisplacementDim >, EffectiveStressData< DisplacementDim > > StatefulData
Data whose state must be tracked by the TRM process.
std::tuple< SolidMechanicsDataStateless< DisplacementDim >, TotalStressData< DisplacementDim >, GravityData< DisplacementDim >, TRMHeatStorageAndFluxData< DisplacementDim >, TRMVaporDiffusionData< DisplacementDim >, TRMStorageData, EqPData< DisplacementDim >, EqTData< DisplacementDim >, ThermoOsmosisData< DisplacementDim > > ConstitutiveData
Data that is needed for the equation system assembly.
std::tuple< SwellingDataStateless< DisplacementDim >, ElasticTangentStiffnessData< DisplacementDim >, BiotData, SolidCompressibilityData, SaturationDataDeriv, BishopsData, PrevState< BishopsData >, SolidThermalExpansionData< DisplacementDim >, FluidThermalExpansionData, EquivalentPlasticStrainData > ConstitutiveTempData
KV::KelvinVectorType< DisplacementDim > KelvinVector
Definition Base.h:26
void init(ConstitutiveModels< DisplacementDim > &models, double const t, double const dt, ParameterLib::SpatialPosition const &x_position, MediaData const &media_data, TemperatureData< DisplacementDim > const &T_data, StatefulData< DisplacementDim > &state, StatefulDataPrev< DisplacementDim > &prev_state) const
void eval(ConstitutiveModels< DisplacementDim > &models, double const t, double const dt, ParameterLib::SpatialPosition const &x_position, MaterialPropertyLib::Medium const &medium, TemperatureData< DisplacementDim > const &T_data, CapillaryPressureData< DisplacementDim > const &p_cap_data, KelvinVector< DisplacementDim > const &eps_arg, StatefulData< DisplacementDim > &state, StatefulDataPrev< DisplacementDim > const &prev_state, MaterialStateData< DisplacementDim > &mat_state, ConstitutiveTempData< DisplacementDim > &tmp, OutputData< DisplacementDim > &out, ConstitutiveData< DisplacementDim > &cd) const
Evaluate the constitutive setting.
MaterialPropertyLib::Phase const & solid
Definition Base.h:63