OGS
ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim > Class Template Referencefinal

Detailed Description

template<int DisplacementDim>
class ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >

Linear kinematics poro-mechanical/biphasic (fluid-solid mixture) model.

The mixture momentum balance and the mixture mass balance are solved under fully saturated conditions.

Definition at line 26 of file RichardsMechanicsProcess.h.

#include <RichardsMechanicsProcess.h>

Inheritance diagram for ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >:
[legend]
Collaboration diagram for ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >:
[legend]

Public Member Functions

 RichardsMechanicsProcess (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, RichardsMechanicsProcessData< DisplacementDim > &&process_data, SecondaryVariableCollection &&secondary_variables, bool const use_monolithic_scheme)
 
MathLib::MatrixSpecifications getMatrixSpecifications (const int process_id) const 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
 
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 LocalAssemblerIF = LocalAssemblerInterface< DisplacementDim >
 

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 initializeBoundaryConditions () override
 
void setInitialConditionsConcreteProcess (std::vector< GlobalVector * > &x, double const t, int const process_id) override
 
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 postTimestepConcreteProcess (std::vector< GlobalVector * > const &x, double const t, double const dt, const int process_id) override
 
NumLib::LocalToGlobalIndexMap const & getDOFTable (const int process_id) const override
 
std::vector< NumLib::LocalToGlobalIndexMap const * > getDOFTables (const int number_of_processes) const
 
void computeSecondaryVariableConcrete (double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id) override
 
std::tuple< NumLib::LocalToGlobalIndexMap *, bool > getDOFTableForExtrapolatorData () const override
 
bool hasMechanicalProcess (int const process_id) const
 

Private Attributes

std::vector< MeshLib::Node * > _base_nodes
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_base_nodes
 
RichardsMechanicsProcessData< DisplacementDim > _process_data
 
std::vector< std::unique_ptr< LocalAssemblerIF > > _local_assemblers
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map_single_component
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map_with_base_nodes
 
GlobalSparsityPattern _sparsity_pattern_with_linear_element
 
MeshLib::PropertyVector< double > * _nodal_forces = nullptr
 
MeshLib::PropertyVector< double > * _hydraulic_flow = nullptr
 

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

◆ LocalAssemblerIF

template<int DisplacementDim>
using ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::LocalAssemblerIF = LocalAssemblerInterface<DisplacementDim>
private

Definition at line 65 of file RichardsMechanicsProcess.h.

Constructor & Destructor Documentation

◆ RichardsMechanicsProcess()

template<int DisplacementDim>
ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::RichardsMechanicsProcess ( 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,
RichardsMechanicsProcessData< DisplacementDim > &&  process_data,
SecondaryVariableCollection &&  secondary_variables,
bool const  use_monolithic_scheme 
)

Definition at line 27 of file RichardsMechanicsProcess.cpp.

38  : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
39  integration_order, std::move(process_variables),
40  std::move(secondary_variables), use_monolithic_scheme),
41  _process_data(std::move(process_data))
42 {
43  _nodal_forces = MeshLib::getOrCreateMeshProperty<double>(
44  mesh, "NodalForces", MeshLib::MeshItemType::Node, DisplacementDim);
45 
46  _hydraulic_flow = MeshLib::getOrCreateMeshProperty<double>(
47  mesh, "HydraulicFlow", MeshLib::MeshItemType::Node, 1);
48 
49  // TODO (naumov) remove ip suffix. Probably needs modification of the mesh
50  // properties, s.t. there is no "overlapping" with cell/point data.
51  // See getOrCreateMeshProperty.
52  _integration_point_writer.emplace_back(
53  std::make_unique<IntegrationPointWriter>(
54  "sigma_ip",
55  static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/,
56  integration_order, _local_assemblers, &LocalAssemblerIF::getSigma));
57 
58  _integration_point_writer.emplace_back(
59  std::make_unique<IntegrationPointWriter>(
60  "saturation_ip", 1 /*n components*/, integration_order,
62 
63  _integration_point_writer.emplace_back(
64  std::make_unique<IntegrationPointWriter>(
65  "porosity_ip", 1 /*n components*/, integration_order,
67 
68  _integration_point_writer.emplace_back(
69  std::make_unique<IntegrationPointWriter>(
70  "transport_porosity_ip", 1 /*n components*/, integration_order,
72 
73  _integration_point_writer.emplace_back(
74  std::make_unique<IntegrationPointWriter>(
75  "swelling_stress_ip",
76  static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/,
77  integration_order, _local_assemblers,
79 
80  _integration_point_writer.emplace_back(
81  std::make_unique<IntegrationPointWriter>(
82  "epsilon_ip",
83  static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/,
84  integration_order, _local_assemblers,
86 }
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:71
std::string const name
Definition: Process.h:323
std::vector< std::unique_ptr< IntegrationPointWriter > > _integration_point_writer
Definition: Process.h:350
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
std::vector< std::unique_ptr< LocalAssemblerIF > > _local_assemblers
RichardsMechanicsProcessData< DisplacementDim > _process_data
virtual std::vector< double > getSwellingStress() const =0
virtual std::vector< double > getSaturation() const =0
virtual std::vector< double > getSigma() const =0
virtual std::vector< double > getPorosity() const =0
virtual std::vector< double > getTransportPorosity() const =0
virtual std::vector< double > getEpsilon() const =0

References ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_hydraulic_flow, ProcessLib::Process::_integration_point_writer, ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_local_assemblers, ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_nodal_forces, MeshLib::Mesh::getDimension(), ProcessLib::RichardsMechanics::LocalAssemblerInterface< DisplacementDim >::getEpsilon(), ProcessLib::RichardsMechanics::LocalAssemblerInterface< DisplacementDim >::getPorosity(), ProcessLib::RichardsMechanics::LocalAssemblerInterface< DisplacementDim >::getSaturation(), ProcessLib::RichardsMechanics::LocalAssemblerInterface< DisplacementDim >::getSigma(), ProcessLib::RichardsMechanics::LocalAssemblerInterface< DisplacementDim >::getSwellingStress(), ProcessLib::RichardsMechanics::LocalAssemblerInterface< DisplacementDim >::getTransportPorosity(), and MeshLib::Node.

Member Function Documentation

◆ assembleConcreteProcess()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::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 392 of file RichardsMechanicsProcess.cpp.

396 {
397  DBUG("Assemble the equations for RichardsMechanics");
398 
399  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
400  dof_table = {std::ref(*_local_to_global_index_map)};
401  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
402 
403  // Call global assembler for each local assembly item.
406  pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K,
407  b);
408 }
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
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
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 executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)

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

◆ assembleWithJacobianConcreteProcess()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::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 411 of file RichardsMechanicsProcess.cpp.

417 {
418  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
419  dof_tables;
420  // For the monolithic scheme
422  {
423  DBUG(
424  "Assemble the Jacobian of RichardsMechanics for the monolithic"
425  " scheme.");
426  dof_tables.emplace_back(*_local_to_global_index_map);
427  }
428  else
429  {
430  // For the staggered scheme
431  if (process_id == 0)
432  {
433  DBUG(
434  "Assemble the Jacobian equations of liquid fluid process in "
435  "RichardsMechanics for the staggered scheme.");
436  }
437  else
438  {
439  DBUG(
440  "Assemble the Jacobian equations of mechanical process in "
441  "RichardsMechanics for the staggered scheme.");
442  }
443  dof_tables.emplace_back(*_local_to_global_index_map_with_base_nodes);
444  dof_tables.emplace_back(*_local_to_global_index_map);
445  }
446 
447  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
448 
451  _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot,
452  dxdot_dx, dx_dx, process_id, M, K, b, Jac);
453 
454  auto copyRhs = [&](int const variable_id, auto& output_vector)
455  {
457  {
458  transformVariableFromGlobalVector(b, variable_id, dof_tables[0],
459  output_vector,
460  std::negate<double>());
461  }
462  else
463  {
464  transformVariableFromGlobalVector(b, 0, dof_tables[process_id],
465  output_vector,
466  std::negate<double>());
467  }
468  };
469  if (_use_monolithic_scheme || process_id == 0)
470  {
471  copyRhs(0, *_hydraulic_flow);
472  }
473  if (_use_monolithic_scheme || process_id == 1)
474  {
475  copyRhs(1, *_nodal_forces);
476  }
477 }
const bool _use_monolithic_scheme
Definition: Process.h:335
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map_with_base_nodes
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

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

◆ computeSecondaryVariableConcrete()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::computeSecondaryVariableConcrete ( double const  t,
double const  dt,
std::vector< GlobalVector * > const &  x,
GlobalVector const &  x_dot,
int const  process_id 
)
overrideprivatevirtual

Reimplemented from ProcessLib::Process.

Definition at line 498 of file RichardsMechanicsProcess.cpp.

503 {
504  if (process_id != 0)
505  {
506  return;
507  }
508 
509  DBUG("Compute the secondary variables for RichardsMechanicsProcess.");
510  auto const dof_tables = getDOFTables(x.size());
511 
512  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
515  pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id);
516 }
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< NumLib::LocalToGlobalIndexMap const * > getDOFTables(const int number_of_processes) const
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)

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

◆ constructDofTable()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::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 115 of file RichardsMechanicsProcess.cpp.

116 {
117  // Create single component dof in every of the mesh's nodes.
119  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
120  // Create single component dof in the mesh's base nodes.
123  std::make_unique<MeshLib::MeshSubset>(_mesh, _base_nodes);
124 
125  // TODO move the two data members somewhere else.
126  // for extrapolation of secondary variables of stress or strain
127  std::vector<MeshLib::MeshSubset> all_mesh_subsets_single_component{
130  std::make_unique<NumLib::LocalToGlobalIndexMap>(
131  std::move(all_mesh_subsets_single_component),
132  // by location order is needed for output
134 
136  {
137  // For pressure, which is the first
138  std::vector<MeshLib::MeshSubset> all_mesh_subsets{
140 
141  // For displacement.
142  const int monolithic_process_id = 0;
143  std::generate_n(std::back_inserter(all_mesh_subsets),
144  getProcessVariables(monolithic_process_id)[1]
145  .get()
146  .getNumberOfGlobalComponents(),
147  [&]() { return *_mesh_subset_all_nodes; });
148 
149  std::vector<int> const vec_n_components{1, DisplacementDim};
151  std::make_unique<NumLib::LocalToGlobalIndexMap>(
152  std::move(all_mesh_subsets), vec_n_components,
155  }
156  else
157  {
158  // For displacement equation.
159  const int process_id = 1;
160  std::vector<MeshLib::MeshSubset> all_mesh_subsets;
161  std::generate_n(std::back_inserter(all_mesh_subsets),
162  getProcessVariables(process_id)[0]
163  .get()
164  .getNumberOfGlobalComponents(),
165  [&]() { return *_mesh_subset_all_nodes; });
166 
167  std::vector<int> const vec_n_components{DisplacementDim};
169  std::make_unique<NumLib::LocalToGlobalIndexMap>(
170  std::move(all_mesh_subsets), vec_n_components,
172 
173  // For pressure equation.
174  // Collect the mesh subsets with base nodes in a vector.
175  std::vector<MeshLib::MeshSubset> all_mesh_subsets_base_nodes{
178  std::make_unique<NumLib::LocalToGlobalIndexMap>(
179  std::move(all_mesh_subsets_base_nodes),
180  // by location order is needed for output
182 
185 
188  }
189 }
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_all_nodes
Definition: Process.h:327
MeshLib::Mesh & _mesh
Definition: Process.h:326
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_base_nodes
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map_single_component
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
Definition: Utils.h:26
@ BY_LOCATION
Ordering data by spatial location.
GlobalSparsityPattern computeSparsityPattern(LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
Computes a sparsity pattern for the given inputs.

References NumLib::BY_LOCATION, NumLib::computeSparsityPattern(), and MeshLib::getBaseNodes().

◆ getDOFTable()

template<int DisplacementDim>
NumLib::LocalToGlobalIndexMap const & ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::getDOFTable ( const int  process_id) const
overrideprivatevirtual

Reimplemented from ProcessLib::Process.

Definition at line 529 of file RichardsMechanicsProcess.cpp.

531 {
532  if (hasMechanicalProcess(process_id))
533  {
535  }
536 
537  // For the equation of pressure
539 }

◆ getDOFTableForExtrapolatorData()

template<int DisplacementDim>
std::tuple< NumLib::LocalToGlobalIndexMap *, bool > ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::getDOFTableForExtrapolatorData
overrideprivatevirtual

Get the address of a LocalToGlobalIndexMap, and the status of its memory. If the LocalToGlobalIndexMap is created as new in this function, the function also returns a true boolean value to let Extrapolator manage the memory by the address returned by this function.

Returns
Address of a LocalToGlobalIndexMap and its memory status.

Reimplemented from ProcessLib::Process.

Definition at line 520 of file RichardsMechanicsProcess.cpp.

521 {
522  const bool manage_storage = false;
523  return std::make_tuple(_local_to_global_index_map_single_component.get(),
524  manage_storage);
525 }

◆ getDOFTables()

template<int DisplacementDim>
std::vector< NumLib::LocalToGlobalIndexMap const * > ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::getDOFTables ( const int  number_of_processes) const
private

Definition at line 543 of file RichardsMechanicsProcess.cpp.

545 {
546  std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
547  dof_tables.reserve(number_of_processes);
548  std::generate_n(std::back_inserter(dof_tables), number_of_processes,
549  [&]() { return &getDOFTable(dof_tables.size()); });
550  return dof_tables;
551 }
NumLib::LocalToGlobalIndexMap const & getDOFTable(const int process_id) const override

◆ getMatrixSpecifications()

template<int DisplacementDim>
MathLib::MatrixSpecifications ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::getMatrixSpecifications ( const int  process_id) const
override

Get the size and the sparse pattern of the global matrix in order to create the global matrices and vectors for the system equations of this process.

Parameters
process_idProcess ID. If the monolithic scheme is applied, process_id = 0. For the staggered scheme, process_id = 0 represents the hydraulic (H) process, while process_id = 1 represents the mechanical (M) process.
Returns
Matrix specifications including size and sparse pattern.

Definition at line 96 of file RichardsMechanicsProcess.cpp.

98 {
99  // For the monolithic scheme or the M process (deformation) in the staggered
100  // scheme.
101  if (_use_monolithic_scheme || process_id == 1)
102  {
103  auto const& l = *_local_to_global_index_map;
104  return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
105  &l.getGhostIndices(), &this->_sparsity_pattern};
106  }
107 
108  // For staggered scheme and H process (pressure).
110  return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
111  &l.getGhostIndices(), &_sparsity_pattern_with_linear_element};
112 }
GlobalSparsityPattern _sparsity_pattern
Definition: Process.h:352

◆ hasMechanicalProcess()

template<int DisplacementDim>
bool ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::hasMechanicalProcess ( int const  process_id) const
inlineprivate

Check whether the process represented by process_id is/has mechanical process. In the present implementation, the mechanical process has process_id == 1 in the staggered scheme.

Definition at line 134 of file RichardsMechanicsProcess.h.

135  {
136  return _use_monolithic_scheme || process_id == 1;
137  }

References ProcessLib::Process::_use_monolithic_scheme.

◆ initializeBoundaryConditions()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeBoundaryConditions
overrideprivatevirtual

Member function to initialize the boundary conditions for all coupled processes. It is called by initialize().

Reimplemented from ProcessLib::Process.

Definition at line 348 of file RichardsMechanicsProcess.cpp.

349 {
351  {
352  const int monolithic_process_id = 0;
354  *_local_to_global_index_map, monolithic_process_id);
355  return;
356  }
357 
358  // Staggered scheme:
359  // for the equations of pressure
360  const int hydraulic_process_id = 0;
362  *_local_to_global_index_map_with_base_nodes, hydraulic_process_id);
363 
364  // for the equations of deformation.
365  const int mechanical_process_id = 1;
367  *_local_to_global_index_map, mechanical_process_id);
368 }
void initializeProcessBoundaryConditionsAndSourceTerms(const NumLib::LocalToGlobalIndexMap &dof_table, const int process_id)
Definition: Process.cpp:67

◆ initializeConcreteProcess()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::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 192 of file RichardsMechanicsProcess.cpp.

196 {
197  using nlohmann::json;
198 
199  const int mechanical_process_id = _use_monolithic_scheme ? 0 : 1;
200  const int deformation_variable_id = _use_monolithic_scheme ? 1 : 0;
202  DisplacementDim, RichardsMechanicsLocalAssembler>(
203  mesh.getDimension(), mesh.getElements(), dof_table,
204  // use displacement process variable to set shape function order
205  getProcessVariables(mechanical_process_id)[deformation_variable_id]
206  .get()
207  .getShapeFunctionOrder(),
208  _local_assemblers, mesh.isAxiallySymmetric(), integration_order,
209  _process_data);
210 
211  auto add_secondary_variable = [&](std::string const& name,
212  int const num_components,
213  auto get_ip_values_function)
214  {
216  name,
217  makeExtrapolator(num_components, getExtrapolator(),
219  std::move(get_ip_values_function)));
220  };
221 
222  add_secondary_variable("sigma",
224  DisplacementDim>::RowsAtCompileTime,
226 
227  add_secondary_variable("swelling_stress",
229  DisplacementDim>::RowsAtCompileTime,
231 
232  add_secondary_variable("epsilon",
234  DisplacementDim>::RowsAtCompileTime,
236 
237  add_secondary_variable("velocity", DisplacementDim,
239 
240  add_secondary_variable("saturation", 1,
242 
243  add_secondary_variable("micro_saturation", 1,
245 
246  add_secondary_variable("micro_pressure", 1,
248 
249  add_secondary_variable("porosity", 1, &LocalAssemblerIF::getIntPtPorosity);
250 
251  add_secondary_variable("transport_porosity", 1,
253 
254  add_secondary_variable("dry_density_solid", 1,
256 
257  //
258  // enable output of internal variables defined by material models
259  //
261  LocalAssemblerIF>(_process_data.solid_materials,
262  add_secondary_variable);
263 
264  // Assume all materials have same internal variables.
267  _process_data.solid_materials, _local_assemblers,
268  _integration_point_writer, integration_order);
269 
270  _process_data.element_saturation = MeshLib::getOrCreateMeshProperty<double>(
271  const_cast<MeshLib::Mesh&>(mesh), "saturation_avg",
273 
274  _process_data.element_porosity = MeshLib::getOrCreateMeshProperty<double>(
275  const_cast<MeshLib::Mesh&>(mesh), "porosity_avg",
277 
278  _process_data.element_stresses = MeshLib::getOrCreateMeshProperty<double>(
279  const_cast<MeshLib::Mesh&>(mesh), "stress_avg",
282  DisplacementDim>::RowsAtCompileTime);
283 
284  _process_data.pressure_interpolated =
285  MeshLib::getOrCreateMeshProperty<double>(
286  const_cast<MeshLib::Mesh&>(mesh), "pressure_interpolated",
288 
289  // Set initial conditions for integration point data.
290  for (auto const& ip_writer : _integration_point_writer)
291  {
292  // Find the mesh property with integration point writer's name.
293  auto const& name = ip_writer->name();
294  if (!mesh.getProperties().existsPropertyVector<double>(name))
295  {
296  continue;
297  }
298  auto const& mesh_property =
299  *mesh.getProperties().template getPropertyVector<double>(name);
300 
301  // The mesh property must be defined on integration points.
302  if (mesh_property.getMeshItemType() !=
304  {
305  continue;
306  }
307 
308  auto const ip_meta_data = getIntegrationPointMetaData(mesh, name);
309 
310  // Check the number of components.
311  if (ip_meta_data.n_components !=
312  mesh_property.getNumberOfGlobalComponents())
313  {
314  OGS_FATAL(
315  "Different number of components in meta data ({:d}) than in "
316  "the integration point field data for '{:s}': {:d}.",
317  ip_meta_data.n_components, name,
318  mesh_property.getNumberOfGlobalComponents());
319  }
320 
321  // Now we have a properly named vtk's field data array and the
322  // corresponding meta data.
323  std::size_t position = 0;
324  for (auto& local_asm : _local_assemblers)
325  {
326  std::size_t const integration_points_read =
327  local_asm->setIPDataInitialConditions(
328  name, &mesh_property[position],
329  ip_meta_data.integration_order);
330  if (integration_points_read == 0)
331  {
332  OGS_FATAL(
333  "No integration points read in the integration point "
334  "initial conditions set function for {:s} variable.",
335  name);
336  }
337  position += integration_points_read * ip_meta_data.n_components;
338  }
339  }
340 
341  // Initialize local assemblers after all variables have been set.
345 }
#define OGS_FATAL(...)
Definition: Error.h:26
virtual void initialize(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
NumLib::Extrapolator & getExtrapolator() const
Definition: Process.h:185
SecondaryVariableCollection _secondary_variables
Definition: Process.h:331
LocalAssemblerInterface< DisplacementDim > LocalAssemblerIF
void addSecondaryVariable(std::string const &internal_name, SecondaryVariableFunctions &&fcts)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
Definition: KelvinVector.h:48
void solidMaterialInternalToSecondaryVariables(std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim >>> const &solid_materials, AddSecondaryVariableCallback const &add_secondary_variable)
void solidMaterialInternalVariablesToIntegrationPointWriter(std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim >>> const &solid_materials, std::vector< std::unique_ptr< LocalAssemblerInterface >> const &local_assemblers, std::vector< std::unique_ptr< IntegrationPointWriter >> &integration_point_writer, int const integration_order)
void createLocalAssemblers(const unsigned, 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)
IntegrationPointMetaData getIntegrationPointMetaData(MeshLib::Mesh const &mesh, std::string const &name)
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)
virtual std::vector< double > const & getIntPtMicroPressure(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtMicroSaturation(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtPorosity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtDarcyVelocity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSwellingStress(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtDryDensitySolid(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtTransportPorosity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSaturation(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtEpsilon(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSigma(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0

References MeshLib::Cell, ProcessLib::RichardsMechanics::createLocalAssemblers(), NumLib::SerialExecutor::executeMemberOnDereferenced(), MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getElements(), ProcessLib::getIntegrationPointMetaData(), MeshLib::Mesh::getProperties(), MeshLib::IntegrationPoint, MeshLib::Mesh::isAxiallySymmetric(), ProcessLib::makeExtrapolator(), MaterialPropertyLib::name, MeshLib::Node, OGS_FATAL, ProcessLib::Deformation::solidMaterialInternalToSecondaryVariables(), and ProcessLib::Deformation::solidMaterialInternalVariablesToIntegrationPointWriter().

◆ isLinear()

template<int DisplacementDim>
bool ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::isLinear
override

Definition at line 89 of file RichardsMechanicsProcess.cpp.

90 {
91  return false;
92 }

◆ postTimestepConcreteProcess()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::postTimestepConcreteProcess ( std::vector< GlobalVector * > const &  x,
double const  t,
double const  dt,
const int  process_id 
)
overrideprivatevirtual

Reimplemented from ProcessLib::Process.

Definition at line 480 of file RichardsMechanicsProcess.cpp.

483 {
484  if (hasMechanicalProcess(process_id))
485  {
486  DBUG("PostTimestep RichardsMechanicsProcess.");
487  auto const dof_tables = getDOFTables(x.size());
488 
489  ProcessLib::ProcessVariable const& pv =
490  getProcessVariables(process_id)[0];
493  pv.getActiveElementIDs(), dof_tables, x, t, dt);
494  }
495 }
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)

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

◆ setInitialConditionsConcreteProcess()

template<int DisplacementDim>
void ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::setInitialConditionsConcreteProcess ( std::vector< GlobalVector * > &  x,
double const  t,
int const  process_id 
)
overrideprivatevirtual

Reimplemented from ProcessLib::Process.

Definition at line 371 of file RichardsMechanicsProcess.cpp.

375 {
376  if (process_id != 0)
377  {
378  return;
379  }
380 
381  DBUG("SetInitialConditions RichardsMechanicsProcess.");
382 
383  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
384 
387  pv.getActiveElementIDs(), getDOFTable(process_id), *x[process_id], t,
388  _use_monolithic_scheme, process_id);
389 }
void setInitialConditions(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, bool const use_monolithic_scheme, int const process_id)

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

Member Data Documentation

◆ _base_nodes

template<int DisplacementDim>
std::vector<MeshLib::Node*> ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_base_nodes
private

Definition at line 103 of file RichardsMechanicsProcess.h.

◆ _hydraulic_flow

template<int DisplacementDim>
MeshLib::PropertyVector<double>* ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_hydraulic_flow = nullptr
private

◆ _local_assemblers

template<int DisplacementDim>
std::vector<std::unique_ptr<LocalAssemblerIF> > ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_local_assemblers
private

◆ _local_to_global_index_map_single_component

template<int DisplacementDim>
std::unique_ptr<NumLib::LocalToGlobalIndexMap> ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_local_to_global_index_map_single_component
private

Definition at line 110 of file RichardsMechanicsProcess.h.

◆ _local_to_global_index_map_with_base_nodes

template<int DisplacementDim>
std::unique_ptr<NumLib::LocalToGlobalIndexMap> ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_local_to_global_index_map_with_base_nodes
private

Local to global index mapping for base nodes, which is used for linear interpolation for pressure in the staggered scheme.

Definition at line 115 of file RichardsMechanicsProcess.h.

◆ _mesh_subset_base_nodes

template<int DisplacementDim>
std::unique_ptr<MeshLib::MeshSubset const> ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_mesh_subset_base_nodes
private

Definition at line 104 of file RichardsMechanicsProcess.h.

◆ _nodal_forces

template<int DisplacementDim>
MeshLib::PropertyVector<double>* ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_nodal_forces = nullptr
private

◆ _process_data

template<int DisplacementDim>
RichardsMechanicsProcessData<DisplacementDim> ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_process_data
private

Definition at line 105 of file RichardsMechanicsProcess.h.

◆ _sparsity_pattern_with_linear_element

template<int DisplacementDim>
GlobalSparsityPattern ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::_sparsity_pattern_with_linear_element
private

Sparsity pattern for the flow equation, and it is initialized only if the staggered scheme is used.

Definition at line 119 of file RichardsMechanicsProcess.h.


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