GEOS
MultiphasePoromechanics.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICS_HPP_
21 #define GEOS_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICS_HPP_
22 
26 
27 namespace geos
28 {
29 
30 template< typename FLOW_SOLVER = CompositionalMultiphaseBase, typename MECHANICS_SOLVER = SolidMechanicsLagrangianFEM >
31 class MultiphasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHANICS_SOLVER >
32 {
33 public:
34 
36  using Base::m_solvers;
37  using Base::m_dofManager;
38  using Base::m_localMatrix;
39  using Base::m_rhs;
40  using Base::m_solution;
44  using Base::getLogLevel;
45 
51  MultiphasePoromechanics( const string & name,
52  dataRepository::Group * const parent );
53 
55  ~MultiphasePoromechanics() override {};
56 
61  static string catalogName()
62  {
63  if constexpr ( std::is_same_v< FLOW_SOLVER, CompositionalMultiphaseBase > ) // special case
64  {
65  return "MultiphasePoromechanics";
66  }
67  else // default
68  {
69  return FLOW_SOLVER::catalogName() + "Poromechanics";
70  }
71  }
72 
76  string getCatalogName() const override { return catalogName(); }
77 
85  virtual void postInputInitialization() override;
86 
87  virtual void setupCoupling( DomainPartition const & domain,
88  DofManager & dofManager ) const override;
89 
90  virtual void assembleSystem( real64 const time,
91  real64 const dt,
92  DomainPartition & domain,
93  DofManager const & dofManager,
95  arrayView1d< real64 > const & localRhs ) override;
96 
97  void assembleElementBasedTerms( real64 const time,
98  real64 const dt,
99  DomainPartition & domain,
100  DofManager const & dofManager,
101  CRSMatrixView< real64, globalIndex const > const & localMatrix,
102  arrayView1d< real64 > const & localRhs );
103 
106 protected:
107 
109 
110 
111 
112 private:
113 
118  virtual void updateBulkDensity( ElementSubRegionBase & subRegion ) override;
119 
120  template< typename CONSTITUTIVE_BASE,
121  typename KERNEL_WRAPPER,
122  typename ... PARAMS >
123  real64 assemblyLaunch( MeshLevel & mesh,
124  DofManager const & dofManager,
125  arrayView1d< string const > const & regionNames,
126  string const & materialNamesString,
127  CRSMatrixView< real64, globalIndex const > const & localMatrix,
128  arrayView1d< real64 > const & localRhs,
129  real64 const dt,
130  PARAMS && ... params );
131 
132 
133 };
134 
135 template< typename FLOW_SOLVER, typename MECHANICS_SOLVER >
136 template< typename CONSTITUTIVE_BASE,
137  typename KERNEL_WRAPPER,
138  typename ... PARAMS >
140  DofManager const & dofManager,
141  arrayView1d< string const > const & regionNames,
142  string const & materialNamesString,
143  CRSMatrixView< real64, globalIndex const > const & localMatrix,
144  arrayView1d< real64 > const & localRhs,
145  real64 const dt,
146  PARAMS && ... params )
147 {
149 
150  NodeManager const & nodeManager = mesh.getNodeManager();
151 
152  string const dofKey = dofManager.getKey( fields::solidMechanics::totalDisplacement::key() );
153  arrayView1d< globalIndex const > const & dofNumber = nodeManager.getReference< globalIndex_array >( dofKey );
154 
155  real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( PhysicsSolverBase::gravityVector() );
156 
157  KERNEL_WRAPPER kernelWrapper( dofNumber,
158  dofManager.rankOffset(),
159  localMatrix,
160  localRhs,
161  dt,
162  gravityVectorData,
163  std::forward< PARAMS >( params )... );
164 
165  return finiteElement::
166  regionBasedKernelApplication< parallelDevicePolicy< >,
167  CONSTITUTIVE_BASE,
168  CellElementSubRegion >( mesh,
169  regionNames,
170  this->solidMechanicsSolver()->getDiscretizationName(),
171  materialNamesString,
172  kernelWrapper );
173 }
174 
175 
176 } /* namespace geos */
177 
178 #endif /* GEOS_PHYSICSSOLVERS_MULTIPHYSICS_MULTIPHASEPOROMECHANICS_HPP_ */
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:44
globalIndex rankOffset(string const &fieldName) const
string const & getKey(string const &fieldName) const
Return the key used to record the field in the DofManager.
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
NodeManager const & getNodeManager() const
Get the node manager.
Definition: MeshLevel.hpp:155
string getCatalogName() const override
~MultiphasePoromechanics() override
Destructor for the class.
static string catalogName()
name of the node manager in the object catalog
virtual void initializePostInitialConditionsPreSubGroups() override
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
MultiphasePoromechanics(const string &name, dataRepository::Group *const parent)
main constructor for MultiphasePoromechanics Objects
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:46
CRSMatrix< real64, globalIndex > m_localMatrix
Local system matrix and rhs.
DofManager m_dofManager
Data structure to handle degrees of freedom.
R1Tensor const gravityVector() const
return the value of the gravity vector specified in PhysicsSolverManager
ParallelVector m_solution
System solution vector.
ParallelVector m_rhs
System right-hand side vector.
array1d< string > m_stabilizationRegionNames
Names of regions where stabilization applied.
real64 m_stabilizationMultiplier
Stabilization Multiplier.
stabilization::StabilizationType m_stabilizationType
Type of stabilization used.
std::tuple< SOLVERS *... > m_solvers
Pointers of the single-physics solvers.
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1273
integer getLogLevel() const
Definition: Group.hpp:1505
virtual void postInputInitialization() override
virtual void setupCoupling(DomainPartition const &domain, DofManager &dofManager) const override
Utility function to set the coupling between degrees of freedom.
virtual void assembleSystem(real64 const time, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
function to assemble the linear system matrix and rhs
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:310
array1d< globalIndex > globalIndex_array
A 1-dimensional array of geos::globalIndex types.
Definition: DataTypes.hpp:401
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99