OGS
HydroMechanicsProcess.cpp
Go to the documentation of this file.
1 
11 #include "HydroMechanicsProcess.h"
12 
13 #include "LocalAssembler/CreateLocalAssemblers.h"
18 #include "MeshLib/ElementStatus.h"
19 #include "MeshLib/Elements/Utils.h"
20 #include "MeshLib/Mesh.h"
22 #include "MeshLib/Properties.h"
29 
30 namespace ProcessLib
31 {
32 namespace LIE
33 {
34 namespace HydroMechanics
35 {
36 template <int GlobalDim>
38  std::string name,
39  MeshLib::Mesh& mesh,
40  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
41  std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
42  unsigned const integration_order,
43  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
44  process_variables,
46  SecondaryVariableCollection&& secondary_variables,
47  bool const use_monolithic_scheme)
48  : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
49  integration_order, std::move(process_variables),
50  std::move(secondary_variables), use_monolithic_scheme),
51  _process_data(std::move(process_data))
52 {
53  INFO("[LIE/HM] looking for fracture elements in the given mesh");
54  std::vector<int> vec_fracture_mat_IDs;
55  std::vector<std::vector<MeshLib::Element*>> vec_vec_fracture_elements;
56  std::vector<std::vector<MeshLib::Element*>>
57  vec_vec_fracture_matrix_elements;
58  std::vector<std::vector<MeshLib::Node*>> vec_vec_fracture_nodes;
59  std::vector<std::pair<std::size_t, std::vector<int>>>
60  vec_branch_nodeID_matIDs;
61  std::vector<std::pair<std::size_t, std::vector<int>>>
62  vec_junction_nodeID_matIDs;
64  mesh, _vec_matrix_elements, vec_fracture_mat_IDs,
65  vec_vec_fracture_elements, vec_vec_fracture_matrix_elements,
66  vec_vec_fracture_nodes, vec_branch_nodeID_matIDs,
67  vec_junction_nodeID_matIDs);
69  vec_vec_fracture_elements[0].begin(),
70  vec_vec_fracture_elements[0].end());
73  vec_vec_fracture_matrix_elements[0].begin(),
74  vec_vec_fracture_matrix_elements[0].end());
76  vec_vec_fracture_nodes[0].begin(),
77  vec_vec_fracture_nodes[0].end());
78 
79  if (!_vec_fracture_elements.empty())
80  {
81  // set fracture property assuming a fracture forms a straight line
82  setFractureProperty(GlobalDim,
84  *_process_data.fracture_property);
85  }
86 
87  //
88  // If Neumann BCs for the displacement_jump variable are required they need
89  // special treatment because of the levelset function. The implementation
90  // exists in the version 6.1.0 (e54815cc07ee89c81f953a4955b1c788595dd725)
91  // and was removed due to lack of applications.
92  //
93 
94  if (!_process_data.deactivate_matrix_in_flow)
95  {
96  _process_data.p_element_status =
97  std::make_unique<MeshLib::ElementStatus>(&mesh);
98  }
99  else
100  {
101  auto const range =
103  if (!range)
104  {
105  OGS_FATAL(
106  "Could not get minimum/maximum ranges values for the "
107  "MaterialIDs property in the mesh '{:s}'.",
108  mesh.getName());
109  }
110 
111  std::vector<int> vec_p_inactive_matIDs;
112  for (int matID = range->first; matID <= range->second; matID++)
113  {
114  if (std::find(vec_fracture_mat_IDs.begin(),
115  vec_fracture_mat_IDs.end(),
116  matID) == vec_fracture_mat_IDs.end())
117  {
118  vec_p_inactive_matIDs.push_back(matID);
119  }
120  }
121  _process_data.p_element_status =
122  std::make_unique<MeshLib::ElementStatus>(&mesh,
123  vec_p_inactive_matIDs);
124 
125  const int monolithic_process_id = 0;
126  ProcessVariable const& pv_p =
127  getProcessVariables(monolithic_process_id)[0];
128  _process_data.p0 = &pv_p.getInitialCondition();
129  }
130 }
131 
132 template <int GlobalDim>
134 {
135  //------------------------------------------------------------
136  // prepare mesh subsets to define DoFs
137  //------------------------------------------------------------
138  // for extrapolation
139  _mesh_subset_all_nodes =
140  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
141  // pressure
142  _mesh_nodes_p = MeshLib::getBaseNodes(
143  _process_data.p_element_status->getActiveElements());
144  _mesh_subset_nodes_p =
145  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh_nodes_p);
146  // regular u
147  _mesh_subset_matrix_nodes =
148  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
149  if (!_vec_fracture_nodes.empty())
150  {
151  // u jump
152  _mesh_subset_fracture_nodes =
153  std::make_unique<MeshLib::MeshSubset>(_mesh, _vec_fracture_nodes);
154  }
155 
156  // Collect the mesh subsets in a vector.
157  std::vector<MeshLib::MeshSubset> all_mesh_subsets;
158  std::vector<int> vec_n_components;
159  std::vector<std::vector<MeshLib::Element*> const*> vec_var_elements;
160  // pressure
161  vec_n_components.push_back(1);
162  all_mesh_subsets.emplace_back(*_mesh_subset_nodes_p);
163  if (!_process_data.deactivate_matrix_in_flow)
164  {
165  vec_var_elements.push_back(&_mesh.getElements());
166  }
167  else
168  {
169  // TODO set elements including active nodes for pressure.
170  // cannot use ElementStatus
171  vec_var_elements.push_back(&_vec_fracture_matrix_elements);
172  }
173  // regular displacement
174  vec_n_components.push_back(GlobalDim);
175  std::generate_n(std::back_inserter(all_mesh_subsets), GlobalDim,
176  [&]() { return *_mesh_subset_matrix_nodes; });
177  vec_var_elements.push_back(&_vec_matrix_elements);
178  if (!_vec_fracture_nodes.empty())
179  {
180  // displacement jump
181  vec_n_components.push_back(GlobalDim);
182  std::generate_n(std::back_inserter(all_mesh_subsets), GlobalDim,
183  [&]() { return *_mesh_subset_fracture_nodes; });
184  vec_var_elements.push_back(&_vec_fracture_matrix_elements);
185  }
186 
187  INFO("[LIE/HM] creating a DoF table");
188  _local_to_global_index_map =
189  std::make_unique<NumLib::LocalToGlobalIndexMap>(
190  std::move(all_mesh_subsets),
191  vec_n_components,
192  vec_var_elements,
194 
195  DBUG("created {:d} DoF", _local_to_global_index_map->size());
196 }
197 
198 template <int GlobalDim>
200  NumLib::LocalToGlobalIndexMap const& dof_table,
201  MeshLib::Mesh const& mesh,
202  unsigned const integration_order)
203 {
204  assert(mesh.getDimension() == GlobalDim);
205  INFO("[LIE/HM] creating local assemblers");
206  const int monolithic_process_id = 0;
211  mesh.getElements(), dof_table,
212  // use displacement process variable for shapefunction order
213  getProcessVariables(monolithic_process_id)[1]
214  .get()
215  .getShapeFunctionOrder(),
216  _local_assemblers, mesh.isAxiallySymmetric(), integration_order,
217  _process_data);
218 
219  auto mesh_prop_sigma_xx = MeshLib::getOrCreateMeshProperty<double>(
220  const_cast<MeshLib::Mesh&>(mesh), "stress_xx",
222  mesh_prop_sigma_xx->resize(mesh.getNumberOfElements());
223  _process_data.mesh_prop_stress_xx = mesh_prop_sigma_xx;
224 
225  auto mesh_prop_sigma_yy = MeshLib::getOrCreateMeshProperty<double>(
226  const_cast<MeshLib::Mesh&>(mesh), "stress_yy",
228  mesh_prop_sigma_yy->resize(mesh.getNumberOfElements());
229  _process_data.mesh_prop_stress_yy = mesh_prop_sigma_yy;
230 
231  auto mesh_prop_sigma_zz = MeshLib::getOrCreateMeshProperty<double>(
232  const_cast<MeshLib::Mesh&>(mesh), "stress_zz",
234  mesh_prop_sigma_zz->resize(mesh.getNumberOfElements());
235  _process_data.mesh_prop_stress_zz = mesh_prop_sigma_zz;
236 
237  auto mesh_prop_sigma_xy = MeshLib::getOrCreateMeshProperty<double>(
238  const_cast<MeshLib::Mesh&>(mesh), "stress_xy",
240  mesh_prop_sigma_xy->resize(mesh.getNumberOfElements());
241  _process_data.mesh_prop_stress_xy = mesh_prop_sigma_xy;
242 
243  if (GlobalDim == 3)
244  {
245  auto mesh_prop_sigma_xz = MeshLib::getOrCreateMeshProperty<double>(
246  const_cast<MeshLib::Mesh&>(mesh), "stress_xz",
248  mesh_prop_sigma_xz->resize(mesh.getNumberOfElements());
249  _process_data.mesh_prop_stress_xz = mesh_prop_sigma_xz;
250 
251  auto mesh_prop_sigma_yz = MeshLib::getOrCreateMeshProperty<double>(
252  const_cast<MeshLib::Mesh&>(mesh), "stress_yz",
254  mesh_prop_sigma_yz->resize(mesh.getNumberOfElements());
255  _process_data.mesh_prop_stress_yz = mesh_prop_sigma_yz;
256  }
257 
258  auto mesh_prop_epsilon_xx = MeshLib::getOrCreateMeshProperty<double>(
259  const_cast<MeshLib::Mesh&>(mesh), "strain_xx",
261  mesh_prop_epsilon_xx->resize(mesh.getNumberOfElements());
262  _process_data.mesh_prop_strain_xx = mesh_prop_epsilon_xx;
263 
264  auto mesh_prop_epsilon_yy = MeshLib::getOrCreateMeshProperty<double>(
265  const_cast<MeshLib::Mesh&>(mesh), "strain_yy",
267  mesh_prop_epsilon_yy->resize(mesh.getNumberOfElements());
268  _process_data.mesh_prop_strain_yy = mesh_prop_epsilon_yy;
269 
270  auto mesh_prop_epsilon_zz = MeshLib::getOrCreateMeshProperty<double>(
271  const_cast<MeshLib::Mesh&>(mesh), "strain_zz",
273  mesh_prop_epsilon_zz->resize(mesh.getNumberOfElements());
274  _process_data.mesh_prop_strain_zz = mesh_prop_epsilon_zz;
275 
276  auto mesh_prop_epsilon_xy = MeshLib::getOrCreateMeshProperty<double>(
277  const_cast<MeshLib::Mesh&>(mesh), "strain_xy",
279  mesh_prop_epsilon_xy->resize(mesh.getNumberOfElements());
280  _process_data.mesh_prop_strain_xy = mesh_prop_epsilon_xy;
281 
282  if (GlobalDim == 3)
283  {
284  auto mesh_prop_epsilon_xz = MeshLib::getOrCreateMeshProperty<double>(
285  const_cast<MeshLib::Mesh&>(mesh), "strain_xz",
287  mesh_prop_epsilon_xz->resize(mesh.getNumberOfElements());
288  _process_data.mesh_prop_strain_xz = mesh_prop_epsilon_xz;
289 
290  auto mesh_prop_epsilon_yz = MeshLib::getOrCreateMeshProperty<double>(
291  const_cast<MeshLib::Mesh&>(mesh), "strain_yz",
293  mesh_prop_epsilon_yz->resize(mesh.getNumberOfElements());
294  _process_data.mesh_prop_strain_yz = mesh_prop_epsilon_yz;
295  }
296 
297  auto mesh_prop_velocity = MeshLib::getOrCreateMeshProperty<double>(
298  const_cast<MeshLib::Mesh&>(mesh), "velocity",
299  MeshLib::MeshItemType::Cell, GlobalDim);
300  mesh_prop_velocity->resize(mesh.getNumberOfElements() * GlobalDim);
301  _process_data.mesh_prop_velocity = mesh_prop_velocity;
302 
303  if (!_vec_fracture_elements.empty())
304  {
305  auto mesh_prop_levelset = MeshLib::getOrCreateMeshProperty<double>(
306  const_cast<MeshLib::Mesh&>(mesh), "levelset1",
308  mesh_prop_levelset->resize(mesh.getNumberOfElements());
309  for (MeshLib::Element const* e : _mesh.getElements())
310  {
311  if (e->getDimension() < GlobalDim)
312  {
313  continue;
314  }
315 
316  std::vector<FractureProperty*> fracture_props(
317  {_process_data.fracture_property.get()});
318  std::vector<JunctionProperty*> junction_props;
319  std::unordered_map<int, int> fracID_to_local({{0, 0}});
320  std::vector<double> levelsets = uGlobalEnrichments(
321  fracture_props, junction_props, fracID_to_local,
322  Eigen::Vector3d(MeshLib::getCenterOfGravity(*e).getCoords()));
323  (*mesh_prop_levelset)[e->getID()] = levelsets[0];
324  }
325 
326  auto mesh_prop_w_n = MeshLib::getOrCreateMeshProperty<double>(
327  const_cast<MeshLib::Mesh&>(mesh), "w_n",
329  mesh_prop_w_n->resize(mesh.getNumberOfElements());
330  auto mesh_prop_w_s = MeshLib::getOrCreateMeshProperty<double>(
331  const_cast<MeshLib::Mesh&>(mesh), "w_s",
333  mesh_prop_w_s->resize(mesh.getNumberOfElements());
334  _process_data.mesh_prop_w_n = mesh_prop_w_n;
335  _process_data.mesh_prop_w_s = mesh_prop_w_s;
336 
337  auto mesh_prop_b = MeshLib::getOrCreateMeshProperty<double>(
338  const_cast<MeshLib::Mesh&>(mesh), "aperture",
340  mesh_prop_b->resize(mesh.getNumberOfElements());
341  auto const mesh_prop_matid = materialIDs(mesh);
342  if (!mesh_prop_matid)
343  {
344  OGS_FATAL("Could not access MaterialIDs property from mesh.");
345  }
346  auto const& frac = _process_data.fracture_property;
347  for (MeshLib::Element const* e : _mesh.getElements())
348  {
349  if (e->getDimension() == GlobalDim)
350  {
351  continue;
352  }
353  if ((*mesh_prop_matid)[e->getID()] != frac->mat_id)
354  {
355  continue;
356  }
357  // Mean value for the element. This allows usage of node based
358  // properties for aperture.
359  (*mesh_prop_b)[e->getID()] =
360  frac->aperture0
361  .getNodalValuesOnElement(*e, /*time independent*/ 0)
362  .mean();
363  }
364  _process_data.mesh_prop_b = mesh_prop_b;
365 
366  auto mesh_prop_k_f = MeshLib::getOrCreateMeshProperty<double>(
367  const_cast<MeshLib::Mesh&>(mesh), "k_f",
369  mesh_prop_k_f->resize(mesh.getNumberOfElements());
370  _process_data.mesh_prop_k_f = mesh_prop_k_f;
371 
372  auto mesh_prop_fracture_stress_shear =
373  MeshLib::getOrCreateMeshProperty<double>(
374  const_cast<MeshLib::Mesh&>(mesh), "f_stress_s",
376  mesh_prop_fracture_stress_shear->resize(mesh.getNumberOfElements());
377  _process_data.mesh_prop_fracture_stress_shear =
378  mesh_prop_fracture_stress_shear;
379 
380  auto mesh_prop_fracture_stress_normal =
381  MeshLib::getOrCreateMeshProperty<double>(
382  const_cast<MeshLib::Mesh&>(mesh), "f_stress_n",
384  mesh_prop_fracture_stress_normal->resize(mesh.getNumberOfElements());
385  _process_data.mesh_prop_fracture_stress_normal =
386  mesh_prop_fracture_stress_normal;
387 
388  auto mesh_prop_fracture_shear_failure =
389  MeshLib::getOrCreateMeshProperty<double>(
390  const_cast<MeshLib::Mesh&>(mesh), "f_shear_failure",
392  mesh_prop_fracture_shear_failure->resize(mesh.getNumberOfElements());
393  _process_data.mesh_prop_fracture_shear_failure =
394  mesh_prop_fracture_shear_failure;
395 
396  auto mesh_prop_nodal_w = MeshLib::getOrCreateMeshProperty<double>(
397  const_cast<MeshLib::Mesh&>(mesh), "nodal_w",
398  MeshLib::MeshItemType::Node, GlobalDim);
399  mesh_prop_nodal_w->resize(mesh.getNumberOfNodes() * GlobalDim);
400  _process_data.mesh_prop_nodal_w = mesh_prop_nodal_w;
401 
402  auto mesh_prop_nodal_b = MeshLib::getOrCreateMeshProperty<double>(
403  const_cast<MeshLib::Mesh&>(mesh), "nodal_aperture",
405  mesh_prop_nodal_b->resize(mesh.getNumberOfNodes());
406  _process_data.mesh_prop_nodal_b = mesh_prop_nodal_b;
407 
408  if (GlobalDim == 3)
409  {
410  auto mesh_prop_w_s2 = MeshLib::getOrCreateMeshProperty<double>(
411  const_cast<MeshLib::Mesh&>(mesh), "w_s2",
413  mesh_prop_w_s2->resize(mesh.getNumberOfElements());
414  _process_data.mesh_prop_w_s2 = mesh_prop_w_s2;
415 
416  auto mesh_prop_fracture_stress_shear2 =
417  MeshLib::getOrCreateMeshProperty<double>(
418  const_cast<MeshLib::Mesh&>(mesh), "f_stress_s2",
420  mesh_prop_fracture_stress_shear2->resize(
421  mesh.getNumberOfElements());
422  _process_data.mesh_prop_fracture_stress_shear2 =
423  mesh_prop_fracture_stress_shear2;
424  }
425 
426  auto mesh_prop_nodal_p = MeshLib::getOrCreateMeshProperty<double>(
427  const_cast<MeshLib::Mesh&>(mesh), "pressure_interpolated",
429  mesh_prop_nodal_p->resize(mesh.getNumberOfNodes());
430  _process_data.mesh_prop_nodal_p = mesh_prop_nodal_p;
431 
432  _process_data.mesh_prop_nodal_forces =
433  MeshLib::getOrCreateMeshProperty<double>(
434  const_cast<MeshLib::Mesh&>(mesh), "NodalForces",
435  MeshLib::MeshItemType::Node, GlobalDim);
436  assert(_process_data.mesh_prop_nodal_forces->size() ==
437  GlobalDim * mesh.getNumberOfNodes());
438 
439  _process_data.mesh_prop_nodal_forces_jump =
440  MeshLib::getOrCreateMeshProperty<double>(
441  const_cast<MeshLib::Mesh&>(mesh), "NodalForcesJump",
442  MeshLib::MeshItemType::Node, GlobalDim);
443  assert(_process_data.mesh_prop_nodal_forces_jump->size() ==
444  GlobalDim * mesh.getNumberOfNodes());
445 
446  _process_data.mesh_prop_hydraulic_flow =
447  MeshLib::getOrCreateMeshProperty<double>(
448  const_cast<MeshLib::Mesh&>(mesh), "HydraulicFlow",
450  assert(_process_data.mesh_prop_hydraulic_flow->size() ==
451  mesh.getNumberOfNodes());
452  }
453 }
454 
455 template <int GlobalDim>
457  std::vector<GlobalVector*> const& x, const double t, double const dt,
458  int const process_id)
459 {
460  if (process_id == 0)
461  {
462  DBUG("PostTimestep HydroMechanicsProcess.");
463  std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
464  auto const n_processes = x.size();
465  dof_tables.reserve(n_processes);
466  for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
467  {
468  dof_tables.push_back(&getDOFTable(process_id));
469  }
470 
471  ProcessLib::ProcessVariable const& pv =
472  getProcessVariables(process_id)[0];
475  _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, t, dt);
476  }
477 
478  DBUG("Compute the secondary variables for HydroMechanicsProcess.");
479 
480  const auto& dof_table = getDOFTable(process_id);
481 
482  // Copy displacement jumps in a solution vector to mesh property
483  // Remark: the copy is required because mesh properties for primary
484  // variables are set during output and are not ready yet when this function
485  // is called.
486  int g_variable_id = 0;
487  {
488  const int monolithic_process_id = 0;
489  auto const& pvs = getProcessVariables(monolithic_process_id);
490  auto const it =
491  std::find_if(pvs.begin(), pvs.end(),
492  [](ProcessVariable const& pv)
493  { return pv.getName() == "displacement_jump1"; });
494  if (it == pvs.end())
495  {
496  OGS_FATAL(
497  "Didn't find expected 'displacement_jump1' process variable.");
498  }
499  g_variable_id = static_cast<int>(std::distance(pvs.begin(), it));
500  }
501 
503 
504  const int monolithic_process_id = 0;
505  ProcessVariable& pv_g =
506  this->getProcessVariables(monolithic_process_id)[g_variable_id];
507  auto const num_comp = pv_g.getNumberOfGlobalComponents();
508  auto& mesh_prop_g = *MeshLib::getOrCreateMeshProperty<double>(
509  _mesh, pv_g.getName(), MeshLib::MeshItemType::Node, num_comp);
510  for (int component_id = 0; component_id < num_comp; ++component_id)
511  {
512  auto const& mesh_subset =
513  dof_table.getMeshSubset(g_variable_id, component_id);
514  auto const mesh_id = mesh_subset.getMeshID();
515  for (auto const* node : mesh_subset.getNodes())
516  {
518  node->getID());
519 
520  auto const global_index =
521  dof_table.getGlobalIndex(l, g_variable_id, component_id);
522  mesh_prop_g[node->getID() * num_comp + component_id] =
523  (*x[process_id])[global_index];
524  }
525  }
526 
527  // compute nodal w and aperture
528  auto const& R = _process_data.fracture_property->R;
529  auto const& b0 = _process_data.fracture_property->aperture0;
530  MeshLib::PropertyVector<double>& vec_w = *_process_data.mesh_prop_nodal_w;
531  MeshLib::PropertyVector<double>& vec_b = *_process_data.mesh_prop_nodal_b;
532 
533  auto compute_nodal_aperture =
534  [&](std::size_t const node_id, double const w_n)
535  {
536  // skip aperture computation for element-wise defined b0 because there
537  // are jumps on the nodes between the element's values.
538  if (dynamic_cast<ParameterLib::MeshElementParameter<double> const*>(
539  &b0))
540  {
541  return std::numeric_limits<double>::quiet_NaN();
542  }
543 
545  x.setNodeID(node_id);
546  return w_n + b0(/*time independent*/ 0, x)[0];
547  };
548 
549  Eigen::VectorXd g(GlobalDim);
550  Eigen::VectorXd w(GlobalDim);
551  for (MeshLib::Node const* node : _vec_fracture_nodes)
552  {
553  auto const node_id = node->getID();
554  g.setZero();
555  for (int k = 0; k < GlobalDim; k++)
556  {
557  g[k] = mesh_prop_g[node_id * GlobalDim + k];
558  }
559 
560  w.noalias() = R * g;
561  for (int k = 0; k < GlobalDim; k++)
562  {
563  vec_w[node_id * GlobalDim + k] = w[k];
564  }
565 
566  vec_b[node_id] = compute_nodal_aperture(node_id, w[GlobalDim - 1]);
567  }
568 }
569 
570 template <int GlobalDim>
572 {
573  return false;
574 }
575 
576 template <int GlobalDim>
578  const double t, double const dt, std::vector<GlobalVector*> const& x,
579  std::vector<GlobalVector*> const& xdot, int const process_id,
581 {
582  DBUG("Assemble HydroMechanicsProcess.");
583 
584  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
585  dof_table = {std::ref(*_local_to_global_index_map)};
586  // Call global assembler for each local assembly item.
588  _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
589  dof_table, t, dt, x, xdot, process_id, M, K, b);
590 }
591 
592 template <int GlobalDim>
594  const double t, double const dt, std::vector<GlobalVector*> const& x,
595  std::vector<GlobalVector*> const& xdot, const double dxdot_dx,
596  const double dx_dx, int const process_id, GlobalMatrix& M, GlobalMatrix& K,
597  GlobalVector& b, GlobalMatrix& Jac)
598 {
599  DBUG("AssembleWithJacobian HydroMechanicsProcess.");
600 
601  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
602 
603  // Call global assembler for each local assembly item.
604  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
605  dof_table = {std::ref(*_local_to_global_index_map)};
608  _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot,
609  dxdot_dx, dx_dx, process_id, M, K, b, Jac);
610 
611  auto copyRhs = [&](int const variable_id, auto& output_vector)
612  {
613  transformVariableFromGlobalVector(b, variable_id,
614  *_local_to_global_index_map,
615  output_vector, std::negate<double>());
616  };
617  copyRhs(0, *_process_data.mesh_prop_hydraulic_flow);
618  copyRhs(1, *_process_data.mesh_prop_nodal_forces);
619  copyRhs(2, *_process_data.mesh_prop_nodal_forces_jump);
620 }
621 
622 template <int GlobalDim>
624  std::vector<GlobalVector*> const& x, double const t, double const dt,
625  int const process_id)
626 {
627  DBUG("PreTimestep HydroMechanicsProcess.");
628 
629  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
630 
633  pv.getActiveElementIDs(), *_local_to_global_index_map, *x[process_id],
634  t, dt);
635 }
636 
637 // ------------------------------------------------------------------------------------
638 // template instantiation
639 // ------------------------------------------------------------------------------------
640 template class HydroMechanicsProcess<2>;
641 template class HydroMechanicsProcess<3>;
642 
643 } // namespace HydroMechanics
644 } // namespace LIE
645 } // namespace ProcessLib
Definition of the ElementStatus class.
#define OGS_FATAL(...)
Definition: Error.h:26
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
Definition of the MeshInformation class.
Definition of the class Properties that implements a container of properties.
Definition of the Mesh class.
Global vector based on Eigen vector.
Definition: EigenVector.h:26
const T * getCoords() const
Definition: TemplatePoint.h:75
static std::optional< std::pair< T, T > > const getValueBounds(PropertyVector< T > const &property)
bool isAxiallySymmetric() const
Definition: Mesh.h:126
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:71
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:98
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:92
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:89
std::size_t getNumberOfElements() const
Get the number of elements.
Definition: Mesh.h:86
void setNodeID(std::size_t node_id)
void assembleWithJacobianConcreteProcess(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) override
void preTimestepConcreteProcess(std::vector< GlobalVector * > const &x, double const t, double const dt, int const process_id) override
std::vector< MeshLib::Element * > _vec_fracture_matrix_elements
void assembleConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
HydroMechanicsProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, HydroMechanicsProcessData< GlobalDim > &&process_data, SecondaryVariableCollection &&secondary_variables, bool const use_monolithic_scheme)
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, double const t, double const dt, int const process_id) override
HydroMechanicsProcessData< GlobalDim > _process_data
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
virtual void postTimestep(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, double const dt)
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)
std::string const & getName() const
ParameterLib::Parameter< double > const & getInitialCondition() const
int getNumberOfGlobalComponents() const
Returns the number of components of the process variable.
std::vector< std::size_t > const & getActiveElementIDs() const
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:145
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)
void setLocalAccessibleVector(PETScVector const &x)
Definition: LinAlg.cpp:27
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:258
MeshLib::Node getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
Definition: Element.cpp:126
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
Definition: Utils.h:26
@ BY_COMPONENT
Ordering data by component type.
void transformVariableFromGlobalVector(GlobalVector const &input_vector, int const variable_id, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, MeshLib::PropertyVector< double > &output_vector, Functor mapFunction)
Definition: DOFTableUtil.h:59
void createLocalAssemblers(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
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)
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)
Definition: MeshUtils.cpp:213
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)
static void executeMemberDereferenced(Object &object, Method method, Container const &container, Args &&... args)
A parameter represented by a mesh property vector.