29 namespace RichardsMechanics
31 template <
int DisplacementDim,
typename IPData>
36 double const rho_LR,
double const mu,
37 std::optional<MicroPorosityParameters> micro_porosity_parameters,
38 double const alpha,
double const phi,
double const p_cap_ip,
45 DisplacementDim)>::identity2;
47 auto& sigma_sw = ip_data.sigma_sw;
48 auto const& sigma_sw_prev = ip_data.sigma_sw_prev;
53 sigma_sw = sigma_sw_prev;
56 using DimMatrix = Eigen::Matrix<double, 3, 3>;
57 auto const sigma_sw_dot =
58 MathLib::KelvinVector::tensorToKelvin<DisplacementDim>(
61 .
template value<DimMatrix>(variables, variables_prev,
63 sigma_sw += sigma_sw_dot * dt;
67 std::get<double>(variables[
static_cast<int>(
68 MPL::Variable::volumetric_strain)]) +=
69 identity2.transpose() * C_el.inverse() * sigma_sw;
70 std::get<double>(variables_prev[
static_cast<int>(
71 MPL::Variable::volumetric_strain)]) +=
72 identity2.transpose() * C_el.inverse() * sigma_sw_prev;
80 double const phi_M_prev = ip_data.transport_porosity_prev;
81 double const phi_prev = ip_data.porosity_prev;
82 double const phi_m_prev = phi_prev - phi_M_prev;
83 double const p_L_m_prev = ip_data.liquid_pressure_m_prev;
85 auto const S_L_m_prev = ip_data.saturation_m_prev;
87 auto const [delta_phi_m, delta_e_sw, delta_p_L_m, delta_sigma_sw] =
88 computeMicroPorosity<DisplacementDim>(
89 identity2.transpose() * C_el.inverse(), rho_LR, mu,
90 *micro_porosity_parameters,
alpha, phi, -p_cap_ip, p_L_m_prev,
91 variables_prev, S_L_m_prev, phi_m_prev, x_position, t, dt,
95 auto& phi_M = ip_data.transport_porosity;
96 phi_M = phi - (phi_m_prev + delta_phi_m);
101 auto& p_L_m = ip_data.liquid_pressure_m;
102 p_L_m = p_L_m_prev + delta_p_L_m;
105 variables_prev[
static_cast<int>(
111 ip_data.saturation_m =
113 .template value<double>(variables, x_position, t, dt);
115 sigma_sw = sigma_sw_prev + delta_sigma_sw;
119 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
120 typename IntegrationMethod,
int DisplacementDim>
121 RichardsMechanicsLocalAssembler<ShapeFunctionDisplacement,
122 ShapeFunctionPressure, IntegrationMethod,
124 RichardsMechanicsLocalAssembler(
127 bool const is_axially_symmetric,
128 unsigned const integration_order,
130 : _process_data(process_data),
131 _integration_method(integration_order),
133 _is_axially_symmetric(is_axially_symmetric)
135 unsigned const n_integration_points =
138 _ip_data.reserve(n_integration_points);
141 auto const shape_matrices_u =
144 DisplacementDim>(e, is_axially_symmetric,
147 auto const shape_matrices_p =
152 auto const& solid_material =
161 for (
unsigned ip = 0; ip < n_integration_points; ip++)
164 _ip_data.emplace_back(solid_material);
166 auto const& sm_u = shape_matrices_u[ip];
169 sm_u.integralMeasure * sm_u.detJ;
171 ip_data.N_u_op = ShapeMatricesTypeDisplacement::template MatrixType<
174 for (
int i = 0; i < DisplacementDim; ++i)
182 ip_data.N_u = sm_u.N;
183 ip_data.dNdx_u = sm_u.dNdx;
185 ip_data.N_p = shape_matrices_p[ip].N;
186 ip_data.dNdx_p = shape_matrices_p[ip].dNdx;
191 .template initialValue<double>(
194 double>::quiet_NaN() );
196 ip_data.transport_porosity = ip_data.porosity;
199 ip_data.transport_porosity =
201 .template initialValue<double>(
204 double>::quiet_NaN() );
211 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
212 typename IntegrationMethod,
int DisplacementDim>
214 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
215 DisplacementDim>::setIPDataInitialConditions(std::string
const&
name,
216 double const* values,
217 int const integration_order)
219 if (integration_order !=
220 static_cast<int>(_integration_method.getIntegrationOrder()))
223 "Setting integration point initial conditions; The integration "
224 "order of the local assembler for element {:d} is different "
225 "from the integration order in the initial condition.",
229 if (
name ==
"sigma_ip")
231 if (_process_data.initial_stress !=
nullptr)
234 "Setting initial conditions for stress from integration "
235 "point data and from a parameter '{:s}' is not possible "
237 _process_data.initial_stress->name);
239 return ProcessLib::setIntegrationPointKelvinVectorData<DisplacementDim>(
240 values, _ip_data, &IpData::sigma_eff);
243 if (
name ==
"saturation_ip")
248 if (
name ==
"porosity_ip")
253 if (
name ==
"transport_porosity_ip")
258 if (
name ==
"swelling_stress_ip")
260 return ProcessLib::setIntegrationPointKelvinVectorData<DisplacementDim>(
261 values, _ip_data, &IpData::sigma_sw);
263 if (
name ==
"epsilon_ip")
265 return ProcessLib::setIntegrationPointKelvinVectorData<DisplacementDim>(
266 values, _ip_data, &IpData::eps);
268 if (
name.starts_with(
"material_state_variable_") &&
name.ends_with(
"_ip"))
270 std::string
const variable_name =
name.substr(24,
name.size() - 24 - 3);
271 DBUG(
"Setting material state variable '{:s}'", variable_name);
275 auto const& internal_variables =
276 _ip_data[0].solid_material.getInternalVariables();
278 std::find_if(begin(internal_variables), end(internal_variables),
279 [&variable_name](
auto const& iv)
280 {
return iv.name == variable_name; });
281 iv != end(internal_variables))
284 values, _ip_data, &IpData::material_state_variables,
288 ERR(
"Could not find variable {:s} in solid material model's internal "
295 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
296 typename IntegrationMethod,
int DisplacementDim>
298 ShapeFunctionPressure, IntegrationMethod,
300 setInitialConditionsConcrete(std::vector<double>
const& local_x,
305 assert(local_x.size() == pressure_size + displacement_size);
308 Eigen::Map<
typename ShapeMatricesTypePressure::template VectorType<
309 pressure_size>
const>(local_x.data() + pressure_index,
312 constexpr
double dt = std::numeric_limits<double>::quiet_NaN();
313 auto const& medium = _process_data.media_map->getMedium(_element.getID());
319 auto const& solid_phase = medium->phase(
"Solid");
321 unsigned const n_integration_points =
322 _integration_method.getNumberOfPoints();
323 for (
unsigned ip = 0; ip < n_integration_points; ip++)
327 auto const& N_p = _ip_data[ip].N_p;
334 variables[
static_cast<int>(MPL::Variable::phase_pressure)] = -p_cap_ip;
335 _ip_data[ip].liquid_pressure_m_prev = -p_cap_ip;
336 _ip_data[ip].liquid_pressure_m = -p_cap_ip;
338 auto const temperature =
340 .template value<double>(variables, x_position, t, dt);
343 _ip_data[ip].saturation_prev =
345 .template value<double>(variables, x_position, t, dt);
354 .template value<double>(vars, x_position, t, dt);
355 _ip_data[ip].saturation_m_prev = S_L_m;
360 auto const C_el = _ip_data[ip].computeElasticTangentStiffness(
361 t, x_position, dt, temperature);
362 auto& eps = _ip_data[ip].eps;
363 auto& sigma_sw = _ip_data[ip].sigma_sw;
365 _ip_data[ip].eps_m_prev.noalias() =
367 ? eps + C_el.inverse() * sigma_sw
372 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
373 typename IntegrationMethod,
int DisplacementDim>
375 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
376 DisplacementDim>::assemble(
double const t,
double const dt,
377 std::vector<double>
const& local_x,
378 std::vector<double>
const& local_xdot,
379 std::vector<double>& local_M_data,
380 std::vector<double>& local_K_data,
381 std::vector<double>& local_rhs_data)
383 assert(local_x.size() == pressure_size + displacement_size);
386 Eigen::Map<
typename ShapeMatricesTypePressure::template VectorType<
387 pressure_size>
const>(local_x.data() + pressure_index,
391 Eigen::Map<
typename ShapeMatricesTypeDisplacement::template VectorType<
392 displacement_size>
const>(local_x.data() + displacement_index,
396 Eigen::Map<
typename ShapeMatricesTypePressure::template VectorType<
397 pressure_size>
const>(local_xdot.data() + pressure_index,
401 Eigen::Map<
typename ShapeMatricesTypeDisplacement::template VectorType<
402 displacement_size>
const>(local_xdot.data() + displacement_index,
406 typename ShapeMatricesTypeDisplacement::template MatrixType<
407 displacement_size + pressure_size,
408 displacement_size + pressure_size>>(
409 local_K_data, displacement_size + pressure_size,
410 displacement_size + pressure_size);
413 typename ShapeMatricesTypeDisplacement::template MatrixType<
414 displacement_size + pressure_size,
415 displacement_size + pressure_size>>(
416 local_M_data, displacement_size + pressure_size,
417 displacement_size + pressure_size);
420 typename ShapeMatricesTypeDisplacement::template VectorType<
421 displacement_size + pressure_size>>(
422 local_rhs_data, displacement_size + pressure_size);
426 DisplacementDim)>::identity2;
428 auto const& medium = _process_data.media_map->getMedium(_element.getID());
429 auto const& liquid_phase = medium->phase(
"AqueousLiquid");
430 auto const& solid_phase = medium->phase(
"Solid");
437 unsigned const n_integration_points =
438 _integration_method.getNumberOfPoints();
439 for (
unsigned ip = 0; ip < n_integration_points; ip++)
442 auto const& w = _ip_data[ip].integration_weight;
444 auto const& N_u_op = _ip_data[ip].N_u_op;
446 auto const& N_u = _ip_data[ip].N_u;
447 auto const& dNdx_u = _ip_data[ip].dNdx_u;
449 auto const& N_p = _ip_data[ip].N_p;
450 auto const& dNdx_p = _ip_data[ip].dNdx_p;
458 ShapeFunctionDisplacement::NPOINTS,
460 dNdx_u, N_u, x_coord, _is_axially_symmetric);
462 auto& eps = _ip_data[ip].eps;
463 auto& eps_m = _ip_data[ip].eps_m;
464 eps.noalias() = B * u;
466 auto& S_L = _ip_data[ip].saturation;
467 auto const S_L_prev = _ip_data[ip].saturation_prev;
477 variables[
static_cast<int>(MPL::Variable::phase_pressure)] = -p_cap_ip;
479 auto const temperature =
481 .template value<double>(variables, x_position, t, dt);
486 .template value<double>(variables, x_position, t, dt);
487 auto const C_el = _ip_data[ip].computeElasticTangentStiffness(
488 t, x_position, dt, temperature);
492 _ip_data[ip].solid_material.getBulkModulus(t, x_position, &C_el);
493 variables[
static_cast<int>(MPL::Variable::grain_compressibility)] =
498 .template value<double>(variables, x_position, t, dt);
500 auto const& b = _process_data.specific_body_force;
503 .template value<double>(variables, x_position, t, dt);
504 variables[
static_cast<int>(MPL::Variable::liquid_saturation)] = S_L;
505 variables_prev[
static_cast<int>(MPL::Variable::liquid_saturation)] =
509 double const dS_L_dp_cap =
511 .template dValue<double>(variables,
516 double const DeltaS_L_Deltap_cap =
517 (p_cap_dot_ip == 0) ? dS_L_dp_cap
518 : (S_L - S_L_prev) / (dt * p_cap_dot_ip);
520 auto const chi = [medium, x_position, t, dt](
double const S_L)
523 vs[
static_cast<int>(MPL::Variable::liquid_saturation)] = S_L;
525 .template value<double>(vs, x_position, t, dt);
527 double const chi_S_L = chi(S_L);
528 double const chi_S_L_prev = chi(S_L_prev);
530 double const p_FR = -chi_S_L * p_cap_ip;
531 variables[
static_cast<int>(MPL::Variable::effective_pore_pressure)] =
533 variables_prev[
static_cast<int>(
534 MPL::Variable::effective_pore_pressure)] =
535 -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt);
538 variables[
static_cast<int>(MPL::Variable::volumetric_strain)]
539 .emplace<double>(Invariants::trace(_ip_data[ip].eps));
540 variables_prev[
static_cast<int>(MPL::Variable::volumetric_strain)]
541 .emplace<double>(Invariants::trace(B * (u - u_dot * dt)));
543 auto& phi = _ip_data[ip].porosity;
546 _ip_data[ip].porosity_prev;
548 .template value<double>(variables, variables_prev,
556 "RichardsMechanics: Biot-coefficient {} is smaller than "
557 "porosity {} in element/integration point {}/{}.",
558 alpha, phi, _element.getID(), ip);
563 auto& sigma_sw = _ip_data[ip].sigma_sw;
564 auto const& sigma_sw_prev = _ip_data[ip].sigma_sw_prev;
568 sigma_sw = sigma_sw_prev;
569 if (solid_phase.hasProperty(
572 using DimMatrix = Eigen::Matrix<double, 3, 3>;
573 auto const sigma_sw_dot =
574 MathLib::KelvinVector::tensorToKelvin<DisplacementDim>(
577 .
template value<DimMatrix>(
578 variables, variables_prev, x_position, t, dt));
579 sigma_sw += sigma_sw_dot * dt;
583 std::get<double>(variables[
static_cast<int>(
584 MPL::Variable::volumetric_strain)]) +=
585 identity2.transpose() * C_el.inverse() * sigma_sw;
586 std::get<double>(variables_prev[
static_cast<int>(
587 MPL::Variable::volumetric_strain)]) +=
588 identity2.transpose() * C_el.inverse() * sigma_sw_prev;
593 variables_prev[
static_cast<int>(
595 _ip_data[ip].transport_porosity_prev;
597 _ip_data[ip].transport_porosity =
599 .template value<double>(variables, variables_prev,
602 _ip_data[ip].transport_porosity;
613 .template value<double>(variables, x_position, t, dt);
616 .template value<double>(variables, x_position, t, dt);
618 auto const& sigma_sw = _ip_data[ip].sigma_sw;
619 auto const& sigma_eff = _ip_data[ip].sigma_eff;
624 auto const sigma_total =
625 (sigma_eff -
alpha * p_FR * identity2).eval();
628 variables[
static_cast<int>(MPL::Variable::total_stress)]
629 .emplace<SymmetricTensor>(
634 variables[
static_cast<int>(
636 _ip_data[ip].material_state_variables->getEquivalentPlasticStrain();
638 auto const K_intrinsic = MPL::formEigenTensor<DisplacementDim>(
640 .value(variables, x_position, t, dt));
643 K_intrinsic * rho_LR * k_rel / mu;
650 ? eps + C_el.inverse() * sigma_sw
652 variables[
static_cast<int>(MPL::Variable::mechanical_strain)]
656 _ip_data[ip].updateConstitutiveRelation(variables, t, x_position, dt,
660 variables[
static_cast<int>(MPL::Variable::solid_grain_pressure)] =
661 p_FR - sigma_eff.dot(identity2) / (3 * (1 - phi));
664 .template value<double>(variables, x_position, t, dt);
669 double const rho = rho_SR * (1 - phi) + S_L * phi * rho_LR;
670 rhs.template segment<displacement_size>(displacement_index).noalias() -=
671 (B.transpose() * sigma_eff - N_u_op.transpose() * rho * b) * w;
676 auto const beta_LR = 1 / rho_LR *
678 .template dValue<double>(
679 variables, MPL::Variable::phase_pressure,
682 double const a0 = S_L * (
alpha - phi) * beta_SR;
684 double const specific_storage =
685 DeltaS_L_Deltap_cap * (p_cap_ip * a0 - phi) +
686 S_L * (phi * beta_LR + a0);
687 M.template block<pressure_size, pressure_size>(pressure_index,
689 .noalias() += N_p.transpose() * rho_LR * specific_storage * N_p * w;
691 K.template block<pressure_size, pressure_size>(pressure_index,
693 .noalias() += dNdx_p.transpose() * rho_K_over_mu * dNdx_p * w;
695 rhs.template segment<pressure_size>(pressure_index).noalias() +=
696 dNdx_p.transpose() * rho_LR * rho_K_over_mu * b * w;
701 K.template block<displacement_size, pressure_size>(displacement_index,
703 .noalias() -= B.transpose() *
alpha * chi_S_L * identity2 * N_p * w;
708 M.template block<pressure_size, displacement_size>(pressure_index,
710 .noalias() += N_p.transpose() * S_L * rho_LR *
alpha *
711 identity2.transpose() * B * w;
714 if (_process_data.apply_mass_lumping)
716 auto Mpp = M.template block<pressure_size, pressure_size>(
717 pressure_index, pressure_index);
718 Mpp = Mpp.colwise().sum().eval().asDiagonal();
722 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
723 typename IntegrationMethod,
int DisplacementDim>
725 ShapeFunctionPressure, IntegrationMethod,
727 assembleWithJacobian(
double const t,
double const dt,
728 std::vector<double>
const& local_x,
729 std::vector<double>
const& local_xdot,
730 const double ,
const double ,
731 std::vector<double>& ,
732 std::vector<double>& ,
733 std::vector<double>& local_rhs_data,
734 std::vector<double>& local_Jac_data)
736 assert(local_x.size() == pressure_size + displacement_size);
739 Eigen::Map<
typename ShapeMatricesTypePressure::template VectorType<
740 pressure_size>
const>(local_x.data() + pressure_index,
744 Eigen::Map<
typename ShapeMatricesTypeDisplacement::template VectorType<
745 displacement_size>
const>(local_x.data() + displacement_index,
749 Eigen::Map<
typename ShapeMatricesTypePressure::template VectorType<
750 pressure_size>
const>(local_xdot.data() + pressure_index,
753 Eigen::Map<
typename ShapeMatricesTypeDisplacement::template VectorType<
754 displacement_size>
const>(local_xdot.data() + displacement_index,
758 typename ShapeMatricesTypeDisplacement::template MatrixType<
759 displacement_size + pressure_size,
760 displacement_size + pressure_size>>(
761 local_Jac_data, displacement_size + pressure_size,
762 displacement_size + pressure_size);
765 typename ShapeMatricesTypeDisplacement::template VectorType<
766 displacement_size + pressure_size>>(
767 local_rhs_data, displacement_size + pressure_size);
771 DisplacementDim)>::identity2;
774 ShapeMatricesTypePressure::NodalMatrixType::Zero(pressure_size,
778 ShapeMatricesTypePressure::NodalMatrixType::Zero(pressure_size,
782 ShapeMatricesTypePressure::NodalMatrixType::Zero(pressure_size,
786 ShapeMatricesTypePressure::NodalMatrixType::Zero(pressure_size,
789 typename ShapeMatricesTypeDisplacement::template MatrixType<
790 displacement_size, pressure_size>
791 Kup = ShapeMatricesTypeDisplacement::template MatrixType<
792 displacement_size, pressure_size>::Zero(displacement_size,
795 typename ShapeMatricesTypeDisplacement::template MatrixType<
796 pressure_size, displacement_size>
797 Kpu = ShapeMatricesTypeDisplacement::template MatrixType<
798 pressure_size, displacement_size>::Zero(pressure_size,
801 auto const& medium = _process_data.media_map->getMedium(_element.getID());
802 auto const& liquid_phase = medium->phase(
"AqueousLiquid");
803 auto const& solid_phase = medium->phase(
"Solid");
810 unsigned const n_integration_points =
811 _integration_method.getNumberOfPoints();
812 for (
unsigned ip = 0; ip < n_integration_points; ip++)
815 auto const& w = _ip_data[ip].integration_weight;
817 auto const& N_u_op = _ip_data[ip].N_u_op;
819 auto const& N_u = _ip_data[ip].N_u;
820 auto const& dNdx_u = _ip_data[ip].dNdx_u;
822 auto const& N_p = _ip_data[ip].N_p;
823 auto const& dNdx_p = _ip_data[ip].dNdx_p;
831 ShapeFunctionDisplacement::NPOINTS,
833 dNdx_u, N_u, x_coord, _is_axially_symmetric);
843 variables[
static_cast<int>(MPL::Variable::phase_pressure)] = -p_cap_ip;
844 auto const temperature =
846 .template value<double>(variables, x_position, t, dt);
849 auto& eps = _ip_data[ip].eps;
850 auto& eps_m = _ip_data[ip].eps_m;
851 eps.noalias() = B * u;
852 auto const& sigma_eff = _ip_data[ip].sigma_eff;
853 auto& S_L = _ip_data[ip].saturation;
854 auto const S_L_prev = _ip_data[ip].saturation_prev;
857 .template value<double>(variables, x_position, t, dt);
859 auto const C_el = _ip_data[ip].computeElasticTangentStiffness(
860 t, x_position, dt, temperature);
864 _ip_data[ip].solid_material.getBulkModulus(t, x_position, &C_el);
865 variables[
static_cast<int>(MPL::Variable::grain_compressibility)] =
870 .template value<double>(variables, x_position, t, dt);
871 auto const& b = _process_data.specific_body_force;
874 .template value<double>(variables, x_position, t, dt);
875 variables[
static_cast<int>(MPL::Variable::liquid_saturation)] = S_L;
876 variables_prev[
static_cast<int>(MPL::Variable::liquid_saturation)] =
880 double const dS_L_dp_cap =
882 .template dValue<double>(variables,
887 double const DeltaS_L_Deltap_cap =
888 (p_cap_dot_ip == 0) ? dS_L_dp_cap
889 : (S_L - S_L_prev) / (dt * p_cap_dot_ip);
891 auto const chi = [medium, x_position, t, dt](
double const S_L)
894 vs[
static_cast<int>(MPL::Variable::liquid_saturation)] = S_L;
896 .template value<double>(vs, x_position, t, dt);
898 double const chi_S_L = chi(S_L);
899 double const chi_S_L_prev = chi(S_L_prev);
901 double const p_FR = -chi_S_L * p_cap_ip;
902 variables[
static_cast<int>(MPL::Variable::effective_pore_pressure)] =
904 variables_prev[
static_cast<int>(
905 MPL::Variable::effective_pore_pressure)] =
906 -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt);
909 variables[
static_cast<int>(MPL::Variable::volumetric_strain)]
910 .emplace<double>(Invariants::trace(_ip_data[ip].eps));
911 variables_prev[
static_cast<int>(MPL::Variable::volumetric_strain)]
912 .emplace<double>(Invariants::trace(B * (u - u_dot * dt)));
914 auto& phi = _ip_data[ip].porosity;
918 _ip_data[ip].porosity_prev;
920 .template value<double>(variables, variables_prev,
928 "RichardsMechanics: Biot-coefficient {} is smaller than "
929 "porosity {} in element/integration point {}/{}.",
930 alpha, phi, _element.getID(), ip);
935 .template value<double>(variables, x_position, t, dt);
938 updateSwellingStressAndVolumetricStrain<DisplacementDim>(
939 _ip_data[ip], *medium, solid_phase, C_el, rho_LR, mu,
940 _process_data.micro_porosity_parameters,
alpha, phi, p_cap_ip,
941 variables, variables_prev, x_position, t, dt);
947 variables_prev[
static_cast<int>(
949 _ip_data[ip].transport_porosity_prev;
951 _ip_data[ip].transport_porosity =
953 .template value<double>(variables, variables_prev,
956 _ip_data[ip].transport_porosity;
967 .template value<double>(variables, x_position, t, dt);
972 auto const sigma_total =
973 (_ip_data[ip].sigma_eff +
alpha * p_FR * identity2).eval();
975 variables[
static_cast<int>(MPL::Variable::total_stress)]
976 .emplace<SymmetricTensor>(
981 variables[
static_cast<int>(
983 _ip_data[ip].material_state_variables->getEquivalentPlasticStrain();
985 auto const K_intrinsic = MPL::formEigenTensor<DisplacementDim>(
987 .value(variables, x_position, t, dt));
994 auto& sigma_sw = _ip_data[ip].sigma_sw;
998 ? eps + C_el.inverse() * sigma_sw
1000 variables[
static_cast<int>(MPL::Variable::mechanical_strain)]
1004 auto C = _ip_data[ip].updateConstitutiveRelation(
1005 variables, t, x_position, dt, temperature);
1008 .template block<displacement_size, displacement_size>(
1009 displacement_index, displacement_index)
1010 .noalias() += B.transpose() * C * B * w;
1013 variables[
static_cast<int>(MPL::Variable::solid_grain_pressure)] =
1014 p_FR - sigma_eff.dot(identity2) / (3 * (1 - phi));
1017 .template value<double>(variables, x_position, t, dt);
1019 double const rho = rho_SR * (1 - phi) + S_L * phi * rho_LR;
1020 local_rhs.template segment<displacement_size>(displacement_index)
1022 (B.transpose() * sigma_eff - N_u_op.transpose() * rho * b) * w;
1027 Kup.noalias() += B.transpose() *
alpha * chi_S_L * identity2 * N_p * w;
1029 auto const dchi_dS_L =
1031 .template dValue<double>(variables,
1032 MPL::Variable::liquid_saturation,
1035 .template block<displacement_size, pressure_size>(
1036 displacement_index, pressure_index)
1037 .noalias() -= B.transpose() *
alpha *
1038 (chi_S_L + dchi_dS_L * p_cap_ip * dS_L_dp_cap) *
1039 identity2 * N_p * w;
1042 .template block<displacement_size, pressure_size>(
1043 displacement_index, pressure_index)
1045 N_u_op.transpose() * phi * rho_LR * dS_L_dp_cap * b * N_p * w;
1059 using DimMatrix = Eigen::Matrix<double, 3, 3>;
1060 auto const dsigma_sw_dS_L =
1061 MathLib::KelvinVector::tensorToKelvin<DisplacementDim>(
1064 .
template dValue<DimMatrix>(
1065 variables, variables_prev,
1066 MPL::Variable::liquid_saturation, x_position, t,
1069 .template block<displacement_size, pressure_size>(
1070 displacement_index, pressure_index)
1072 B.transpose() * dsigma_sw_dS_L * dS_L_dp_cap * N_p * w;
1077 if (_process_data.explicit_hm_coupling_in_unsaturated_zone)
1079 Kpu.noalias() += N_p.transpose() * chi_S_L_prev * rho_LR *
alpha *
1080 identity2.transpose() * B * w;
1084 Kpu.noalias() += N_p.transpose() * S_L * rho_LR *
alpha *
1085 identity2.transpose() * B * w;
1091 laplace_p.noalias() +=
1092 dNdx_p.transpose() * k_rel * rho_Ki_over_mu * dNdx_p * w;
1094 auto const beta_LR = 1 / rho_LR *
1096 .template dValue<double>(
1097 variables, MPL::Variable::phase_pressure,
1100 double const a0 = (
alpha - phi) * beta_SR;
1101 double const specific_storage_a_p = S_L * (phi * beta_LR + S_L * a0);
1102 double const specific_storage_a_S = phi - p_cap_ip * S_L * a0;
1104 double const dspecific_storage_a_p_dp_cap =
1105 dS_L_dp_cap * (phi * beta_LR + 2 * S_L * a0);
1106 double const dspecific_storage_a_S_dp_cap =
1107 -a0 * (S_L + p_cap_ip * dS_L_dp_cap);
1109 storage_p_a_p.noalias() +=
1110 N_p.transpose() * rho_LR * specific_storage_a_p * N_p * w;
1112 storage_p_a_S.noalias() -= N_p.transpose() * rho_LR *
1113 specific_storage_a_S * DeltaS_L_Deltap_cap *
1117 .template block<pressure_size, pressure_size>(pressure_index,
1119 .noalias() += N_p.transpose() * p_cap_dot_ip * rho_LR *
1120 dspecific_storage_a_p_dp_cap * N_p * w;
1122 storage_p_a_S_Jpp.noalias() -=
1123 N_p.transpose() * rho_LR *
1124 ((S_L - S_L_prev) * dspecific_storage_a_S_dp_cap +
1125 specific_storage_a_S * dS_L_dp_cap) /
1128 if (!_process_data.explicit_hm_coupling_in_unsaturated_zone)
1131 .template block<pressure_size, pressure_size>(pressure_index,
1133 .noalias() -= N_p.transpose() * rho_LR * dS_L_dp_cap *
alpha *
1134 identity2.transpose() * B * u_dot * N_p * w;
1137 double const dk_rel_dS_l =
1139 .template dValue<double>(variables,
1140 MPL::Variable::liquid_saturation,
1143 grad_p_cap = -dNdx_p * p_L;
1145 .template block<pressure_size, pressure_size>(pressure_index,
1147 .noalias() += dNdx_p.transpose() * rho_Ki_over_mu * grad_p_cap *
1148 dk_rel_dS_l * dS_L_dp_cap * N_p * w;
1151 .template block<pressure_size, pressure_size>(pressure_index,
1153 .noalias() += dNdx_p.transpose() * rho_LR * rho_Ki_over_mu * b *
1154 dk_rel_dS_l * dS_L_dp_cap * N_p * w;
1156 local_rhs.template segment<pressure_size>(pressure_index).noalias() +=
1157 dNdx_p.transpose() * rho_LR * k_rel * rho_Ki_over_mu * b * w;
1161 double const alpha_bar = _process_data.micro_porosity_parameters
1162 ->mass_exchange_coefficient;
1163 auto const p_L_m = _ip_data[ip].liquid_pressure_m;
1164 local_rhs.template segment<pressure_size>(pressure_index)
1166 N_p.transpose() * alpha_bar / mu * (-p_cap_ip - p_L_m) * w;
1169 .template block<pressure_size, pressure_size>(pressure_index,
1171 .noalias() += N_p.transpose() * alpha_bar / mu * N_p * w;
1172 if (p_cap_dot_ip != 0)
1174 double const p_L_m_prev = _ip_data[ip].liquid_pressure_m_prev;
1176 .template block<pressure_size, pressure_size>(
1177 pressure_index, pressure_index)
1178 .noalias() += N_p.transpose() * alpha_bar / mu *
1179 (p_L_m - p_L_m_prev) / (dt * p_cap_dot_ip) *
1185 if (_process_data.apply_mass_lumping)
1187 storage_p_a_p = storage_p_a_p.colwise().sum().eval().asDiagonal();
1188 storage_p_a_S = storage_p_a_S.colwise().sum().eval().asDiagonal();
1190 storage_p_a_S_Jpp.colwise().sum().eval().asDiagonal();
1195 .template block<pressure_size, pressure_size>(pressure_index,
1197 .noalias() += laplace_p + storage_p_a_p / dt + storage_p_a_S_Jpp;
1201 .template block<pressure_size, displacement_size>(pressure_index,
1203 .noalias() = Kpu / dt;
1206 local_rhs.template segment<pressure_size>(pressure_index).noalias() -=
1207 laplace_p * p_L + (storage_p_a_p + storage_p_a_S) * p_L_dot +
1211 local_rhs.template segment<displacement_size>(displacement_index)
1212 .noalias() += Kup * p_L;
1215 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1216 typename IntegrationMethod,
int DisplacementDim>
1218 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1219 DisplacementDim>::getSigma()
const
1221 constexpr
int kelvin_vector_size =
1224 return transposeInPlace<kelvin_vector_size>(
1225 [
this](std::vector<double>& values)
1226 {
return getIntPtSigma(0, {}, {}, values); });
1229 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1230 typename IntegrationMethod,
int DisplacementDim>
1232 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1236 std::vector<GlobalVector*>
const& ,
1237 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1238 std::vector<double>& cache)
const
1240 return ProcessLib::getIntegrationPointKelvinVectorData<DisplacementDim>(
1241 _ip_data, &IpData::sigma_eff, cache);
1244 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1245 typename IntegrationMethod,
int DisplacementDim>
1247 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1248 DisplacementDim>::getSwellingStress()
const
1250 constexpr
int kelvin_vector_size =
1253 return transposeInPlace<kelvin_vector_size>(
1254 [
this](std::vector<double>& values)
1255 {
return getIntPtSwellingStress(0, {}, {}, values); });
1258 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1259 typename IntegrationMethod,
int DisplacementDim>
1261 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1263 getIntPtSwellingStress(
1265 std::vector<GlobalVector*>
const& ,
1266 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1267 std::vector<double>& cache)
const
1269 constexpr
int kelvin_vector_size =
1271 auto const n_integration_points = _ip_data.size();
1275 double, kelvin_vector_size, Eigen::Dynamic, Eigen::RowMajor>>(
1276 cache, kelvin_vector_size, n_integration_points);
1278 for (
unsigned ip = 0; ip < n_integration_points; ++ip)
1280 auto const& sigma_sw = _ip_data[ip].sigma_sw;
1288 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1289 typename IntegrationMethod,
int DisplacementDim>
1291 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1292 DisplacementDim>::getEpsilon()
const
1294 constexpr
int kelvin_vector_size =
1297 return transposeInPlace<kelvin_vector_size>(
1298 [
this](std::vector<double>& values)
1299 {
return getIntPtEpsilon(0, {}, {}, values); });
1302 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1303 typename IntegrationMethod,
int DisplacementDim>
1305 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1309 std::vector<GlobalVector*>
const& ,
1310 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1311 std::vector<double>& cache)
const
1313 return ProcessLib::getIntegrationPointKelvinVectorData<DisplacementDim>(
1314 _ip_data, &IpData::eps, cache);
1317 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1318 typename IntegrationMethod,
int DisplacementDim>
1320 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1322 getMaterialStateVariableInternalState(
1325 MaterialStateVariables&)>
const& get_values_span,
1326 int const& n_components)
const
1329 _ip_data, &IpData::material_state_variables, get_values_span,
1333 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1334 typename IntegrationMethod,
int DisplacementDim>
1336 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1338 getIntPtDarcyVelocity(
1340 std::vector<GlobalVector*>
const& ,
1341 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1342 std::vector<double>& cache)
const
1344 unsigned const n_integration_points =
1345 _integration_method.getNumberOfPoints();
1349 double, DisplacementDim, Eigen::Dynamic, Eigen::RowMajor>>(
1350 cache, DisplacementDim, n_integration_points);
1352 for (
unsigned ip = 0; ip < n_integration_points; ip++)
1354 cache_matrix.col(ip).noalias() = _ip_data[ip].v_darcy;
1360 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1361 typename IntegrationMethod,
int DisplacementDim>
1363 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1364 DisplacementDim>::getSaturation()
const
1366 std::vector<double> result;
1367 getIntPtSaturation(0, {}, {}, result);
1371 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1372 typename IntegrationMethod,
int DisplacementDim>
1374 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1378 std::vector<GlobalVector*>
const& ,
1379 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1380 std::vector<double>& cache)
const
1386 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1387 typename IntegrationMethod,
int DisplacementDim>
1389 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1390 DisplacementDim>::getMicroSaturation()
const
1392 std::vector<double> result;
1393 getIntPtMicroSaturation(0, {}, {}, result);
1397 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1398 typename IntegrationMethod,
int DisplacementDim>
1400 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1402 getIntPtMicroSaturation(
1404 std::vector<GlobalVector*>
const& ,
1405 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1406 std::vector<double>& cache)
const
1409 _ip_data, &IpData::saturation_m, cache);
1412 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1413 typename IntegrationMethod,
int DisplacementDim>
1415 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1416 DisplacementDim>::getMicroPressure()
const
1418 std::vector<double> result;
1419 getIntPtMicroPressure(0, {}, {}, result);
1423 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1424 typename IntegrationMethod,
int DisplacementDim>
1426 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1428 getIntPtMicroPressure(
1430 std::vector<GlobalVector*>
const& ,
1431 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1432 std::vector<double>& cache)
const
1435 _ip_data, &IpData::liquid_pressure_m, cache);
1438 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1439 typename IntegrationMethod,
int DisplacementDim>
1441 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1442 DisplacementDim>::getPorosity()
const
1444 std::vector<double> result;
1445 getIntPtPorosity(0, {}, {}, result);
1449 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1450 typename IntegrationMethod,
int DisplacementDim>
1452 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1456 std::vector<GlobalVector*>
const& ,
1457 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1458 std::vector<double>& cache)
const
1464 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1465 typename IntegrationMethod,
int DisplacementDim>
1467 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1468 DisplacementDim>::getTransportPorosity()
const
1470 std::vector<double> result;
1471 getIntPtTransportPorosity(0, {}, {}, result);
1475 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1476 typename IntegrationMethod,
int DisplacementDim>
1478 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1480 getIntPtTransportPorosity(
1482 std::vector<GlobalVector*>
const& ,
1483 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1484 std::vector<double>& cache)
const
1490 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1491 typename IntegrationMethod,
int DisplacementDim>
1493 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1495 getIntPtDryDensitySolid(
1497 std::vector<GlobalVector*>
const& ,
1498 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
1499 std::vector<double>& cache)
const
1502 _ip_data, &IpData::dry_density_solid, cache);
1505 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1506 typename IntegrationMethod,
int DisplacementDim>
1508 ShapeFunctionPressure, IntegrationMethod,
1510 assembleWithJacobianForPressureEquations(
1511 const double ,
double const ,
1512 Eigen::VectorXd
const& ,
1513 Eigen::VectorXd
const& ,
const double ,
1514 const double , std::vector<double>& ,
1515 std::vector<double>& ,
1516 std::vector<double>& ,
1517 std::vector<double>& )
1519 OGS_FATAL(
"RichardsMechanics; The staggered scheme is not implemented.");
1522 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1523 typename IntegrationMethod,
int DisplacementDim>
1525 ShapeFunctionPressure, IntegrationMethod,
1527 assembleWithJacobianForDeformationEquations(
1528 const double ,
double const ,
1529 Eigen::VectorXd
const& ,
1530 Eigen::VectorXd
const& ,
const double ,
1531 const double , std::vector<double>& ,
1532 std::vector<double>& ,
1533 std::vector<double>& ,
1534 std::vector<double>& )
1536 OGS_FATAL(
"RichardsMechanics; The staggered scheme is not implemented.");
1539 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1540 typename IntegrationMethod,
int DisplacementDim>
1542 ShapeFunctionPressure, IntegrationMethod,
1544 assembleWithJacobianForStaggeredScheme(
1545 double const t,
double const dt, Eigen::VectorXd
const& local_x,
1546 Eigen::VectorXd
const& local_xdot,
const double dxdot_dx,
1547 const double dx_dx,
int const process_id,
1548 std::vector<double>& local_M_data, std::vector<double>& local_K_data,
1549 std::vector<double>& local_b_data, std::vector<double>& local_Jac_data)
1552 if (process_id == 0)
1554 assembleWithJacobianForPressureEquations(
1555 t, dt, local_x, local_xdot, dxdot_dx, dx_dx, local_M_data,
1556 local_K_data, local_b_data, local_Jac_data);
1561 assembleWithJacobianForDeformationEquations(
1562 t, dt, local_x, local_xdot, dxdot_dx, dx_dx, local_M_data, local_K_data,
1563 local_b_data, local_Jac_data);
1566 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1567 typename IntegrationMethod,
int DisplacementDim>
1569 ShapeFunctionPressure, IntegrationMethod,
1571 computeSecondaryVariableConcrete(
double const t,
double const dt,
1572 Eigen::VectorXd
const& local_x,
1573 Eigen::VectorXd
const& local_x_dot)
1575 auto p_L = local_x.template segment<pressure_size>(pressure_index);
1576 auto u = local_x.template segment<displacement_size>(displacement_index);
1578 auto p_L_dot = local_x_dot.template segment<pressure_size>(pressure_index);
1580 local_x_dot.template segment<displacement_size>(displacement_index);
1584 DisplacementDim)>::identity2;
1586 auto const& medium = _process_data.media_map->getMedium(_element.getID());
1587 auto const& liquid_phase = medium->phase(
"AqueousLiquid");
1588 auto const& solid_phase = medium->phase(
"Solid");
1595 unsigned const n_integration_points =
1596 _integration_method.getNumberOfPoints();
1598 double saturation_avg = 0;
1599 double porosity_avg = 0;
1602 KV sigma_avg = KV::Zero();
1604 for (
unsigned ip = 0; ip < n_integration_points; ip++)
1607 auto const& N_p = _ip_data[ip].N_p;
1608 auto const& N_u = _ip_data[ip].N_u;
1609 auto const& dNdx_u = _ip_data[ip].dNdx_u;
1611 auto const x_coord =
1617 ShapeFunctionDisplacement::NPOINTS,
1619 dNdx_u, N_u, x_coord, _is_axially_symmetric);
1624 double p_cap_dot_ip;
1629 variables[
static_cast<int>(MPL::Variable::phase_pressure)] = -p_cap_ip;
1631 auto const temperature =
1633 .template value<double>(variables, x_position, t, dt);
1636 auto& eps = _ip_data[ip].eps;
1637 eps.noalias() = B * u;
1638 auto& eps_m = _ip_data[ip].eps_m;
1639 auto& S_L = _ip_data[ip].saturation;
1640 auto const S_L_prev = _ip_data[ip].saturation_prev;
1642 .template value<double>(variables, x_position, t, dt);
1643 variables[
static_cast<int>(MPL::Variable::liquid_saturation)] = S_L;
1644 variables_prev[
static_cast<int>(MPL::Variable::liquid_saturation)] =
1647 auto const chi = [medium, x_position, t, dt](
double const S_L)
1650 vs.fill(std::numeric_limits<double>::quiet_NaN());
1651 vs[
static_cast<int>(MPL::Variable::liquid_saturation)] = S_L;
1653 .template value<double>(vs, x_position, t, dt);
1655 double const chi_S_L = chi(S_L);
1656 double const chi_S_L_prev = chi(S_L_prev);
1660 .template value<double>(variables, x_position, t, dt);
1662 auto const C_el = _ip_data[ip].computeElasticTangentStiffness(
1663 t, x_position, dt, temperature);
1665 auto const beta_SR =
1667 _ip_data[ip].solid_material.getBulkModulus(t, x_position, &C_el);
1668 variables[
static_cast<int>(MPL::Variable::grain_compressibility)] =
1671 variables[
static_cast<int>(MPL::Variable::effective_pore_pressure)] =
1672 -chi_S_L * p_cap_ip;
1673 variables_prev[
static_cast<int>(
1674 MPL::Variable::effective_pore_pressure)] =
1675 -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt);
1678 variables[
static_cast<int>(MPL::Variable::volumetric_strain)]
1679 .emplace<double>(Invariants::trace(_ip_data[ip].eps));
1680 variables_prev[
static_cast<int>(MPL::Variable::volumetric_strain)]
1681 .emplace<double>(Invariants::trace(B * (u - u_dot * dt)));
1683 auto& phi = _ip_data[ip].porosity;
1686 _ip_data[ip].porosity_prev;
1688 .template value<double>(variables, variables_prev,
1695 .template value<double>(variables, x_position, t, dt);
1698 .template value<double>(variables, x_position, t, dt);
1701 updateSwellingStressAndVolumetricStrain<DisplacementDim>(
1702 _ip_data[ip], *medium, solid_phase, C_el, rho_LR, mu,
1703 _process_data.micro_porosity_parameters,
alpha, phi, p_cap_ip,
1704 variables, variables_prev, x_position, t, dt);
1710 variables_prev[
static_cast<int>(
1712 _ip_data[ip].transport_porosity_prev;
1714 _ip_data[ip].transport_porosity =
1716 .template value<double>(variables, variables_prev,
1719 _ip_data[ip].transport_porosity;
1731 auto const sigma_total = (_ip_data[ip].sigma_eff +
1732 alpha * chi_S_L * identity2 * p_cap_ip)
1735 variables[
static_cast<int>(MPL::Variable::total_stress)]
1736 .emplace<SymmetricTensor>(
1741 variables[
static_cast<int>(
1743 _ip_data[ip].material_state_variables->getEquivalentPlasticStrain();
1745 auto const K_intrinsic = MPL::formEigenTensor<DisplacementDim>(
1747 .value(variables, x_position, t, dt));
1749 double const k_rel =
1751 .template value<double>(variables, x_position, t, dt);
1755 auto const& sigma_eff = _ip_data[ip].sigma_eff;
1756 double const p_FR = -chi_S_L * p_cap_ip;
1758 variables[
static_cast<int>(MPL::Variable::solid_grain_pressure)] =
1759 p_FR - sigma_eff.dot(identity2) / (3 * (1 - phi));
1762 .template value<double>(variables, x_position, t, dt);
1763 _ip_data[ip].dry_density_solid = (1 - phi) * rho_SR;
1765 auto& sigma_sw = _ip_data[ip].sigma_sw;
1769 ? eps + C_el.inverse() * sigma_sw
1771 variables[
static_cast<int>(MPL::Variable::mechanical_strain)]
1775 _ip_data[ip].updateConstitutiveRelation(variables, t, x_position, dt,
1778 auto const& b = _process_data.specific_body_force;
1781 auto const& dNdx_p = _ip_data[ip].dNdx_p;
1782 _ip_data[ip].v_darcy.noalias() =
1783 -K_over_mu * dNdx_p * p_L + rho_LR * K_over_mu * b;
1785 saturation_avg += S_L;
1786 porosity_avg += phi;
1787 sigma_avg += sigma_eff;
1789 saturation_avg /= n_integration_points;
1790 porosity_avg /= n_integration_points;
1791 sigma_avg /= n_integration_points;
1793 (*_process_data.element_saturation)[_element.getID()] = saturation_avg;
1794 (*_process_data.element_porosity)[_element.getID()] = porosity_avg;
1796 Eigen::Map<KV>(&(*_process_data.element_stresses)[_element.getID() *
1797 KV::RowsAtCompileTime]) =
1801 ShapeFunctionPressure,
typename ShapeFunctionDisplacement::MeshElement,
1802 DisplacementDim>(_element, _is_axially_symmetric, p_L,
1803 *_process_data.pressure_interpolated);
1806 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1807 typename IntegrationMethod,
int DisplacementDim>
1809 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1810 DisplacementDim>::getNumberOfIntegrationPoints()
const
1812 return _integration_method.getNumberOfPoints();
1815 template <
typename ShapeFunctionDisplacement,
typename ShapeFunctionPressure,
1816 typename IntegrationMethod,
int DisplacementDim>
1818 DisplacementDim>::MaterialStateVariables
const&
1820 ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod,
1821 DisplacementDim>::getMaterialStateVariablesAt(
unsigned integration_point)
1824 return *_ip_data[integration_point].material_state_variables;
void ERR(char const *fmt, Args const &... args)
void DBUG(char const *fmt, Args const &... args)
Property const & property(PropertyType const &p) const
bool hasProperty(PropertyType const &p) const
Property const & property(PropertyType const &p) const
bool hasProperty(PropertyType const &p) const
virtual std::size_t getID() const final
Returns the ID of the element.
void setElementID(std::size_t element_id)
void setIntegrationPoint(unsigned integration_point)
MatrixType< _kelvin_vector_size, _number_of_dof > BMatrixType
RichardsMechanicsProcessData< DisplacementDim > & _process_data
ShapeMatrixPolicyType< ShapeFunctionDisplacement, DisplacementDim > ShapeMatricesTypeDisplacement
ShapeMatrixPolicyType< ShapeFunctionPressure, DisplacementDim > ShapeMatricesTypePressure
static const int displacement_size
std::vector< IpData, Eigen::aligned_allocator< IpData > > _ip_data
IntegrationMethod _integration_method
SecondaryData< typename ShapeMatricesTypeDisplacement::ShapeMatrices::ShapeType > _secondary_data
MeshLib::Element const & _element
typename ShapeMatricesTypePressure::GlobalDimMatrixType GlobalDimMatrixType
MechanicsBase< DisplacementDim > & selectSolidConstitutiveRelation(std::map< int, std::unique_ptr< MechanicsBase< DisplacementDim >>> const &constitutive_relations, MeshLib::PropertyVector< int > const *const material_ids, std::size_t const element_id)
@ equivalent_plastic_strain
std::array< VariableType, static_cast< int >(Variable::number_of_variables)> VariableArray
@ saturation_micro
capillary pressure saturation relationship for microstructure.
@ bishops_effective_stress
Eigen::Matrix< double, 4, 1 > kelvinVectorToSymmetricTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
double interpolateXCoordinate(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
void shapeFunctionInterpolate(const NodalValues &nodal_values, const ShapeMatrix &shape_matrix_N, double &interpolated_value, ScalarTypes &... interpolated_values)
void interpolateToHigherOrderNodes(MeshLib::Element const &element, bool const is_axially_symmetric, Eigen::MatrixBase< EigenMatrixType > const &node_values, MeshLib::PropertyVector< double > &interpolated_values_global_vector)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)
BMatrixType computeBMatrix(DNDX_Type const &dNdx, N_Type const &N, const double radius, const bool is_axially_symmetric)
Fills a B-matrix based on given shape function dN/dx values.
void updateSwellingStressAndVolumetricStrain(IPData &ip_data, MaterialPropertyLib::Medium const &medium, MaterialPropertyLib::Phase const &solid_phase, MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > const &C_el, double const rho_LR, double const mu, std::optional< MicroPorosityParameters > micro_porosity_parameters, double const alpha, double const phi, double const p_cap_ip, MPL::VariableArray &variables, MPL::VariableArray &variables_prev, ParameterLib::SpatialPosition const &x_position, double const t, double const dt)
std::vector< double > const & getIntegrationPointScalarData(std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &ip_data, MemberType member, std::vector< double > &cache)
std::vector< double > getIntegrationPointDataMaterialStateVariables(std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &ip_data_vector, MemberType member, std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> get_values_span, int const n_components)
std::size_t setIntegrationPointScalarData(double const *values, std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &ip_data, MemberType member)
std::size_t setIntegrationPointDataMaterialStateVariables(double const *values, std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &ip_data_vector, MemberType member, std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> get_values_span)
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
VectorType< GlobalDim > GlobalDimVectorType
std::vector< ShapeMatrixType, Eigen::aligned_allocator< ShapeMatrixType > > N_u