OGS
ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim > Class Template Referencefinal

Detailed Description

template<int GlobalDim>
class ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >

Definition at line 27 of file HydroMechanicsProcess.h.

#include <HydroMechanicsProcess.h>

Inheritance diagram for ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >:
[legend]
Collaboration diagram for ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >:
[legend]

Public Member Functions

 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
 
ODESystem interface
bool isLinear () const override
 
- Public Member Functions inherited from ProcessLib::Process
 Process (std::string name_, MeshLib::Mesh &mesh, std::unique_ptr< 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, SecondaryVariableCollection &&secondary_variables, const bool use_monolithic_scheme=true)
 
void preTimestep (std::vector< GlobalVector * > const &x, const double t, const double delta_t, const int process_id)
 Preprocessing before starting assembly for new timestep. More...
 
void postTimestep (std::vector< GlobalVector * > const &x, const double t, const double delta_t, int const process_id)
 Postprocessing after a complete timestep. More...
 
void postNonLinearSolver (GlobalVector const &x, GlobalVector const &xdot, const double t, double const dt, int const process_id)
 
void preIteration (const unsigned iter, GlobalVector const &x) final
 
void computeSecondaryVariable (double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id)
 compute secondary variables for the coupled equations or for output. More...
 
NumLib::IterationResult postIteration (GlobalVector const &x) final
 
void initialize ()
 
void setInitialConditions (std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, double const t, int const process_id)
 
MathLib::MatrixSpecifications getMatrixSpecifications (const int process_id) const override
 
void setCoupledSolutionsForStaggeredScheme (CoupledSolutionsForStaggeredScheme *const coupled_solutions)
 
void updateDeactivatedSubdomains (double const time, const int process_id)
 
bool isMonolithicSchemeUsed () const
 
virtual void setCoupledTermForTheStaggeredSchemeToLocalAssemblers (int const)
 
virtual void extrapolateIntegrationPointValuesToNodes (const double, std::vector< GlobalVector * > const &, std::vector< GlobalVector * > &)
 
void preAssemble (const double t, double const dt, GlobalVector const &x) final
 
void assemble (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) final
 
void assembleWithJacobian (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) final
 
std::vector< NumLib::IndexValueVector< GlobalIndexType > > const * getKnownSolutions (double const t, GlobalVector const &x, int const process_id) const final
 
virtual NumLib::LocalToGlobalIndexMap const & getDOFTable (const int) const
 
MeshLib::MeshgetMesh () const
 
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables (const int process_id) const
 
SecondaryVariableCollection const & getSecondaryVariables () const
 
std::vector< std::unique_ptr< IntegrationPointWriter > > const * getIntegrationPointWriter (MeshLib::Mesh const &mesh) const
 
virtual Eigen::Vector3d getFlux (std::size_t, MathLib::Point3d const &, double const, std::vector< GlobalVector * > const &) const
 
virtual void solveReactionEquation (std::vector< GlobalVector * > &, std::vector< GlobalVector * > const &, double const, double const, NumLib::EquationSystem &, int const)
 

Private Types

using LocalAssemblerInterface = HydroMechanicsLocalAssemblerInterface
 

Private Member Functions

void constructDofTable () override
 
void initializeConcreteProcess (NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
 Process specific initialization called by initialize(). More...
 
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
 
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
 

Private Attributes

HydroMechanicsProcessData< GlobalDim > _process_data
 
std::vector< std::unique_ptr< LocalAssemblerInterface > > _local_assemblers
 
std::vector< MeshLib::Element * > _vec_matrix_elements
 
std::vector< MeshLib::Element * > _vec_fracture_elements
 
std::vector< MeshLib::Element * > _vec_fracture_matrix_elements
 
std::vector< MeshLib::Node * > _vec_fracture_nodes
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_fracture_nodes
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_matrix_nodes
 
std::vector< MeshLib::Node * > _mesh_nodes_p
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_nodes_p
 

Additional Inherited Members

- Public Types inherited from ProcessLib::Process
using NonlinearSolver = NumLib::NonlinearSolverBase
 
using TimeDiscretization = NumLib::TimeDiscretization
 
- Public Attributes inherited from ProcessLib::Process
std::string const name
 
- Protected Member Functions inherited from ProcessLib::Process
NumLib::ExtrapolatorgetExtrapolator () const
 
NumLib::LocalToGlobalIndexMap const & getSingleComponentDOFTable () const
 
void initializeProcessBoundaryConditionsAndSourceTerms (const NumLib::LocalToGlobalIndexMap &dof_table, const int process_id)
 
void constructMonolithicProcessDofTable ()
 
void constructDofTableOfSpecifiedProcessStaggeredScheme (const int specified_prosess_id)
 
virtual std::tuple< NumLib::LocalToGlobalIndexMap *, bool > getDOFTableForExtrapolatorData () const
 
- Protected Attributes inherited from ProcessLib::Process
MeshLib::Mesh_mesh
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map
 
SecondaryVariableCollection _secondary_variables
 
VectorMatrixAssembler _global_assembler
 
const bool _use_monolithic_scheme
 
CoupledSolutionsForStaggeredScheme_coupled_solutions
 
unsigned const _integration_order
 
std::vector< std::unique_ptr< IntegrationPointWriter > > _integration_point_writer
 
GlobalSparsityPattern _sparsity_pattern
 
std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > _process_variables
 
std::vector< BoundaryConditionCollection_boundary_conditions
 

Member Typedef Documentation

◆ LocalAssemblerInterface

Constructor & Destructor Documentation

◆ HydroMechanicsProcess()

template<int GlobalDim>
ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::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 
)

Definition at line 37 of file HydroMechanicsProcess.cpp.

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 }
#define OGS_FATAL(...)
Definition: Error.h:26
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
static std::optional< std::pair< T, T > > const getValueBounds(PropertyVector< T > const &property)
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:92
std::vector< MeshLib::Element * > _vec_fracture_matrix_elements
HydroMechanicsProcessData< GlobalDim > _process_data
std::string const name
Definition: Process.h:323
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:145
Process(std::string name_, MeshLib::Mesh &mesh, std::unique_ptr< 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, SecondaryVariableCollection &&secondary_variables, const bool use_monolithic_scheme=true)
Definition: Process.cpp:22
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:258
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)
Definition: MeshUtils.cpp:213

References ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_process_data, ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_fracture_elements, ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_fracture_matrix_elements, ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_fracture_nodes, ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_matrix_elements, ProcessLib::LIE::getFractureMatrixDataInMesh(), ProcessLib::ProcessVariable::getInitialCondition(), MeshLib::Mesh::getName(), ProcessLib::Process::getProcessVariables(), MeshLib::MeshInformation::getValueBounds(), INFO(), MeshLib::materialIDs(), OGS_FATAL, and ProcessLib::LIE::setFractureProperty().

Member Function Documentation

◆ assembleConcreteProcess()

template<int GlobalDim>
void ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::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 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 577 of file HydroMechanicsProcess.cpp.

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.
589  dof_table, t, dt, x, xdot, process_id, M, K, b);
590 }
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
std::vector< std::unique_ptr< LocalAssemblerInterface > > _local_assemblers
VectorMatrixAssembler _global_assembler
Definition: Process.h:333
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition: Process.h:329
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)
static void executeMemberDereferenced(Object &object, Method method, Container const &container, Args &&... args)

References ProcessLib::VectorMatrixAssembler::assemble(), DBUG(), and NumLib::SerialExecutor::executeMemberDereferenced().

◆ assembleWithJacobianConcreteProcess()

template<int GlobalDim>
void ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::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 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 593 of file HydroMechanicsProcess.cpp.

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,
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 }
std::vector< std::size_t > const & getActiveElementIDs() const
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 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
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)

References ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), DBUG(), NumLib::SerialExecutor::executeSelectedMemberDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), and NumLib::transformVariableFromGlobalVector().

◆ constructDofTable()

template<int GlobalDim>
void ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::constructDofTable
overrideprivatevirtual

This function is for general cases, in which all equations of the coupled processes have the same number of unknowns. For the general cases with the staggered scheme, all equations of the coupled processes share one DOF table hold by _local_to_global_index_map. Other cases can be considered by overloading this member function in the derived class.

Reimplemented from ProcessLib::Process.

Definition at line 133 of file HydroMechanicsProcess.cpp.

134 {
135  //------------------------------------------------------------
136  // prepare mesh subsets to define DoFs
137  //------------------------------------------------------------
138  // for extrapolation
140  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
141  // pressure
143  _process_data.p_element_status->getActiveElements());
145  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh_nodes_p);
146  // regular u
148  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
149  if (!_vec_fracture_nodes.empty())
150  {
151  // u jump
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");
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 }
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:95
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:98
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_matrix_nodes
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_fracture_nodes
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_nodes_p
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
Definition: Process.h:327
MeshLib::Mesh & _mesh
Definition: Process.h:326
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
Definition: Utils.h:26
@ BY_COMPONENT
Ordering data by component type.

References NumLib::BY_COMPONENT, DBUG(), MeshLib::getBaseNodes(), and INFO().

◆ initializeConcreteProcess()

template<int GlobalDim>
void ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess ( NumLib::LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh,
unsigned const  integration_order 
)
overrideprivatevirtual

Process specific initialization called by initialize().

Implements ProcessLib::Process.

Definition at line 199 of file HydroMechanicsProcess.cpp.

203 {
204  assert(mesh.getDimension() == GlobalDim);
205  INFO("[LIE/HM] creating local assemblers");
206  const int monolithic_process_id = 0;
208  GlobalDim, HydroMechanicsLocalAssemblerMatrix,
209  HydroMechanicsLocalAssemblerMatrixNearFracture,
210  HydroMechanicsLocalAssemblerFracture>(
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 }
const T * getCoords() const
Definition: TemplatePoint.h:75
MeshLib::Node getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
Definition: Element.cpp:126
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)
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)

References MeshLib::Cell, ProcessLib::LIE::HydroMechanics::createLocalAssemblers(), MeshLib::getCenterOfGravity(), MathLib::TemplatePoint< T, DIM >::getCoords(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), INFO(), MeshLib::Mesh::isAxiallySymmetric(), MeshLib::materialIDs(), MeshLib::Node, OGS_FATAL, and ProcessLib::LIE::uGlobalEnrichments().

◆ isLinear()

template<int GlobalDim>
bool ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::isLinear
override

Definition at line 571 of file HydroMechanicsProcess.cpp.

572 {
573  return false;
574 }

◆ postTimestepConcreteProcess()

template<int GlobalDim>
void ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::postTimestepConcreteProcess ( std::vector< GlobalVector * > const &  x,
double const  t,
double const  dt,
int const  process_id 
)
overridevirtual

Reimplemented from ProcessLib::Process.

Definition at line 456 of file HydroMechanicsProcess.cpp.

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 }
void setNodeID(std::size_t node_id)
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 NumLib::LocalToGlobalIndexMap const & getDOFTable(const int) const
Definition: Process.h:137
void setLocalAccessibleVector(PETScVector const &x)
Definition: LinAlg.cpp:27
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
A parameter represented by a mesh property vector.

References DBUG(), NumLib::SerialExecutor::executeSelectedMemberOnDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), MeshLib::Node, OGS_FATAL, ProcessLib::LocalAssemblerInterface::postTimestep(), MathLib::LinAlg::setLocalAccessibleVector(), and ParameterLib::SpatialPosition::setNodeID().

◆ preTimestepConcreteProcess()

template<int GlobalDim>
void ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::preTimestepConcreteProcess ( std::vector< GlobalVector * > const &  x,
double const  t,
double const  dt,
int const  process_id 
)
overrideprivatevirtual

Reimplemented from ProcessLib::Process.

Definition at line 623 of file HydroMechanicsProcess.cpp.

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 }
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)

References DBUG(), NumLib::SerialExecutor::executeSelectedMemberOnDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), and ProcessLib::LocalAssemblerInterface::preTimestep().

Member Data Documentation

◆ _local_assemblers

template<int GlobalDim>
std::vector<std::unique_ptr<LocalAssemblerInterface> > ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_local_assemblers
private

Definition at line 85 of file HydroMechanicsProcess.h.

◆ _mesh_nodes_p

template<int GlobalDim>
std::vector<MeshLib::Node*> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_mesh_nodes_p
private

Definition at line 95 of file HydroMechanicsProcess.h.

◆ _mesh_subset_fracture_nodes

template<int GlobalDim>
std::unique_ptr<MeshLib::MeshSubset const> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_mesh_subset_fracture_nodes
private

Definition at line 92 of file HydroMechanicsProcess.h.

◆ _mesh_subset_matrix_nodes

template<int GlobalDim>
std::unique_ptr<MeshLib::MeshSubset const> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_mesh_subset_matrix_nodes
private

Definition at line 93 of file HydroMechanicsProcess.h.

◆ _mesh_subset_nodes_p

template<int GlobalDim>
std::unique_ptr<MeshLib::MeshSubset const> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_mesh_subset_nodes_p
private

Definition at line 96 of file HydroMechanicsProcess.h.

◆ _process_data

◆ _vec_fracture_elements

template<int GlobalDim>
std::vector<MeshLib::Element*> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_fracture_elements
private

◆ _vec_fracture_matrix_elements

template<int GlobalDim>
std::vector<MeshLib::Element*> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_fracture_matrix_elements
private

◆ _vec_fracture_nodes

template<int GlobalDim>
std::vector<MeshLib::Node*> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_fracture_nodes
private

◆ _vec_matrix_elements

template<int GlobalDim>
std::vector<MeshLib::Element*> ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::_vec_matrix_elements
private

The documentation for this class was generated from the following files: