88 updateConstitutiveVariables(
89 Eigen::VectorXd
const& local_x, Eigen::VectorXd
const& local_x_prev,
90 double const t,
double const dt,
94 [[maybe_unused]]
auto const matrix_size =
95 gas_pressure_size + capillary_pressure_size + temperature_size +
98 assert(local_x.size() == matrix_size);
100 auto const gas_pressure =
101 local_x.template segment<gas_pressure_size>(gas_pressure_index);
102 auto const capillary_pressure =
103 local_x.template segment<capillary_pressure_size>(
104 capillary_pressure_index);
106 auto const temperature =
107 local_x.template segment<temperature_size>(temperature_index);
108 auto const temperature_prev =
109 local_x_prev.template segment<temperature_size>(temperature_index);
111 auto const displacement =
112 local_x.template segment<displacement_size>(displacement_index);
113 auto const displacement_prev =
114 local_x_prev.template segment<displacement_size>(displacement_index);
117 *this->process_data_.media_map.getMedium(this->element_.getID());
120 unsigned const n_integration_points =
121 this->integration_method_.getNumberOfPoints();
123 std::vector<ConstitutiveRelations::ConstitutiveData<DisplacementDim>>
124 ip_constitutive_data(n_integration_points);
125 std::vector<ConstitutiveRelations::ConstitutiveTempData<DisplacementDim>>
126 ip_constitutive_variables(n_integration_points);
128 for (
unsigned ip = 0; ip < n_integration_points; ip++)
130 auto& ip_data = _ip_data[ip];
131 auto& ip_cv = ip_constitutive_variables[ip];
132 auto& ip_cd = ip_constitutive_data[ip];
133 auto& ip_out = this->output_data_[ip];
134 auto& current_state = this->current_states_[ip];
135 auto& prev_state = this->prev_states_[ip];
137 auto const& Np = ip_data.N_p;
139 auto const& Nu = ip_data.N_u;
140 auto const& gradNu = ip_data.dNdx_u;
141 auto const& gradNp = ip_data.dNdx_p;
143 std::nullopt, this->element_.getID(), ip,
147 this->element_, Nu))};
153 double const T = NT.dot(temperature);
154 double const T_prev = NT.dot(temperature_prev);
157 Np.dot(gas_pressure)};
159 Np.dot(capillary_pressure)};
161 this->process_data_.reference_temperature(t, pos)[0]};
163 grad_p_GR{gradNp * gas_pressure};
165 DisplacementDim>
const grad_p_cap{gradNp * capillary_pressure};
167 grad_T{gradNp * temperature};
173 models.
biot_model.
eval({pos, t, dt}, media_data, ip_cv.biot_data);
177 ShapeFunctionDisplacement::NPOINTS,
179 gradNu, Nu, x_coord, this->is_axially_symmetric_);
181 ip_out.eps_data.eps.noalias() = Bu * displacement;
183 current_state.S_L_data);
186 current_state.S_L_data, ip_cv.chi_S_L);
190 ip_cv.C_el_data, ip_cv.beta_p_SR);
194 {pos, t, dt}, media_data, ip_cv.C_el_data, current_state.S_L_data,
195 prev_state.S_L_data, prev_state.swelling_data,
196 current_state.swelling_data, ip_cv.swelling_data);
200 ip_cv.s_therm_exp_data);
203 T_data, ip_cv.s_therm_exp_data, ip_out.eps_data,
204 Bu * displacement_prev, prev_state.mechanical_strain_data,
205 ip_cv.swelling_data, current_state.mechanical_strain_data);
208 {pos, t, dt}, T_data, current_state.mechanical_strain_data,
209 prev_state.mechanical_strain_data, prev_state.eff_stress_data,
210 current_state.eff_stress_data, this->material_states_[ip],
211 ip_cd.s_mech_data, ip_cv.equivalent_plastic_strain_data);
214 ip_cv.biot_data, ip_cv.chi_S_L, pGR_data,
215 pCap_data, ip_cv.total_stress_data);
218 {pos, t, dt}, media_data, current_state.S_L_data, pCap_data, T_data,
219 ip_cv.total_stress_data, ip_out.eps_data,
220 ip_cv.equivalent_plastic_strain_data, ip_out.permeability_data);
223 pGR_data, pCap_data, T_data,
224 current_state.rho_W_LR);
227 {pos, t, dt}, media_data, pGR_data, pCap_data, T_data,
228 current_state.rho_W_LR, ip_out.fluid_enthalpy_data,
229 ip_out.mass_mole_fractions_data, ip_out.fluid_density_data,
230 ip_out.vapour_pressure_data, current_state.constituent_density_data,
231 ip_cv.phase_transition_data);
234 ip_out.mass_mole_fractions_data,
235 ip_cv.viscosity_data);
238#ifdef NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
239 ip_cv.biot_data, ip_out.eps_data,
240 ip_cv.s_therm_exp_data,
242 ip_out.porosity_data);
245#ifdef NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
246 ip_cv.biot_data, ip_out.eps_data,
247 ip_cv.s_therm_exp_data,
249 ip_out.solid_density_data);
252 ip_cv.solid_heat_capacity_data);
255 {pos, t, dt}, media_data, T_data, ip_out.porosity_data,
256 current_state.S_L_data, ip_cv.thermal_conductivity_data);
259 ip_out.permeability_data,
260 current_state.rho_W_LR,
261 ip_cv.viscosity_data,
262 ip_cv.advection_data);
265 ip_out.fluid_density_data,
266 ip_out.porosity_data,
267 current_state.S_L_data,
268 ip_out.solid_density_data,
270 this->process_data_.specific_body_force},
271 ip_cv.volumetric_body_force);
275 ip_out.mass_mole_fractions_data,
276 ip_cv.phase_transition_data,
277 ip_out.porosity_data,
278 current_state.S_L_data,
280 ip_out.diffusion_velocity_data);
283 ip_out.solid_enthalpy_data);
286 ip_cv.phase_transition_data,
287 ip_out.porosity_data,
288 current_state.S_L_data,
289 ip_out.solid_density_data,
290 ip_out.solid_enthalpy_data,
291 current_state.internal_energy_data);
294 ip_out.fluid_density_data,
295 ip_out.fluid_enthalpy_data,
296 ip_out.porosity_data,
297 current_state.S_L_data,
298 ip_out.solid_density_data,
299 ip_out.solid_enthalpy_data,
300 ip_cv.effective_volumetric_enthalpy_data);
302 models.
fC_1_model.eval(ip_cv.advection_data, ip_out.fluid_density_data,
305 if (!this->process_data_.apply_mass_lumping)
309 current_state.constituent_density_data,
310 ip_out.porosity_data,
311 current_state.S_L_data,
316 current_state.constituent_density_data,
317 prev_state.constituent_density_data,
318 current_state.S_L_data,
322 ip_out.fluid_density_data,
323 ip_cv.phase_transition_data,
324 ip_out.porosity_data,
325 current_state.S_L_data,
329 ip_out.fluid_density_data,
330 ip_cv.phase_transition_data,
331 ip_out.porosity_data,
332 current_state.S_L_data,
336 ip_cv.phase_transition_data,
337 ip_out.porosity_data,
338 current_state.S_L_data,
342 current_state.constituent_density_data,
343 ip_out.porosity_data,
344 current_state.S_L_data,
350 current_state.constituent_density_data,
351 ip_out.porosity_data,
353 current_state.S_L_data,
358 current_state.constituent_density_data,
359 ip_out.porosity_data,
360 current_state.S_L_data,
361 ip_cv.s_therm_exp_data,
365 current_state.constituent_density_data,
366 current_state.S_L_data,
369 models.
fW_1_model.eval(ip_cv.advection_data, ip_out.fluid_density_data,
372 if (!this->process_data_.apply_mass_lumping)
376 current_state.constituent_density_data,
377 ip_out.porosity_data,
378 current_state.rho_W_LR,
379 current_state.S_L_data,
384 current_state.constituent_density_data,
385 prev_state.constituent_density_data,
387 current_state.rho_W_LR,
388 current_state.S_L_data,
392 ip_out.fluid_density_data,
393 ip_cv.phase_transition_data,
394 ip_out.porosity_data,
395 current_state.S_L_data,
399 ip_out.fluid_density_data,
400 ip_cv.phase_transition_data,
401 ip_out.porosity_data,
402 current_state.S_L_data,
406 ip_cv.phase_transition_data,
407 ip_out.porosity_data,
408 current_state.S_L_data,
412 current_state.constituent_density_data,
413 ip_out.porosity_data,
414 current_state.rho_W_LR,
415 current_state.S_L_data,
421 current_state.constituent_density_data,
422 ip_out.porosity_data,
424 current_state.rho_W_LR,
425 current_state.S_L_data,
430 current_state.constituent_density_data,
431 ip_out.porosity_data,
432 current_state.rho_W_LR,
433 current_state.S_L_data,
434 ip_cv.s_therm_exp_data,
438 current_state.constituent_density_data,
439 current_state.rho_W_LR,
440 current_state.S_L_data,
444 current_state.internal_energy_data,
445 prev_state.internal_energy_data,
454 ip_out.fluid_density_data,
456 ip_out.permeability_data,
458 this->process_data_.specific_body_force},
459 ip_cv.viscosity_data,
460 ip_out.darcy_velocity_data);
462 models.
fT_2_model.eval(ip_out.darcy_velocity_data,
463 ip_out.fluid_density_data,
464 ip_out.fluid_enthalpy_data,
468 current_state.constituent_density_data,
469 ip_out.darcy_velocity_data,
470 ip_out.diffusion_velocity_data,
471 ip_out.fluid_density_data,
472 ip_cv.phase_transition_data,
474 this->process_data_.specific_body_force},
481 return {ip_constitutive_data, ip_constitutive_variables};
489 updateConstitutiveVariablesDerivatives(
490 Eigen::VectorXd
const& local_x, Eigen::VectorXd
const& local_x_prev,
491 double const t,
double const dt,
494 ip_constitutive_data,
497 ip_constitutive_variables,
501 [[maybe_unused]]
auto const matrix_size =
502 gas_pressure_size + capillary_pressure_size + temperature_size +
505 assert(local_x.size() == matrix_size);
507 auto const temperature =
508 local_x.template segment<temperature_size>(temperature_index);
509 auto const temperature_prev =
510 local_x_prev.template segment<temperature_size>(temperature_index);
512 auto const capillary_pressure =
513 local_x.template segment<capillary_pressure_size>(
514 capillary_pressure_index);
517 *this->process_data_.media_map.getMedium(this->element_.getID());
520 unsigned const n_integration_points =
521 this->integration_method_.getNumberOfPoints();
523 std::vector<ConstitutiveRelations::DerivativesData<DisplacementDim>>
524 ip_d_data(n_integration_points);
526 for (
unsigned ip = 0; ip < n_integration_points; ip++)
528 auto const& ip_data = _ip_data[ip];
529 auto& ip_dd = ip_d_data[ip];
530 auto const& ip_cd = ip_constitutive_data[ip];
531 auto const& ip_cv = ip_constitutive_variables[ip];
532 auto const& ip_out = this->output_data_[ip];
533 auto const& current_state = this->current_states_[ip];
534 auto const& prev_state = this->prev_states_[ip];
536 auto const& Nu = ip_data.N_u;
537 auto const& Np = ip_data.N_p;
541 std::nullopt, this->element_.getID(), ip,
545 this->element_, Nu))};
547 double const T = NT.dot(temperature);
548 double const T_prev = NT.dot(temperature_prev);
551 Np.dot(capillary_pressure)};
557 ip_out.permeability_data,
558 ip_cv.viscosity_data,
560 ip_cv.phase_transition_data,
561 ip_dd.advection_d_data);
564 {pos, t, dt}, media_data, ip_out.porosity_data, ip_dd.dS_L_dp_cap,
565#ifdef NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
566 ip_cv.biot_data, ip_out.eps_data, ip_cv.s_therm_exp_data,
568 ip_dd.porosity_d_data);
571 {pos, t, dt}, media_data, T_data, ip_out.porosity_data,
572 ip_dd.porosity_d_data, current_state.S_L_data,
573 ip_dd.thermal_conductivity_d_data);
576#ifdef NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
577 ip_cv.biot_data, ip_out.eps_data,
578 ip_cv.s_therm_exp_data,
580 ip_dd.solid_density_d_data);
583 ip_out.fluid_density_data,
584 ip_cv.phase_transition_data,
585 ip_out.porosity_data,
586 ip_dd.porosity_d_data,
587 current_state.S_L_data,
588 ip_out.solid_density_data,
589 ip_dd.solid_density_d_data,
590 ip_out.solid_enthalpy_data,
591 ip_cv.solid_heat_capacity_data,
592 ip_dd.effective_volumetric_internal_energy_d_data);
595 ip_out.fluid_density_data,
596 ip_out.fluid_enthalpy_data,
597 ip_cv.phase_transition_data,
598 ip_out.porosity_data,
599 ip_dd.porosity_d_data,
600 current_state.S_L_data,
601 ip_out.solid_density_data,
602 ip_dd.solid_density_d_data,
603 ip_out.solid_enthalpy_data,
604 ip_cv.solid_heat_capacity_data,
605 ip_dd.effective_volumetric_enthalpy_d_data);
606 if (!this->process_data_.apply_mass_lumping)
610 current_state.constituent_density_data,
611 ip_cv.phase_transition_data,
612 ip_out.porosity_data,
613 ip_dd.porosity_d_data,
614 current_state.S_L_data,
620 current_state.constituent_density_data,
621 prev_state.constituent_density_data,
622 ip_cv.phase_transition_data,
623 current_state.S_L_data,
628 ip_cv.viscosity_data,
629 ip_cv.phase_transition_data,
630 ip_dd.advection_d_data,
634 ip_out.permeability_data,
635 ip_cv.phase_transition_data,
637 ip_cv.viscosity_data,
641 current_state.constituent_density_data,
642 ip_cv.phase_transition_data,
643 ip_out.porosity_data,
644 ip_dd.porosity_d_data,
645 current_state.S_L_data,
650 current_state.constituent_density_data,
651 ip_cv.phase_transition_data,
652 ip_out.porosity_data,
653 ip_dd.porosity_d_data,
654 current_state.S_L_data,
655 ip_cv.s_therm_exp_data,
659 ip_cv.phase_transition_data,
660 current_state.S_L_data,
663 if (!this->process_data_.apply_mass_lumping)
667 current_state.constituent_density_data,
668 ip_cv.phase_transition_data,
669 ip_out.porosity_data,
670 ip_dd.porosity_d_data,
671 current_state.rho_W_LR,
672 current_state.S_L_data,
679 current_state.constituent_density_data,
680 ip_cv.phase_transition_data,
681 prev_state.constituent_density_data,
683 current_state.rho_W_LR,
684 current_state.S_L_data,
689 ip_out.permeability_data,
690 ip_cv.phase_transition_data,
691 current_state.rho_W_LR,
693 ip_cv.viscosity_data,
697 ip_out.fluid_density_data,
698 ip_out.permeability_data,
699 ip_cv.phase_transition_data,
700 ip_out.porosity_data,
701 current_state.rho_W_LR,
702 current_state.S_L_data,
704 ip_cv.viscosity_data,
708 dt, ip_dd.effective_volumetric_internal_energy_d_data, ip_dd.dfT_1);
711 ip_out.darcy_velocity_data,
712 ip_out.fluid_density_data,
713 ip_out.fluid_enthalpy_data,
714 ip_out.permeability_data,
715 ip_cv.phase_transition_data,
717 this->process_data_.specific_body_force},
718 ip_cv.viscosity_data,
721 models.
fu_1_KuT_model.dEval(ip_cd.s_mech_data, ip_cv.s_therm_exp_data,
799 setInitialConditionsConcrete(Eigen::VectorXd
const local_x,
803 [[maybe_unused]]
auto const matrix_size =
804 gas_pressure_size + capillary_pressure_size + temperature_size +
807 assert(local_x.size() == matrix_size);
809 auto const capillary_pressure =
810 local_x.template segment<capillary_pressure_size>(
811 capillary_pressure_index);
814 local_x.template segment<gas_pressure_size>(gas_pressure_index);
816 auto const temperature =
817 local_x.template segment<temperature_size>(temperature_index);
819 auto const displacement =
820 local_x.template segment<displacement_size>(displacement_index);
822 constexpr double dt = std::numeric_limits<double>::quiet_NaN();
824 *this->process_data_.media_map.getMedium(this->element_.getID());
825 auto const& solid_phase = medium.phase(
"Solid");
828 this->solid_material_, *this->process_data_.phase_transition_model_};
830 unsigned const n_integration_points =
831 this->integration_method_.getNumberOfPoints();
833 for (
unsigned ip = 0; ip < n_integration_points; ip++)
837 auto& ip_data = _ip_data[ip];
838 auto& ip_out = this->output_data_[ip];
839 auto& prev_state = this->prev_states_[ip];
840 auto const& Np = ip_data.N_p;
842 auto const& Nu = ip_data.N_u;
843 auto const& gradNu = ip_data.dNdx_u;
849 std::nullopt, this->element_.getID(), ip,
853 this->element_, ip_data.N_u))};
855 double const pCap = Np.dot(capillary_pressure);
858 double const T = NT.dot(temperature);
865 ShapeFunctionDisplacement::NPOINTS,
867 gradNu, Nu, x_coord, this->is_axially_symmetric_);
869 auto& eps = ip_out.eps_data.eps;
870 eps.noalias() = Bu * displacement;
876 medium.property(MPL::PropertyType::saturation)
877 .template value<double>(
878 vars, pos, t, std::numeric_limits<double>::quiet_NaN());
879 this->prev_states_[ip].S_L_data->S_L = S_L;
886 models.elastic_tangent_stiffness_model.eval({pos, t, dt}, T_data,
892 auto const& sigma_sw = this->current_states_[ip].swelling_data.sigma_sw;
893 prev_state.mechanical_strain_data->eps_m.noalias() =
894 solid_phase.hasProperty(MPL::PropertyType::swelling_stress_rate)
895 ? eps + C_el.inverse() * sigma_sw
898 if (this->process_data_.initial_stress.isTotalStress())
901 medium.property(MPL::PropertyType::biot_coefficient)
902 .template value<double>(vars, pos, t, 0.0 );
905 double const bishop =
906 medium.property(MPL::PropertyType::bishops_effective_stress)
907 .template value<double>(vars, pos, t, 0.0 );
909 this->current_states_[ip].eff_stress_data.sigma.noalias() +=
910 alpha_b * Np.dot(p_GR - bishop * capillary_pressure) *
911 Invariants::identity2;
912 this->prev_states_[ip].eff_stress_data =
913 this->current_states_[ip].eff_stress_data;
918 updateConstitutiveVariables(local_x, local_x, t, 0, models);
920 for (
unsigned ip = 0; ip < n_integration_points; ip++)
922 this->material_states_[ip].pushBackState();
923 this->prev_states_[ip] = this->current_states_[ip];
931 DisplacementDim>::assemble(
double const t,
double const dt,
932 std::vector<double>
const& local_x,
933 std::vector<double>
const& local_x_prev,
934 std::vector<double>& local_M_data,
935 std::vector<double>& local_K_data,
936 std::vector<double>& local_rhs_data)
938 auto const matrix_size = gas_pressure_size + capillary_pressure_size +
939 temperature_size + displacement_size;
940 assert(local_x.size() == matrix_size);
942 auto const capillary_pressure =
943 Eigen::Map<VectorType<capillary_pressure_size>
const>(
944 local_x.data() + capillary_pressure_index, capillary_pressure_size);
946 auto const capillary_pressure_prev =
947 Eigen::Map<VectorType<capillary_pressure_size>
const>(
948 local_x_prev.data() + capillary_pressure_index,
949 capillary_pressure_size);
954 local_M_data, matrix_size, matrix_size);
959 local_K_data, matrix_size, matrix_size);
963 local_rhs_data, matrix_size);
969 auto MCpG = local_M.template block<C_size, gas_pressure_size>(
970 C_index, gas_pressure_index);
971 auto MCpC = local_M.template block<C_size, capillary_pressure_size>(
972 C_index, capillary_pressure_index);
973 auto MCT = local_M.template block<C_size, temperature_size>(
974 C_index, temperature_index);
975 auto MCu = local_M.template block<C_size, displacement_size>(
976 C_index, displacement_index);
979 auto LCpG = local_K.template block<C_size, gas_pressure_size>(
980 C_index, gas_pressure_index);
981 auto LCpC = local_K.template block<C_size, capillary_pressure_size>(
982 C_index, capillary_pressure_index);
983 auto LCT = local_K.template block<C_size, temperature_size>(
984 C_index, temperature_index);
987 auto MWpG = local_M.template block<W_size, gas_pressure_size>(
988 W_index, gas_pressure_index);
989 auto MWpC = local_M.template block<W_size, capillary_pressure_size>(
990 W_index, capillary_pressure_index);
991 auto MWT = local_M.template block<W_size, temperature_size>(
992 W_index, temperature_index);
993 auto MWu = local_M.template block<W_size, displacement_size>(
994 W_index, displacement_index);
997 auto LWpG = local_K.template block<W_size, gas_pressure_size>(
998 W_index, gas_pressure_index);
999 auto LWpC = local_K.template block<W_size, capillary_pressure_size>(
1000 W_index, capillary_pressure_index);
1001 auto LWT = local_K.template block<W_size, temperature_size>(
1002 W_index, temperature_index);
1005 auto MTu = local_M.template block<temperature_size, displacement_size>(
1006 temperature_index, displacement_index);
1009 auto KTT = local_K.template block<temperature_size, temperature_size>(
1010 temperature_index, temperature_index);
1013 auto KUpG = local_K.template block<displacement_size, gas_pressure_size>(
1014 displacement_index, gas_pressure_index);
1016 local_K.template block<displacement_size, capillary_pressure_size>(
1017 displacement_index, capillary_pressure_index);
1020 auto fC = local_f.template segment<C_size>(C_index);
1022 auto fW = local_f.template segment<W_size>(W_index);
1024 auto fT = local_f.template segment<temperature_size>(temperature_index);
1026 auto fU = local_f.template segment<displacement_size>(displacement_index);
1028 unsigned const n_integration_points =
1029 this->integration_method_.getNumberOfPoints();
1032 this->solid_material_, *this->process_data_.phase_transition_model_};
1034 auto const [ip_constitutive_data, ip_constitutive_variables] =
1035 updateConstitutiveVariables(
1036 Eigen::Map<Eigen::VectorXd const>(local_x.data(), local_x.size()),
1037 Eigen::Map<Eigen::VectorXd const>(local_x_prev.data(),
1038 local_x_prev.size()),
1041 for (
unsigned int_point = 0; int_point < n_integration_points; int_point++)
1043 auto& ip = _ip_data[int_point];
1044 auto& ip_cv = ip_constitutive_variables[int_point];
1045 auto& ip_out = this->output_data_[int_point];
1046 auto& current_state = this->current_states_[int_point];
1047 auto const& prev_state = this->prev_states_[int_point];
1049 auto const& Np = ip.N_p;
1050 auto const& NT = Np;
1051 auto const& Nu = ip.N_u;
1053 std::nullopt, this->element_.getID(), int_point,
1057 this->element_, Nu))};
1059 auto const& NpT = Np.transpose().eval();
1060 auto const& NTT = NT.transpose().eval();
1062 auto const& gradNp = ip.dNdx_p;
1063 auto const& gradNT = gradNp;
1064 auto const& gradNu = ip.dNdx_u;
1066 auto const& gradNpT = gradNp.transpose().eval();
1067 auto const& gradNTT = gradNT.transpose().eval();
1069 auto const& w = ip.integration_weight;
1071 auto const x_coord =
1074 this->element_, Nu);
1078 ShapeFunctionDisplacement::NPOINTS,
1080 gradNu, Nu, x_coord, this->is_axially_symmetric_);
1082 auto const NTN = (Np.transpose() * Np).eval();
1083 auto const BTI2N = (Bu.transpose() * Invariants::identity2 * Np).eval();
1085 double const pCap = Np.dot(capillary_pressure);
1086 double const pCap_prev = Np.dot(capillary_pressure_prev);
1088 auto const s_L = current_state.S_L_data.S_L;
1089 auto const s_L_dot = (s_L - prev_state.S_L_data->S_L) / dt;
1091 auto const& b = this->process_data_.specific_body_force;
1097 MCpG.noalias() += NTN * (ip_cv.fC_4_MCpG.m * w);
1098 MCpC.noalias() += NTN * (ip_cv.fC_4_MCpC.m * w);
1100 if (this->process_data_.apply_mass_lumping)
1102 if (pCap - pCap_prev != 0.)
1105 NTN * (ip_cv.fC_4_MCpC.ml / (pCap - pCap_prev) * w);
1109 MCT.noalias() += NTN * (ip_cv.fC_4_MCT.m * w);
1110 MCu.noalias() += BTI2N.transpose() * (ip_cv.fC_4_MCu.m * w);
1112 LCpG.noalias() += gradNpT * ip_cv.fC_4_LCpG.L * gradNp * w;
1114 LCpC.noalias() += gradNpT * ip_cv.fC_4_LCpC.L * gradNp * w;
1116 LCT.noalias() += gradNpT * ip_cv.fC_4_LCT.L * gradNp * w;
1118 fC.noalias() += gradNpT * ip_cv.fC_1.A * b * w;
1120 if (!this->process_data_.apply_mass_lumping)
1122 fC.noalias() -= NpT * (ip_cv.fC_2a.a * s_L_dot * w);
1125 fC.noalias() -= NpT * (ip_out.porosity_data.phi * ip_cv.fC_3a.a * w);
1131 MWpG.noalias() += NTN * (ip_cv.fW_4_MWpG.m * w);
1132 MWpC.noalias() += NTN * (ip_cv.fW_4_MWpC.m * w);
1134 if (this->process_data_.apply_mass_lumping)
1136 if (pCap - pCap_prev != 0.)
1139 NTN * (ip_cv.fW_4_MWpC.ml / (pCap - pCap_prev) * w);
1143 MWT.noalias() += NTN * (ip_cv.fW_4_MWT.m * w);
1145 MWu.noalias() += BTI2N.transpose() * (ip_cv.fW_4_MWu.m * w);
1147 LWpG.noalias() += gradNpT * ip_cv.fW_4_LWpG.L * gradNp * w;
1149 LWpC.noalias() += gradNpT * ip_cv.fW_4_LWpC.L * gradNp * w;
1151 LWT.noalias() += gradNpT * ip_cv.fW_4_LWT.L * gradNp * w;
1153 fW.noalias() += gradNpT * ip_cv.fW_1.A * b * w;
1155 if (!this->process_data_.apply_mass_lumping)
1157 fW.noalias() -= NpT * (ip_cv.fW_2.a * s_L_dot * w);
1160 fW.noalias() -= NpT * (ip_out.porosity_data.phi * ip_cv.fW_3a.a * w);
1168 (ip_cv.effective_volumetric_enthalpy_data.rho_h_eff * w);
1171 gradNTT * ip_cv.thermal_conductivity_data.lambda * gradNT * w;
1173 fT.noalias() -= NTT * (ip_cv.fT_1.m * w);
1175 fT.noalias() += gradNTT * ip_cv.fT_2.A * w;
1177 fT.noalias() += gradNTT * ip_cv.fT_3.gradN * w;
1179 fT.noalias() += NTT * (ip_cv.fT_3.N * w);
1185 KUpG.noalias() -= BTI2N * (ip_cv.biot_data() * w);
1187 KUpC.noalias() += BTI2N * (ip_cv.fu_2_KupC.m * w);
1190 (Bu.transpose() * current_state.eff_stress_data.sigma -
1191 N_u_op(Nu).transpose() * ip_cv.volumetric_body_force()) *
1194 if (this->process_data_.apply_mass_lumping)
1196 MCpG = MCpG.colwise().sum().eval().asDiagonal();
1197 MCpC = MCpC.colwise().sum().eval().asDiagonal();
1198 MWpG = MWpG.colwise().sum().eval().asDiagonal();
1199 MWpC = MWpC.colwise().sum().eval().asDiagonal();
1210 assembleWithJacobian(
double const t,
double const dt,
1211 std::vector<double>
const& local_x,
1212 std::vector<double>
const& local_x_prev,
1213 std::vector<double>& local_rhs_data,
1214 std::vector<double>& local_Jac_data)
1216 auto const matrix_size = gas_pressure_size + capillary_pressure_size +
1217 temperature_size + displacement_size;
1218 assert(local_x.size() == matrix_size);
1220 auto const temperature = Eigen::Map<VectorType<temperature_size>
const>(
1221 local_x.data() + temperature_index, temperature_size);
1223 auto const gas_pressure = Eigen::Map<VectorType<gas_pressure_size>
const>(
1224 local_x.data() + gas_pressure_index, gas_pressure_size);
1226 auto const capillary_pressure =
1227 Eigen::Map<VectorType<capillary_pressure_size>
const>(
1228 local_x.data() + capillary_pressure_index, capillary_pressure_size);
1230 auto const displacement = Eigen::Map<VectorType<displacement_size>
const>(
1231 local_x.data() + displacement_index, displacement_size);
1233 auto const gas_pressure_prev =
1234 Eigen::Map<VectorType<gas_pressure_size>
const>(
1235 local_x_prev.data() + gas_pressure_index, gas_pressure_size);
1237 auto const capillary_pressure_prev =
1238 Eigen::Map<VectorType<capillary_pressure_size>
const>(
1239 local_x_prev.data() + capillary_pressure_index,
1240 capillary_pressure_size);
1242 auto const temperature_prev =
1243 Eigen::Map<VectorType<temperature_size>
const>(
1244 local_x_prev.data() + temperature_index, temperature_size);
1246 auto const displacement_prev =
1247 Eigen::Map<VectorType<displacement_size>
const>(
1248 local_x_prev.data() + displacement_index, displacement_size);
1252 local_Jac_data, matrix_size, matrix_size);
1255 local_rhs_data, matrix_size);
1266 C_size, capillary_pressure_size);
1276 C_size, capillary_pressure_size);
1285 W_size, capillary_pressure_size);
1296 W_size, capillary_pressure_size);
1303 temperature_size, displacement_size);
1313 displacement_size, gas_pressure_size);
1316 displacement_size, capillary_pressure_size);
1319 auto fC = local_f.template segment<C_size>(C_index);
1321 auto fW = local_f.template segment<W_size>(W_index);
1323 auto fT = local_f.template segment<temperature_size>(temperature_index);
1325 auto fU = local_f.template segment<displacement_size>(displacement_index);
1327 unsigned const n_integration_points =
1328 this->integration_method_.getNumberOfPoints();
1331 this->solid_material_, *this->process_data_.phase_transition_model_};
1333 auto const [ip_constitutive_data, ip_constitutive_variables] =
1334 updateConstitutiveVariables(
1335 Eigen::Map<Eigen::VectorXd const>(local_x.data(), local_x.size()),
1336 Eigen::Map<Eigen::VectorXd const>(local_x_prev.data(),
1337 local_x_prev.size()),
1340 auto const ip_d_data = updateConstitutiveVariablesDerivatives(
1341 Eigen::Map<Eigen::VectorXd const>(local_x.data(), local_x.size()),
1342 Eigen::Map<Eigen::VectorXd const>(local_x_prev.data(),
1343 local_x_prev.size()),
1344 t, dt, ip_constitutive_data, ip_constitutive_variables, models);
1346 for (
unsigned int_point = 0; int_point < n_integration_points; int_point++)
1348 auto& ip = _ip_data[int_point];
1349 auto& ip_cd = ip_constitutive_data[int_point];
1350 auto& ip_dd = ip_d_data[int_point];
1351 auto& ip_cv = ip_constitutive_variables[int_point];
1352 auto& ip_out = this->output_data_[int_point];
1353 auto& current_state = this->current_states_[int_point];
1354 auto& prev_state = this->prev_states_[int_point];
1356 auto const& Np = ip.N_p;
1357 auto const& NT = Np;
1358 auto const& Nu = ip.N_u;
1360 std::nullopt, this->element_.getID(), int_point,
1364 this->element_, Nu))};
1366 auto const& NpT = Np.transpose().eval();
1367 auto const& NTT = NT.transpose().eval();
1369 auto const& gradNp = ip.dNdx_p;
1370 auto const& gradNT = gradNp;
1371 auto const& gradNu = ip.dNdx_u;
1373 auto const& gradNpT = gradNp.transpose().eval();
1374 auto const& gradNTT = gradNT.transpose().eval();
1376 auto const& w = ip.integration_weight;
1378 auto const x_coord =
1381 this->element_, Nu);
1385 ShapeFunctionDisplacement::NPOINTS,
1387 gradNu, Nu, x_coord, this->is_axially_symmetric_);
1389 auto const NTN = (Np.transpose() * Np).eval();
1390 auto const BTI2N = (Bu.transpose() * Invariants::identity2 * Np).eval();
1392 double const div_u_dot =
1393 Invariants::trace(Bu * (displacement - displacement_prev) / dt);
1395 double const pGR = Np.dot(gas_pressure);
1396 double const pCap = Np.dot(capillary_pressure);
1397 double const T = NT.dot(temperature);
1403 double const pGR_prev = Np.dot(gas_pressure_prev);
1404 double const pCap_prev = Np.dot(capillary_pressure_prev);
1405 double const T_prev = NT.dot(temperature_prev);
1407 auto const& s_L = current_state.S_L_data.S_L;
1408 auto const s_L_dot = (s_L - prev_state.S_L_data->S_L) / dt;
1410 auto const& b = this->process_data_.specific_body_force;
1416 MCpG.noalias() += NTN * (ip_cv.fC_4_MCpG.m * w);
1417 MCpC.noalias() += NTN * (ip_cv.fC_4_MCpC.m * w);
1419 if (this->process_data_.apply_mass_lumping)
1421 if (pCap - pCap_prev != 0.)
1424 NTN * (ip_cv.fC_4_MCpC.ml / (pCap - pCap_prev) * w);
1428 MCT.noalias() += NTN * (ip_cv.fC_4_MCT.m * w);
1431 .template block<C_size, temperature_size>(C_index,
1433 .noalias() += NTN * (ip_dd.dfC_4_MCT.dT * (T - T_prev) / dt * w);
1435 MCu.noalias() += BTI2N.transpose() * (ip_cv.fC_4_MCu.m * w);
1438 .template block<C_size, temperature_size>(C_index,
1440 .noalias() += NTN * (ip_dd.dfC_4_MCu.dT * div_u_dot * w);
1442 LCpG.noalias() += gradNpT * ip_cv.fC_4_LCpG.L * gradNp * w;
1445 local_Jac.template block<C_size, C_size>(C_index, C_index).noalias() +=
1446 gradNpT * ip_dd.dfC_4_LCpG.dp_GR * gradpGR * Np * w;
1449 local_Jac.template block<C_size, W_size>(C_index, W_index).noalias() +=
1450 gradNpT * ip_dd.dfC_4_LCpG.dp_cap * gradpGR * Np * w;
1454 .template block<C_size, temperature_size>(C_index,
1456 .noalias() += gradNpT * ip_dd.dfC_4_LCpG.dT * gradpGR * NT * w;
1459 local_Jac.template block<C_size, C_size>(C_index, C_index).noalias() +=
1460 NTN * (ip_dd.dfC_4_MCpG.dp_GR * (pGR - pGR_prev) / dt * w);
1464 .template block<C_size, temperature_size>(C_index,
1467 NTN * (ip_dd.dfC_4_MCpG.dT * (pGR - pGR_prev) / dt * w);
1469 LCpC.noalias() -= gradNpT * ip_cv.fC_4_LCpC.L * gradNp * w;
1485 LCT.noalias() += gradNpT * ip_cv.fC_4_LCT.L * gradNp * w;
1488 fC.noalias() += gradNpT * ip_cv.fC_1.A * b * w;
1490 if (!this->process_data_.apply_mass_lumping)
1493 fC.noalias() -= NpT * (ip_cv.fC_2a.a * s_L_dot * w);
1495 local_Jac.template block<C_size, C_size>(C_index, C_index)
1497 NTN * ((ip_dd.dfC_2a.dp_GR * s_L_dot
1501 local_Jac.template block<C_size, W_size>(C_index, W_index)
1503 NTN * ((ip_dd.dfC_2a.dp_cap * s_L_dot +
1504 ip_cv.fC_2a.a * ip_dd.dS_L_dp_cap() / dt) *
1508 .template block<C_size, temperature_size>(C_index,
1510 .noalias() += NTN * (ip_dd.dfC_2a.dT * s_L_dot * w);
1515 NpT * (ip_out.porosity_data.phi * ip_cv.fC_3a.a * w);
1517 local_Jac.template block<C_size, C_size>(C_index, C_index)
1519 NTN * (ip_out.porosity_data.phi * ip_dd.dfC_3a.dp_GR * w);
1521 local_Jac.template block<C_size, W_size>(C_index, W_index)
1523 NTN * (ip_out.porosity_data.phi * ip_dd.dfC_3a.dp_cap * w);
1526 .template block<C_size, temperature_size>(C_index,
1529 NTN * ((ip_dd.porosity_d_data.dphi_dT * ip_cv.fC_3a.a +
1530 ip_out.porosity_data.phi * ip_dd.dfC_3a.dT) *
1537 MWpG.noalias() += NTN * (ip_cv.fW_4_MWpG.m * w);
1538 MWpC.noalias() += NTN * (ip_cv.fW_4_MWpC.m * w);
1540 if (this->process_data_.apply_mass_lumping)
1542 if (pCap - pCap_prev != 0.)
1545 NTN * (ip_cv.fW_4_MWpC.ml / (pCap - pCap_prev) * w);
1549 MWT.noalias() += NTN * (ip_cv.fW_4_MWT.m * w);
1551 MWu.noalias() += BTI2N.transpose() * (ip_cv.fW_4_MWu.m * w);
1553 LWpG.noalias() += gradNpT * ip_cv.fW_4_LWpG.L * gradNp * w;
1556 local_Jac.template block<W_size, C_size>(W_index, C_index).noalias() +=
1557 gradNpT * ip_dd.dfW_4_LWpG.dp_GR * gradpGR * Np * w;
1559 local_Jac.template block<W_size, W_size>(W_index, W_index).noalias() +=
1560 gradNpT * ip_dd.dfW_4_LWpG.dp_cap * gradpGR * Np * w;
1563 .template block<W_size, temperature_size>(W_index,
1565 .noalias() += gradNpT * ip_dd.dfW_4_LWpG.dT * gradpGR * NT * w;
1567 LWpC.noalias() += gradNpT * ip_cv.fW_4_LWpC.L * gradNp * w;
1570 local_Jac.template block<W_size, C_size>(W_index, C_index).noalias() -=
1571 gradNpT * ip_dd.dfW_4_LWpC.dp_GR * gradpCap * Np * w;
1573 local_Jac.template block<W_size, W_size>(W_index, W_index).noalias() -=
1574 gradNpT * ip_dd.dfW_4_LWpC.dp_cap * gradpCap * Np * w;
1577 .template block<W_size, temperature_size>(W_index,
1579 .noalias() -= gradNpT * ip_dd.dfW_4_LWpC.dT * gradpCap * NT * w;
1581 LWT.noalias() += gradNpT * ip_cv.fW_4_LWT.L * gradNp * w;
1584 fW.noalias() += gradNpT * ip_cv.fW_1.A * b * w;
1587 if (!this->process_data_.apply_mass_lumping)
1589 fW.noalias() -= NpT * (ip_cv.fW_2.a * s_L_dot * w);
1591 local_Jac.template block<W_size, C_size>(W_index, C_index)
1592 .noalias() += NTN * (ip_dd.dfW_2.dp_GR * s_L_dot * w);
1597 local_Jac.template block<W_size, W_size>(W_index, W_index)
1598 .noalias() += NTN * ((ip_dd.dfW_2.dp_cap * s_L_dot +
1599 ip_cv.fW_2.a * ip_dd.dS_L_dp_cap() / dt) *
1603 .template block<W_size, temperature_size>(W_index,
1605 .noalias() += NTN * (ip_dd.dfW_2.dT * s_L_dot * w);
1609 fW.noalias() -= NpT * (ip_out.porosity_data.phi * ip_cv.fW_3a.a * w);
1611 local_Jac.template block<W_size, C_size>(W_index, C_index).noalias() +=
1612 NTN * (ip_out.porosity_data.phi * ip_dd.dfW_3a.dp_GR * w);
1614 local_Jac.template block<W_size, W_size>(W_index, W_index).noalias() +=
1615 NTN * (ip_out.porosity_data.phi * ip_dd.dfW_3a.dp_cap * w);
1618 .template block<W_size, temperature_size>(W_index,
1621 NTN * ((ip_dd.porosity_d_data.dphi_dT * ip_cv.fW_3a.a +
1622 ip_out.porosity_data.phi * ip_dd.dfW_3a.dT) *
1631 (ip_cv.effective_volumetric_enthalpy_data.rho_h_eff * w);
1636 .template block<temperature_size, C_size>(temperature_index,
1639 NTN * (ip_dd.effective_volumetric_enthalpy_d_data.drho_h_eff_dp_GR *
1645 .template block<temperature_size, W_size>(temperature_index,
1649 (ip_dd.effective_volumetric_enthalpy_d_data.drho_h_eff_dp_cap *
1655 .template block<temperature_size, temperature_size>(
1656 temperature_index, temperature_index)
1658 NTN * (ip_dd.effective_volumetric_enthalpy_d_data.drho_h_eff_dT *
1662 gradNTT * ip_cv.thermal_conductivity_data.lambda * gradNT * w;
1680 .template block<temperature_size, W_size>(temperature_index,
1682 .noalias() += gradNTT *
1683 ip_dd.thermal_conductivity_d_data.dlambda_dp_cap *
1688 .template block<temperature_size, temperature_size>(
1689 temperature_index, temperature_index)
1690 .noalias() += gradNTT *
1691 ip_dd.thermal_conductivity_d_data.dlambda_dT * gradT *
1695 fT.noalias() -= NTT * (ip_cv.fT_1.m * w);
1699 .template block<temperature_size, C_size>(temperature_index,
1701 .noalias() += NTN * (ip_dd.dfT_1.dp_GR * w);
1705 .template block<temperature_size, W_size>(temperature_index,
1707 .noalias() += NTN * (ip_dd.dfT_1.dp_cap * w);
1712 .template block<temperature_size, temperature_size>(
1713 temperature_index, temperature_index)
1714 .noalias() += NTN * (ip_dd.dfT_1.dT * w);
1717 fT.noalias() += gradNTT * ip_cv.fT_2.A * w;
1721 .template block<temperature_size, C_size>(temperature_index,
1725 gradNTT * ip_dd.dfT_2.dp_GR_Npart * Np * w +
1727 gradNTT * ip_dd.dfT_2.dp_GR_gradNpart * gradNp * w;
1731 .template block<temperature_size, W_size>(temperature_index,
1735 gradNTT * (-ip_dd.dfT_2.dp_cap_Npart) * Np * w +
1737 gradNTT * (-ip_dd.dfT_2.dp_cap_gradNpart) * gradNp * w;
1741 .template block<temperature_size, temperature_size>(
1742 temperature_index, temperature_index)
1743 .noalias() -= gradNTT * ip_dd.dfT_2.dT * NT * w;
1746 fT.noalias() += NTT * (ip_cv.fT_3.N * w);
1748 fT.noalias() += gradNTT * ip_cv.fT_3.gradN * w;
1754 KUpG.noalias() -= BTI2N * (ip_cv.biot_data() * w);
1759 KUpC.noalias() += BTI2N * (ip_cv.fu_2_KupC.m * w);
1764 .template block<displacement_size, W_size>(displacement_index,
1766 .noalias() += BTI2N * (ip_dd.dfu_2_KupC.dp_cap * w);
1769 .template block<displacement_size, displacement_size>(
1770 displacement_index, displacement_index)
1772 Bu.transpose() * ip_cd.s_mech_data.stiffness_tensor * Bu * w;
1776 (Bu.transpose() * current_state.eff_stress_data.sigma -
1777 N_u_op(Nu).transpose() * ip_cv.volumetric_body_force()) *
1782 .template block<displacement_size, temperature_size>(
1783 displacement_index, temperature_index)
1784 .noalias() -= Bu.transpose() * ip_dd.dfu_1_KuT.dT * NT * w;
1794 if (this->process_data_.apply_mass_lumping)
1796 MCpG = MCpG.colwise().sum().eval().asDiagonal();
1797 MCpC = MCpC.colwise().sum().eval().asDiagonal();
1798 MWpG = MWpG.colwise().sum().eval().asDiagonal();
1799 MWpC = MWpC.colwise().sum().eval().asDiagonal();
1805 fC.noalias() -= LCpG * gas_pressure + LCpC * capillary_pressure +
1807 MCpG * (gas_pressure - gas_pressure_prev) / dt +
1808 MCpC * (capillary_pressure - capillary_pressure_prev) / dt +
1809 MCT * (temperature - temperature_prev) / dt +
1810 MCu * (displacement - displacement_prev) / dt;
1812 local_Jac.template block<C_size, C_size>(C_index, C_index).noalias() +=
1814 local_Jac.template block<C_size, W_size>(C_index, W_index).noalias() +=
1817 .template block<C_size, temperature_size>(C_index, temperature_index)
1818 .noalias() += LCT + MCT / dt;
1820 .template block<C_size, displacement_size>(C_index, displacement_index)
1821 .noalias() += MCu / dt;
1825 fW.noalias() -= LWpG * gas_pressure + LWpC * capillary_pressure +
1827 MWpG * (gas_pressure - gas_pressure_prev) / dt +
1828 MWpC * (capillary_pressure - capillary_pressure_prev) / dt +
1829 MWT * (temperature - temperature_prev) / dt +
1830 MWu * (displacement - displacement_prev) / dt;
1832 local_Jac.template block<W_size, W_size>(W_index, W_index).noalias() +=
1834 local_Jac.template block<W_size, C_size>(W_index, C_index).noalias() +=
1837 .template block<W_size, temperature_size>(W_index, temperature_index)
1838 .noalias() += LWT + MWT / dt;
1840 .template block<W_size, displacement_size>(W_index, displacement_index)
1841 .noalias() += MWu / dt;
1846 KTT * temperature + MTu * (displacement - displacement_prev) / dt;
1849 .template block<temperature_size, temperature_size>(temperature_index,
1853 .template block<temperature_size, displacement_size>(temperature_index,
1855 .noalias() += MTu / dt;
1859 fU.noalias() -= KUpG * gas_pressure + KUpC * capillary_pressure;
1862 .template block<displacement_size, C_size>(displacement_index, C_index)
1865 .template block<displacement_size, W_size>(displacement_index, W_index)