257{
258 DBUG(
"Assemble EmbeddedAnchor.");
259
262
264 {
265 auto const anchor_element_id = anchor_element->getID();
266 std::vector<GlobalIndexType> global_indices;
267 Eigen::Vector<double, 2 * GlobalDim> local_x;
268 std::vector<Eigen::RowVectorXd> shape_matrices;
269 std::array<std::size_t, 2> nodes_per_element;
272 anchor_element, nodes_per_element, shape_matrices, global_indices,
273 local_x, x, pos);
274
275 auto node_coords = [anchor_element](int const i)
276 { return anchor_element->getNode(i)->asEigenVector3d(); };
278 (node_coords(1) - node_coords(0)).template head<GlobalDim>();
279 double const l_original_norm = l_original.norm();
280
281
282 auto u = [&local_x](int const i)
285
286 double const K = (*cross_sectional_area_)[anchor_element_id] *
287 (*anchor_stiffness_)[anchor_element_id];
288 double const initial_force =
289 (*cross_sectional_area_)[anchor_element_id] *
290 (*initial_anchor_stress_)[anchor_element_id];
291 double const max_force = (*cross_sectional_area_)[anchor_element_id] *
292 (*maximum_anchor_stress_)[anchor_element_id];
293 double const residual_force =
294 (*cross_sectional_area_)[anchor_element_id] *
295 (*residual_anchor_stress_)[anchor_element_id];
296
297 double const strain = (l.norm() - l_original_norm) / l_original_norm;
298
300 residual_force * l_original / l_original_norm;
302 l_original / l_original_norm * (initial_force + K * strain);
304 ((f_elastic.norm() < max_force)) ? f_elastic : f_friction;
305
308 l.transpose() / l.norm() /
309 l_original_norm;
311 (f_elastic.norm() < max_force) ? Df_elastic : Df_friction;
312
314 f, Df, shape_matrices, global_indices.size(), nodes_per_element);
315
316 b.
add(global_indices, local_rhs);
317 if (jac)
318 {
319 jac->
add({global_indices, global_indices}, local_Jac);
320 }
321 }
322}
int add(IndexType row, IndexType col, double val)
void add(IndexType rowId, double v)
add entry
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
void getShapeMatricesAndGlobalIndicesAndDisplacements(MeshLib::Element const *const anchor_element, std::array< std::size_t, 2 > &nodes_per_element, std::vector< Eigen::RowVectorXd > &shape_matrices, std::vector< GlobalIndexType > &global_indices, Eigen::Vector< double, 2 *GlobalDim > &local_x, GlobalVector const &x, ParameterLib::SpatialPosition &pos) const
std::tuple< Eigen::VectorXd, Eigen::MatrixXd > assembleLocalBJac(Eigen::Vector< double, GlobalDim > const &f, Eigen::Matrix< double, GlobalDim, GlobalDim > const &Df, std::vector< Eigen::RowVectorXd > const &shape_matrices, std::size_t const num_dof, std::array< std::size_t, 2 > const &nodes_per_element)