29namespace SmallDeformation
31template <
int DisplacementDim>
35 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
36 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
37 unsigned const integration_order,
38 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
42 :
Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
43 integration_order, std::move(process_variables),
44 std::move(secondary_variables)),
45 _process_data(std::move(process_data))
47 std::vector<std::pair<std::size_t, std::vector<int>>>
48 vec_branch_nodeID_matIDs;
49 std::vector<std::pair<std::size_t, std::vector<int>>>
50 vec_junction_nodeID_matIDs;
55 vec_junction_nodeID_matIDs);
61 "The number of the given fracture properties ({:d}) are not "
62 "consistent with the number of fracture groups in a mesh ({:d}).",
70 _process_data.map_materialID_to_fractureID.resize(*max_frac_mat_id + 1);
84 _process_data.vec_ele_connected_fractureIDs[e->getID()].push_back(
100 for (
auto const& [vec_branch_nodeID, matID] : vec_branch_nodeID_matIDs)
102 auto master_matId = matID[0];
103 auto slave_matId = matID[1];
112 *mesh.
getNode(vec_branch_nodeID), master_frac, slave_frac));
115 *mesh.
getNode(vec_branch_nodeID), master_frac, slave_frac));
119 transform(cbegin(vec_junction_nodeID_matIDs),
120 cend(vec_junction_nodeID_matIDs),
122 [&](
auto& vec_junction_nodeID_matID)
128 for (std::size_t i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
130 auto const& material_ids = vec_junction_nodeID_matIDs[i].second;
131 assert(material_ids.size() == 2);
132 std::array<int, 2> fracture_ids{
133 {
_process_data.map_materialID_to_fractureID[material_ids[0]],
134 _process_data.map_materialID_to_fractureID[material_ids[1]]}};
137 i, *mesh.
getNode(vec_junction_nodeID_matIDs[i].first),
144 for (
unsigned i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
146 auto node = mesh.
getNode(vec_junction_nodeID_matIDs[i].first);
150 _process_data.vec_ele_connected_junctionIDs[id].push_back(i);
156 vec_junction_nodeID_matIDs.size());
157 for (
unsigned i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
159 auto node = mesh.
getNode(vec_junction_nodeID_matIDs[i].first);
179template <
int DisplacementDim>
186 _mesh_subset_all_nodes =
187 std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
189 _mesh_subset_matrix_nodes =
190 std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
192 for (
unsigned i = 0; i < _vec_fracture_nodes.size(); i++)
194 _mesh_subset_fracture_nodes.push_back(
195 std::make_unique<MeshLib::MeshSubset const>(
196 _mesh, _vec_fracture_nodes[i]));
199 _mesh_subset_junction_nodes =
200 std::make_unique<MeshLib::MeshSubset>(_mesh, _vec_junction_nodes);
203 std::vector<MeshLib::MeshSubset> all_mesh_subsets;
204 std::generate_n(std::back_inserter(all_mesh_subsets), DisplacementDim,
205 [&]() {
return *_mesh_subset_matrix_nodes; });
206 for (
auto const& ms : _mesh_subset_fracture_nodes)
208 std::generate_n(std::back_inserter(all_mesh_subsets),
210 [&]() {
return *ms; });
212 std::generate_n(std::back_inserter(all_mesh_subsets),
214 [&]() {
return *_mesh_subset_junction_nodes; });
216 std::vector<int>
const vec_n_components(
217 1 + _vec_fracture_mat_IDs.size() + _vec_junction_nodes.size(),
220 std::vector<std::vector<MeshLib::Element*>
const*> vec_var_elements;
221 vec_var_elements.push_back(&_vec_matrix_elements);
222 for (
unsigned i = 0; i < _vec_fracture_matrix_elements.size(); i++)
224 vec_var_elements.push_back(&_vec_fracture_matrix_elements[i]);
226 for (
unsigned i = 0; i < _vec_junction_fracture_matrix_elements.size(); i++)
228 vec_var_elements.push_back(&_vec_junction_fracture_matrix_elements[i]);
231 _local_to_global_index_map =
232 std::make_unique<NumLib::LocalToGlobalIndexMap>(
233 std::move(all_mesh_subsets),
239template <
int DisplacementDim>
243 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 auto add_secondary_variable = [&](std::string
const& name,
264 int const num_components,
265 auto get_ip_values_function)
267 _secondary_variables.addSecondaryVariable(
271 std::move(get_ip_values_function)));
274 add_secondary_variable(
"sigma",
276 DisplacementDim>::RowsAtCompileTime,
277 &LocalAssemblerInterface::getIntPtSigma);
279 add_secondary_variable(
"epsilon",
281 DisplacementDim>::RowsAtCompileTime,
282 &LocalAssemblerInterface::getIntPtEpsilon);
284 add_secondary_variable(
"fracture_stress", DisplacementDim,
285 &LocalAssemblerInterface::getIntPtFractureStress);
287 add_secondary_variable(
"fracture_aperture", 1,
288 &LocalAssemblerInterface::getIntPtFractureAperture);
294 DisplacementDim>::RowsAtCompileTime);
298 if (e->getDimension() < DisplacementDim)
304 std::vector<FractureProperty*> e_fracture_props;
305 std::unordered_map<int, int> e_fracID_to_local;
307 for (
auto fid : _process_data.vec_ele_connected_fractureIDs[e->getID()])
309 e_fracture_props.push_back(&_process_data.fracture_properties[fid]);
310 e_fracID_to_local.insert({fid, tmpi++});
312 std::vector<JunctionProperty*> e_junction_props;
313 std::unordered_map<int, int> e_juncID_to_local;
315 for (
auto fid : _process_data.vec_ele_connected_junctionIDs[e->getID()])
317 e_junction_props.push_back(&_process_data.junction_properties[fid]);
318 e_juncID_to_local.insert({fid, tmpi++});
321 e_fracture_props, e_junction_props, e_fracID_to_local, pt));
323 for (
unsigned i = 0; i < e_fracture_props.size(); i++)
328 std::to_string(e_fracture_props[i]->fracture_id + 1),
331 (*mesh_prop_levelset)[e->getID()] = levelsets[i];
333 for (
unsigned i = 0; i < e_junction_props.size(); i++)
338 std::to_string(e_junction_props[i]->junction_id + 1 +
339 _process_data.fracture_properties.size()),
342 (*mesh_prop_levelset)[e->getID()] =
343 levelsets[i + e_fracture_props.size()];
347 _process_data.element_local_jumps =
352 _process_data.element_fracture_stresses =
362 auto const& mesh_prop_matid = *_process_data.mesh_prop_materialIDs;
363 for (
auto const& fracture_prop : _process_data.fracture_properties)
367 if (e->getDimension() == DisplacementDim)
371 if (mesh_prop_matid[e->getID()] != fracture_prop.mat_id)
377 (*mesh_prop_b)[e->getID()] =
378 fracture_prop.aperture0
379 .getNodalValuesOnElement(*e, 0)
383 _process_data.mesh_prop_b = mesh_prop_b;
386template <
int DisplacementDim>
388 double const t,
double const dt, std::vector<GlobalVector*>
const& x,
391 DBUG(
"Compute the secondary variables for SmallDeformationProcess.");
392 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
393 dof_tables.reserve(x.size());
394 std::generate_n(std::back_inserter(dof_tables), x.size(),
395 [&]() { return _local_to_global_index_map.get(); });
399 _local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
403template <
int DisplacementDim>
409template <
int DisplacementDim>
411 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
412 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
415 DBUG(
"Assemble SmallDeformationProcess.");
417 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
418 _local_to_global_index_map.get()};
422 getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, &M, &K,
425template <
int DisplacementDim>
428 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
429 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
432 DBUG(
"AssembleWithJacobian SmallDeformationProcess.");
434 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
435 _local_to_global_index_map.get()};
439 _local_assemblers, getActiveElementIDs(), dof_table, t, dt, x, x_prev,
440 process_id, &b, &Jac);
442template <
int DisplacementDim>
444 std::vector<GlobalVector*>
const& x,
double const t,
double const dt,
445 const int process_id)
447 DBUG(
"PreTimestep SmallDeformationProcess.");
451 _local_assemblers, getActiveElementIDs(), *_local_to_global_index_map,
452 *x[process_id], t, dt);
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the class Properties that implements a container of properties.
Definition of the Mesh class.
Global vector based on Eigen vector.
Eigen::Vector3d const & asEigenVector3d() const
bool isAxiallySymmetric() const
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
const Node * getNode(std::size_t idx) const
Get the node with the given index.
Properties & getProperties()
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
std::size_t getNumberOfElements() const
Get the number of elements.
PropertyVector< T > const * getPropertyVector(std::string_view name) const
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_prev, int const process_id)
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)
Handles configuration of several secondary variables from the project file.
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix *M, GlobalMatrix *K, GlobalVector *b)
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector *b, GlobalMatrix *Jac)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
@ 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)
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)
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)
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)