48 SmallDeformationLocalAssemblerMatrixNearFracture(
50 std::size_t
const n_variables,
52 std::vector<unsigned>
const& dofIndex_to_localIndex,
54 bool const is_axially_symmetric,
57 n_variables * ShapeFunction::NPOINTS * DisplacementDim,
58 dofIndex_to_localIndex),
59 _process_data(process_data),
60 _integration_method(integration_method),
62 _is_axially_symmetric(is_axially_symmetric)
68 DisplacementDim>(e, is_axially_symmetric,
71 unsigned const n_integration_points =
74 _ip_data.reserve(n_integration_points);
80 for (
unsigned ip = 0; ip < n_integration_points; ip++)
82 _ip_data.emplace_back(solid_material);
84 auto const& sm = shape_matrices[ip];
86 ip_data.dNdx_u = sm.dNdx;
87 ip_data.integration_weight =
89 sm.integralMeasure * sm.detJ;
92 static const int kelvin_vector_size =
94 ip_data._sigma.setZero(kelvin_vector_size);
95 ip_data._eps.setZero(kelvin_vector_size);
98 ip_data._sigma_prev.resize(kelvin_vector_size);
99 ip_data._eps_prev.resize(kelvin_vector_size);
101 ip_data._C.resize(kelvin_vector_size, kelvin_vector_size);
113 ranges::views::transform(
116 ranges::to<std::vector>;
122 DisplacementDim>::assembleWithJacobian(
double const t,
double const dt,
123 Eigen::VectorXd
const& local_u,
124 Eigen::VectorXd& local_b,
125 Eigen::MatrixXd& local_J)
127 assert(_element.getDimension() == DisplacementDim);
129 auto const N_DOF_PER_VAR = ShapeFunction::NPOINTS * DisplacementDim;
130 auto const n_fractures = _fracture_props.size();
131 auto const n_junctions = _junction_props.size();
132 auto const n_enrich_var = n_fractures + n_junctions;
134 using BlockVectorType =
135 typename Eigen::VectorXd::FixedSegmentReturnType<N_DOF_PER_VAR>::Type;
136 using BlockMatrixType =
137 Eigen::Block<Eigen::MatrixXd, N_DOF_PER_VAR, N_DOF_PER_VAR>;
154 auto local_b_u = local_b.segment<N_DOF_PER_VAR>(0);
155 std::vector<BlockVectorType> vec_local_b_g;
156 for (
unsigned i = 0; i < n_enrich_var; i++)
158 vec_local_b_g.push_back(
159 local_b.segment<N_DOF_PER_VAR>(N_DOF_PER_VAR * (i + 1)));
162 auto local_J_uu = local_J.block<N_DOF_PER_VAR, N_DOF_PER_VAR>(0, 0);
163 std::vector<BlockMatrixType> vec_local_J_ug;
164 std::vector<BlockMatrixType> vec_local_J_gu;
165 std::vector<std::vector<BlockMatrixType>> vec_local_J_gg(n_enrich_var);
166 for (
unsigned i = 0; i < n_enrich_var; i++)
168 auto sub_ug = local_J.block<N_DOF_PER_VAR, N_DOF_PER_VAR>(
169 0, N_DOF_PER_VAR * (i + 1));
170 vec_local_J_ug.push_back(sub_ug);
172 auto sub_gu = local_J.block<N_DOF_PER_VAR, N_DOF_PER_VAR>(
173 N_DOF_PER_VAR * (i + 1), 0);
174 vec_local_J_gu.push_back(sub_gu);
176 for (
unsigned j = 0; j < n_enrich_var; j++)
178 auto sub_gg = local_J.block<N_DOF_PER_VAR, N_DOF_PER_VAR>(
179 N_DOF_PER_VAR * (i + 1), N_DOF_PER_VAR * (j + 1));
180 vec_local_J_gg[i].push_back(sub_gg);
184 auto const nodal_u = local_u.segment<N_DOF_PER_VAR>(0);
185 std::vector<BlockVectorType> vec_nodal_g;
186 for (
unsigned i = 0; i < n_enrich_var; i++)
188 auto sub =
const_cast<Eigen::VectorXd&
>(local_u).segment<N_DOF_PER_VAR>(
189 N_DOF_PER_VAR * (i + 1));
190 vec_nodal_g.push_back(sub);
196 unsigned const n_integration_points =
197 _integration_method.getNumberOfPoints();
204 auto const B_dil_bar = getDilatationalBBarMatrix();
206 for (
unsigned ip = 0; ip < n_integration_points; ip++)
210 auto& ip_data = _ip_data[ip];
211 auto const& w = _ip_data[ip].integration_weight;
213 auto const& N = ip_data.N_u;
214 auto const& dNdx = ip_data.dNdx_u;
217 Eigen::Vector3d
const ip_physical_coords(
219 std::vector<double>
const levelsets(
221 _fracID_to_local, ip_physical_coords));
226 for (
unsigned i = 0; i < n_enrich_var; i++)
228 nodal_total_u += levelsets[i] * vec_nodal_g[i];
237 this->_is_axially_symmetric);
240 auto const& eps_prev = ip_data._eps_prev;
241 auto const& sigma_prev = ip_data._sigma_prev;
243 auto& eps = ip_data._eps;
244 auto& sigma = ip_data._sigma;
245 auto& state = ip_data._material_state_variables;
247 eps.noalias() = B * nodal_total_u;
259 variables_prev.
temperature = _process_data.reference_temperature;
261 auto&& solution = _ip_data[ip]._solid_material.integrateStress(
262 variables_prev, variables, t, x_position, dt, *state);
266 OGS_FATAL(
"Computation of local constitutive relation failed.");
270 std::tie(sigma, state, C) = std::move(*solution);
274 local_b_u.noalias() -= B.transpose() * sigma * w;
275 for (
unsigned i = 0; i < n_enrich_var; i++)
277 vec_local_b_g[i].noalias() -=
278 levelsets[i] * B.transpose() * sigma * w;
282 local_J_uu.noalias() += B.transpose() * C * B * w;
284 for (
unsigned i = 0; i < n_enrich_var; i++)
287 vec_local_J_ug[i].noalias() +=
288 B.transpose() * C * (levelsets[i] * B) * w;
291 vec_local_J_gu[i].noalias() +=
292 (levelsets[i] * B.transpose()) * C * B * w;
294 for (
unsigned j = 0; j < n_enrich_var; j++)
297 vec_local_J_gg[i][j].noalias() +=
298 (levelsets[i] * B.transpose()) * C * (levelsets[j] * B) * w;