39 ShapeFunctionPressure, DisplacementDim>::
40 HydroMechanicsLocalAssemblerFracture(
43 std::vector<unsigned>
const& dofIndex_to_localIndex,
45 bool const is_axially_symmetric,
48 e, is_axially_symmetric, integration_method,
49 ShapeFunctionDisplacement::NPOINTS * DisplacementDim +
50 ShapeFunctionPressure::NPOINTS,
51 dofIndex_to_localIndex),
56 unsigned const n_integration_points =
59 _ip_data.reserve(n_integration_points);
62 auto const shape_matrices_u =
65 DisplacementDim>(e, is_axially_symmetric,
68 auto const shape_matrices_p =
71 e, is_axially_symmetric, integration_method);
74 auto frac_id =
_process_data.map_materialID_to_fractureID[mat_id];
80 aperture0_node_values =
84 for (
unsigned ip = 0; ip < n_integration_points; ip++)
87 auto const& sm_u = shape_matrices_u[ip];
88 auto const& sm_p = shape_matrices_p[ip];
97 ip_data.integration_weight =
98 sm_u.detJ * sm_u.integralMeasure *
103 ShapeFunctionDisplacement::NPOINTS * DisplacementDim);
105 DisplacementDim, ShapeFunctionDisplacement::NPOINTS,
108 ip_data.N_p = sm_p.N;
109 ip_data.dNdx_p = sm_p.dNdx;
114 ip_data.w.setZero(DisplacementDim);
115 ip_data.sigma_eff.setZero(DisplacementDim);
118 ip_data.w_prev.resize(DisplacementDim);
119 ip_data.sigma_eff_prev.resize(DisplacementDim);
121 ip_data.C.resize(DisplacementDim, DisplacementDim);
123 ip_data.aperture0 = aperture0_node_values.dot(sm_u.N);
124 ip_data.aperture = ip_data.aperture0;
126 auto const initial_effective_stress =
127 _process_data.initial_fracture_effective_stress(0, x_position);
128 for (
int i = 0; i < DisplacementDim; i++)
130 ip_data.sigma_eff[i] = initial_effective_stress[i];
131 ip_data.sigma_eff_prev[i] = initial_effective_stress[i];
170 ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>::
171 assembleBlockMatricesWithJacobian(
172 double const t,
double const dt,
173 Eigen::Ref<const Eigen::VectorXd>
const& p,
174 Eigen::Ref<const Eigen::VectorXd>
const& p_prev,
175 Eigen::Ref<const Eigen::VectorXd>
const& g,
176 Eigen::Ref<const Eigen::VectorXd>
const& g_prev,
177 Eigen::Ref<Eigen::VectorXd> rhs_p, Eigen::Ref<Eigen::VectorXd> rhs_g,
178 Eigen::Ref<Eigen::MatrixXd> J_pp, Eigen::Ref<Eigen::MatrixXd> J_pg,
179 Eigen::Ref<Eigen::MatrixXd> J_gg, Eigen::Ref<Eigen::MatrixXd> J_gp)
185 auto constexpr index_normal = DisplacementDim - 1;
188 ShapeMatricesTypePressure::NodalMatrixType::Zero(
pressure_size,
192 ShapeMatricesTypePressure::NodalMatrixType::Zero(
pressure_size,
195 typename ShapeMatricesTypeDisplacement::template MatrixType<
197 Kgp = ShapeMatricesTypeDisplacement::template MatrixType<
202 Eigen::MatrixXd
const global2local_rotation =
203 R.template topLeftCorner<ShapeFunctionPressure::DIM, DisplacementDim>();
206 global2local_rotation *
214 auto const& liquid_phase =
218 .template value<double>(variables, x_position, t, dt);
221 unsigned const n_integration_points =
_ip_data.size();
222 for (
unsigned ip = 0; ip < n_integration_points; ip++)
225 auto const& ip_w = ip_data.integration_weight;
226 auto const& N_p = ip_data.N_p;
227 auto const& dNdx_p = ip_data.dNdx_p;
228 auto const& H_g = ip_data.H_u;
229 auto const& identity2 =
239 auto& mat = ip_data.fracture_material;
240 auto& effective_stress = ip_data.sigma_eff;
241 auto const& effective_stress_prev = ip_data.sigma_eff_prev;
243 auto const& w_prev = ip_data.w_prev;
245 auto& state = *ip_data.material_state_variables;
246 auto& b_m = ip_data.aperture;
250 .template value<double>(variables, x_position, t, dt);
255 .template value<double>(variables, x_position, t, dt);
259 .template value<double>(variables, x_position, t, dt);
263 .template value<double>(variables, x_position, t, dt);
266 w.noalias() = R * H_g * g;
269 b_m = ip_data.aperture0 + w[index_normal];
273 "Element {:d}, gp {:d}: Fracture aperture is {:g}, but it must "
275 "non-negative. Setting it to zero.",
280 auto const initial_effective_stress =
281 _process_data.initial_fracture_effective_stress(0, x_position);
283 Eigen::Map<typename HMatricesType::ForceVectorType const>
const stress0(
284 initial_effective_stress.data(), initial_effective_stress.size());
287 mat.computeConstitutiveRelation(
288 t, x_position, ip_data.aperture0, stress0, w_prev, w,
289 effective_stress_prev, effective_stress, C, state);
295 H_g.transpose() * R.transpose() * effective_stress * ip_w;
296 J_gg.noalias() += H_g.transpose() * R.transpose() * C * R * H_g * ip_w;
302 H_g.transpose() * R.transpose() * alpha * identity2 * N_p * ip_w;
310 auto const permeability =
312 .value(variables, x_position, t, dt);
314 auto& k = ip_data.permeability;
315 k = std::get<double>(permeability);
316 double const k_over_mu = k / mu;
317 storage_p.noalias() += N_p.transpose() * b_m * S * N_p * ip_w;
318 laplace_p.noalias() +=
319 dNdx_p.transpose() * b_m * k_over_mu * dNdx_p * ip_w;
321 dNdx_p.transpose() * b_m * k_over_mu * rho_fr * gravity_vec * ip_w;
327 Eigen::Matrix<double, 1, displacement_size>
const mT_R_Hg =
328 identity2.transpose() * R * H_g;
330 ip_data.darcy_velocity = -k_over_mu * grad_head;
332 N_p.transpose() * S * N_p * (p - p_prev) / dt * mT_R_Hg * ip_w;
335 double const dk_db_over_mu =
337 .template dValue<double>(variables,
342 dNdx_p.transpose() * k_over_mu * grad_head * mT_R_Hg * ip_w;
343 J_pg.noalias() += dNdx_p.transpose() * b_m * dk_db_over_mu * grad_head *
348 J_gp.noalias() -= Kgp;
351 J_pp.noalias() += laplace_p + storage_p / dt;
354 J_pg.noalias() += Kgp.transpose() / dt;
357 rhs_p.noalias() -= laplace_p * p + storage_p * (p - p_prev) / dt +
358 Kgp.transpose() * (g - g_prev) / dt;
361 rhs_g.noalias() -= -Kgp * p;
370 Eigen::VectorXd
const&
378 auto constexpr index_normal = DisplacementDim - 1;
384 unsigned const n_integration_points =
_ip_data.size();
385 for (
unsigned ip = 0; ip < n_integration_points; ip++)
388 auto const& H_g = ip_data.H_u;
389 auto& mat = ip_data.fracture_material;
390 auto& effective_stress = ip_data.sigma_eff;
391 auto const& effective_stress_prev = ip_data.sigma_eff_prev;
393 auto const& w_prev = ip_data.w_prev;
395 auto& state = *ip_data.material_state_variables;
396 auto& b_m = ip_data.aperture;
406 w.noalias() = R * H_g * nodal_g;
409 b_m = ip_data.aperture0 + w[index_normal];
413 "Element {:d}, gp {:d}: Fracture aperture is {:g}, but it is "
414 "expected to be non-negative. Setting it to zero now.",
419 auto const initial_effective_stress =
420 _process_data.initial_fracture_effective_stress(0, x_position);
422 Eigen::Map<typename HMatricesType::ForceVectorType const>
const stress0(
423 initial_effective_stress.data(), initial_effective_stress.size());
426 mat.computeConstitutiveRelation(
427 t, x_position, ip_data.aperture0, stress0, w_prev, w,
428 effective_stress_prev, effective_stress, C, state);
434 HMatricesType::ForceVectorType::Zero(DisplacementDim);
436 HMatricesType::ForceVectorType::Zero(DisplacementDim);
439 double ele_Fs = -std::numeric_limits<double>::max();
442 ele_b += ip.aperture;
443 ele_k += ip.permeability;
445 ele_sigma_eff += ip.sigma_eff;
446 ele_velocity += ip.darcy_velocity;
448 ele_Fs, ip.material_state_variables->getShearYieldFunctionValue());
450 ele_b /=
static_cast<double>(n_integration_points);
451 ele_k /=
static_cast<double>(n_integration_points);
452 ele_w /=
static_cast<double>(n_integration_points);
453 ele_sigma_eff /=
static_cast<double>(n_integration_points);
454 ele_velocity /=
static_cast<double>(n_integration_points);
455 auto const element_id =
_element.getID();
459 Eigen::Map<GlobalDimVectorType>(
460 &(*
_process_data.element_fracture_stresses)[e_id * DisplacementDim]) =
463 Eigen::Map<GlobalDimVectorType>(
464 &(*
_process_data.element_fracture_velocities)[e_id * DisplacementDim]) =
467 Eigen::Map<GlobalDimVectorType>(
468 &(*
_process_data.element_local_jumps)[e_id * DisplacementDim]) = ele_w;
470 (*
_process_data.mesh_prop_fracture_shear_failure)[element_id] = ele_Fs;
476 ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>::
477 getIntPtFractureVelocity(
479 std::vector<GlobalVector*>
const& ,
480 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
481 std::vector<double>& cache)
const
483 unsigned const n_integration_points =
_ip_data.size();
486 double, DisplacementDim, Eigen::Dynamic, Eigen::RowMajor>>(
487 cache, DisplacementDim, n_integration_points);
489 for (
unsigned ip = 0; ip < n_integration_points; ip++)
491 cache_matrix.col(ip).noalias() =
_ip_data[ip].darcy_velocity;