28 namespace SmallDeformation
30 template <
int DisplacementDim>
34 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
35 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
36 unsigned const integration_order,
37 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
41 :
Process(std::move(
name), mesh, std::move(jacobian_assembler), parameters,
42 integration_order, std::move(process_variables),
43 std::move(secondary_variables)),
44 _process_data(std::move(process_data))
46 std::vector<std::pair<std::size_t, std::vector<int>>>
47 vec_branch_nodeID_matIDs;
48 std::vector<std::pair<std::size_t, std::vector<int>>>
49 vec_junction_nodeID_matIDs;
54 vec_junction_nodeID_matIDs);
60 "The number of the given fracture properties ({:d}) are not "
61 "consistent with the number of fracture groups in a mesh ({:d}).",
69 _process_data._map_materialID_to_fractureID.resize(*max_frac_mat_id + 1);
83 _process_data._vec_ele_connected_fractureIDs[e->getID()].push_back(
99 for (
auto& vec_branch_nodeID_matID : vec_branch_nodeID_matIDs)
101 auto master_matId = vec_branch_nodeID_matID.second[0];
102 auto slave_matId = vec_branch_nodeID_matID.second[1];
110 master_frac.branches_master.push_back(
112 master_frac, slave_frac));
114 slave_frac.branches_slave.push_back(
116 master_frac, slave_frac));
120 transform(cbegin(vec_junction_nodeID_matIDs),
121 cend(vec_junction_nodeID_matIDs),
123 [&](
auto& vec_junction_nodeID_matID)
129 for (std::size_t i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
131 auto const& material_ids = vec_junction_nodeID_matIDs[i].second;
132 assert(material_ids.size() == 2);
133 std::array<int, 2> fracture_ids{
134 {
_process_data._map_materialID_to_fractureID[material_ids[0]],
135 _process_data._map_materialID_to_fractureID[material_ids[1]]}};
138 i, *mesh.
getNode(vec_junction_nodeID_matIDs[i].first),
145 for (
unsigned i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
147 auto node = mesh.
getNode(vec_junction_nodeID_matIDs[i].first);
150 _process_data._vec_ele_connected_junctionIDs[e->getID()].push_back(
157 vec_junction_nodeID_matIDs.size());
158 for (
unsigned i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
160 auto node = mesh.
getNode(vec_junction_nodeID_matIDs[i].first);
180 template <
int DisplacementDim>
187 _mesh_subset_all_nodes =
188 std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
190 _mesh_subset_matrix_nodes =
191 std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
193 for (
unsigned i = 0; i < _vec_fracture_nodes.size(); i++)
195 _mesh_subset_fracture_nodes.push_back(
196 std::make_unique<MeshLib::MeshSubset const>(
197 _mesh, _vec_fracture_nodes[i]));
200 _mesh_subset_junction_nodes =
201 std::make_unique<MeshLib::MeshSubset>(_mesh, _vec_junction_nodes);
204 std::vector<MeshLib::MeshSubset> all_mesh_subsets;
205 std::generate_n(std::back_inserter(all_mesh_subsets), DisplacementDim,
206 [&]() {
return *_mesh_subset_matrix_nodes; });
207 for (
auto& ms : _mesh_subset_fracture_nodes)
209 std::generate_n(std::back_inserter(all_mesh_subsets),
211 [&]() {
return *ms; });
213 std::generate_n(std::back_inserter(all_mesh_subsets),
215 [&]() {
return *_mesh_subset_junction_nodes; });
217 std::vector<int>
const vec_n_components(
218 1 + _vec_fracture_mat_IDs.size() + _vec_junction_nodes.size(),
221 std::vector<std::vector<MeshLib::Element*>
const*> vec_var_elements;
222 vec_var_elements.push_back(&_vec_matrix_elements);
223 for (
unsigned i = 0; i < _vec_fracture_matrix_elements.size(); i++)
225 vec_var_elements.push_back(&_vec_fracture_matrix_elements[i]);
227 for (
unsigned i = 0; i < _vec_junction_fracture_matrix_elements.size(); i++)
229 vec_var_elements.push_back(&_vec_junction_fracture_matrix_elements[i]);
232 _local_to_global_index_map =
233 std::make_unique<NumLib::LocalToGlobalIndexMap>(
234 std::move(all_mesh_subsets),
240 template <
int DisplacementDim>
244 unsigned const integration_order)
255 std::vector<MeshLib::MeshSubset> all_mesh_subsets_single_component{
256 *_mesh_subset_all_nodes};
257 _local_to_global_index_map_single_component =
258 std::make_unique<NumLib::LocalToGlobalIndexMap>(
259 std::move(all_mesh_subsets_single_component),
263 _secondary_variables.addSecondaryVariable(
266 1, getExtrapolator(), _local_assemblers,
269 _secondary_variables.addSecondaryVariable(
272 1, getExtrapolator(), _local_assemblers,
275 _secondary_variables.addSecondaryVariable(
278 1, getExtrapolator(), _local_assemblers,
281 _secondary_variables.addSecondaryVariable(
284 1, getExtrapolator(), _local_assemblers,
287 if (DisplacementDim == 3)
289 _secondary_variables.addSecondaryVariable(
292 1, getExtrapolator(), _local_assemblers,
295 _secondary_variables.addSecondaryVariable(
298 1, getExtrapolator(), _local_assemblers,
302 _secondary_variables.addSecondaryVariable(
305 1, getExtrapolator(), _local_assemblers,
308 _secondary_variables.addSecondaryVariable(
311 1, getExtrapolator(), _local_assemblers,
314 _secondary_variables.addSecondaryVariable(
317 1, getExtrapolator(), _local_assemblers,
320 _secondary_variables.addSecondaryVariable(
323 1, getExtrapolator(), _local_assemblers,
326 if (DisplacementDim == 3)
328 _secondary_variables.addSecondaryVariable(
331 1, getExtrapolator(), _local_assemblers,
334 _secondary_variables.addSecondaryVariable(
337 1, getExtrapolator(), _local_assemblers,
341 auto mesh_prop_sigma_xx = MeshLib::getOrCreateMeshProperty<double>(
345 _process_data._mesh_prop_stress_xx = mesh_prop_sigma_xx;
347 auto mesh_prop_sigma_yy = MeshLib::getOrCreateMeshProperty<double>(
351 _process_data._mesh_prop_stress_yy = mesh_prop_sigma_yy;
353 auto mesh_prop_sigma_zz = MeshLib::getOrCreateMeshProperty<double>(
357 _process_data._mesh_prop_stress_zz = mesh_prop_sigma_zz;
359 auto mesh_prop_sigma_xy = MeshLib::getOrCreateMeshProperty<double>(
363 _process_data._mesh_prop_stress_xy = mesh_prop_sigma_xy;
365 if (DisplacementDim == 3)
367 auto mesh_prop_sigma_xz = MeshLib::getOrCreateMeshProperty<double>(
371 _process_data._mesh_prop_stress_xz = mesh_prop_sigma_xz;
373 auto mesh_prop_sigma_yz = MeshLib::getOrCreateMeshProperty<double>(
377 _process_data._mesh_prop_stress_yz = mesh_prop_sigma_yz;
380 auto mesh_prop_epsilon_xx = MeshLib::getOrCreateMeshProperty<double>(
384 _process_data._mesh_prop_strain_xx = mesh_prop_epsilon_xx;
386 auto mesh_prop_epsilon_yy = MeshLib::getOrCreateMeshProperty<double>(
390 _process_data._mesh_prop_strain_yy = mesh_prop_epsilon_yy;
392 auto mesh_prop_epsilon_zz = MeshLib::getOrCreateMeshProperty<double>(
396 _process_data._mesh_prop_strain_zz = mesh_prop_epsilon_zz;
398 auto mesh_prop_epsilon_xy = MeshLib::getOrCreateMeshProperty<double>(
402 _process_data._mesh_prop_strain_xy = mesh_prop_epsilon_xy;
404 if (DisplacementDim == 3)
406 auto mesh_prop_epsilon_xz = MeshLib::getOrCreateMeshProperty<double>(
410 _process_data._mesh_prop_strain_xz = mesh_prop_epsilon_xz;
412 auto mesh_prop_epsilon_yz = MeshLib::getOrCreateMeshProperty<double>(
416 _process_data._mesh_prop_strain_yz = mesh_prop_epsilon_yz;
421 if (e->getDimension() < DisplacementDim)
427 std::vector<FractureProperty*> e_fracture_props;
428 std::unordered_map<int, int> e_fracID_to_local;
431 _process_data._vec_ele_connected_fractureIDs[e->getID()])
433 e_fracture_props.push_back(&_process_data.fracture_properties[fid]);
434 e_fracID_to_local.insert({fid, tmpi++});
436 std::vector<JunctionProperty*> e_junction_props;
437 std::unordered_map<int, int> e_juncID_to_local;
440 _process_data._vec_ele_connected_junctionIDs[e->getID()])
442 e_junction_props.push_back(&_process_data.junction_properties[fid]);
443 e_juncID_to_local.insert({fid, tmpi++});
446 e_fracture_props, e_junction_props, e_fracID_to_local, pt));
448 for (
unsigned i = 0; i < e_fracture_props.size(); i++)
450 auto mesh_prop_levelset = MeshLib::getOrCreateMeshProperty<double>(
453 std::to_string(e_fracture_props[i]->fracture_id + 1),
456 (*mesh_prop_levelset)[e->getID()] = levelsets[i];
458 for (
unsigned i = 0; i < e_junction_props.size(); i++)
460 auto mesh_prop_levelset = MeshLib::getOrCreateMeshProperty<double>(
463 std::to_string(e_junction_props[i]->junction_id + 1 +
464 _process_data.fracture_properties.size()),
467 (*mesh_prop_levelset)[e->getID()] =
468 levelsets[i + e_fracture_props.size()];
472 auto mesh_prop_w_n = MeshLib::getOrCreateMeshProperty<double>(
476 _process_data._mesh_prop_w_n = mesh_prop_w_n;
478 auto mesh_prop_w_s = MeshLib::getOrCreateMeshProperty<double>(
482 _process_data._mesh_prop_w_s = mesh_prop_w_s;
484 auto mesh_prop_b = MeshLib::getOrCreateMeshProperty<double>(
488 auto const& mesh_prop_matid = *_process_data._mesh_prop_materialIDs;
489 for (
auto const& fracture_prop : _process_data.fracture_properties)
493 if (e->getDimension() == DisplacementDim)
497 if (mesh_prop_matid[e->getID()] != fracture_prop.mat_id)
503 (*mesh_prop_b)[e->getID()] =
504 fracture_prop.aperture0
505 .getNodalValuesOnElement(*e, 0)
509 _process_data._mesh_prop_b = mesh_prop_b;
511 auto mesh_prop_fracture_stress_shear =
512 MeshLib::getOrCreateMeshProperty<double>(
516 _process_data._mesh_prop_fracture_stress_shear =
517 mesh_prop_fracture_stress_shear;
519 auto mesh_prop_fracture_stress_normal =
520 MeshLib::getOrCreateMeshProperty<double>(
524 _process_data._mesh_prop_fracture_stress_normal =
525 mesh_prop_fracture_stress_normal;
528 template <
int DisplacementDim>
530 double const t,
double const dt, std::vector<GlobalVector*>
const& x,
533 DBUG(
"Compute the secondary variables for SmallDeformationProcess.");
534 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
535 dof_tables.reserve(x.size());
536 std::generate_n(std::back_inserter(dof_tables), x.size(),
537 [&]() { return _local_to_global_index_map.get(); });
546 template <
int DisplacementDim>
552 template <
int DisplacementDim>
554 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
555 std::vector<GlobalVector*>
const& xdot,
int const process_id,
558 DBUG(
"Assemble SmallDeformationProcess.");
562 std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
563 dof_table = {std::ref(*_local_to_global_index_map)};
570 template <
int DisplacementDim>
573 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
574 std::vector<GlobalVector*>
const& xdot,
const double dxdot_dx,
575 const double dx_dx,
int const process_id,
GlobalMatrix& M,
578 DBUG(
"AssembleWithJacobian SmallDeformationProcess.");
583 std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
584 dof_table = {std::ref(*_local_to_global_index_map)};
588 dxdot_dx, dx_dx, process_id, M, K, b, Jac);
590 template <
int DisplacementDim>
592 std::vector<GlobalVector*>
const& x,
double const t,
double const dt,
593 const int process_id)
595 DBUG(
"PreTimestep SmallDeformationProcess.");
601 *_local_to_global_index_map, *x[process_id], t, dt);
void DBUG(char const *fmt, Args const &... args)
Definition of the class Properties that implements a container of properties.
Definition of the Mesh class.
Global vector based on Eigen vector.
const T * getCoords() const
bool isAxiallySymmetric() const
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
const Node * getNode(std::size_t idx) const
Get the node with the given index.
std::size_t getNumberOfElements() const
Get the number of elements.
PropertyVector< T > const * getPropertyVector(std::string const &name) const
virtual void preTimestep(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, double const delta_t)
virtual void computeSecondaryVariable(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id)
std::vector< std::size_t > const & getActiveElementIDs() const
Handles configuration of several secondary variables from the project file.
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< std::reference_wrapper< NumLib::LocalToGlobalIndexMap >> const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, const double dxdot_dx, const double dx_dx, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac)
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< std::reference_wrapper< NumLib::LocalToGlobalIndexMap >> const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b)
MeshLib::Node getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
@ BY_LOCATION
Ordering data by spatial location.
@ BY_COMPONENT
Ordering data by component type.
void setFractureProperty(int const dim, MeshLib::Element const &e, FractureProperty &frac_prop)
std::vector< double > uGlobalEnrichments(std::vector< FractureProperty * > const &frac_props, std::vector< JunctionProperty * > const &junction_props, std::unordered_map< int, int > const &fracID_to_local, Eigen::Vector3d const &x)
BranchProperty createBranchProperty(MeshLib::Node const &branchNode, FractureProperty const &master_frac, FractureProperty const &slave_frac)
void getFractureMatrixDataInMesh(MeshLib::Mesh const &mesh, std::vector< MeshLib::Element * > &vec_matrix_elements, std::vector< int > &vec_fracture_mat_IDs, std::vector< std::vector< MeshLib::Element * >> &vec_fracture_elements, std::vector< std::vector< MeshLib::Element * >> &vec_fracture_matrix_elements, std::vector< std::vector< MeshLib::Node * >> &vec_fracture_nodes, std::vector< std::pair< std::size_t, std::vector< int >>> &vec_branch_nodeID_matIDs, std::vector< std::pair< std::size_t, std::vector< int >>> &vec_junction_nodeID_matIDs)
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)