GEOS
PhaseFieldFractureSolver.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 
21 #ifndef GEOS_PHYSICSSOLVERS_MULTIPHYSICS_PHASEFIELDFRACTURESOLVER_HPP_
22 #define GEOS_PHYSICSSOLVERS_MULTIPHYSICS_PHASEFIELDFRACTURESOLVER_HPP_
23 
27 
28 namespace geos
29 {
30 
31 class PhaseFieldFractureSolver : public CoupledSolver< SolidMechanicsLagrangianFEM, PhaseFieldDamageFEM >
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;
41 
42  PhaseFieldFractureSolver( const string & name,
43  Group * const parent );
44 
45  ~PhaseFieldFractureSolver() override;
46 
51  static string catalogName()
52  {
53  return "PhaseFieldFracture";
54  }
58  string getCatalogName() const override { return catalogName(); }
59 
61  static string coupledSolverAttributePrefix() { return "PhaseFieldFracture"; }
62 
63  enum class SolverType : integer
64  {
65  SolidMechanics = 0,
66  Damage = 1
67  };
68 
69  virtual void postInputInitialization() override final;
70 
76  {
77  return std::get< toUnderlying( SolverType::SolidMechanics ) >( m_solvers );
78  }
79 
85  {
86  return std::get< toUnderlying( SolverType::Damage ) >( m_solvers );
87  }
88 
89  virtual void mapSolutionBetweenSolvers( DomainPartition & Domain, integer const idx ) override final;
90 
91 protected:
92 
93  virtual void initializePostInitialConditionsPreSubGroups() override final {}
94 
95 };
96 
97 
98 template< typename FE_TYPE >
100 {
101  DamageInterpolationKernel( CellElementSubRegion const & subRegion ):
102  m_numElems( subRegion.size() )
103  {}
104 
105  void interpolateDamage( arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemToNodes,
106  arrayView1d< real64 const > const nodalDamage,
107  arrayView2d< real64 > damageFieldOnMaterial )
108  {
109  forAll< parallelDevicePolicy<> >( m_numElems, [=] GEOS_HOST_DEVICE ( localIndex const k )
110  {
111  constexpr localIndex numNodesPerElement = FE_TYPE::numNodes;
112  constexpr localIndex n_q_points = FE_TYPE::numQuadraturePoints;
113 
114  for( localIndex q = 0; q < n_q_points; ++q )
115  {
116  real64 N[ numNodesPerElement ];
117  FE_TYPE::calcN( q, N );
118 
119  damageFieldOnMaterial( k, q ) = 0;
120  for( localIndex a = 0; a < numNodesPerElement; ++a )
121  {
122  damageFieldOnMaterial( k, q ) += N[a] * nodalDamage[elemToNodes( k, a )];
123  //solution is probably not going to work because the solution of the coupled solver
124  //has both damage and displacements. Using the damageResult field from the Damage solver
125  //is probably better
126  }
127  }
128 
129  } );
130  }
131 
132  localIndex m_numElems;
133 };
134 
135 } /* namespace geos */
136 
137 #endif /* GEOS_PHYSICSSOLVERS_MULTIPHYSICS_PHASEFIELDFRACTURESOLVER_HPP_ */
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
std::tuple< SOLVERS *... > m_solvers
Pointers of the single-physics solvers.
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
SolidMechanicsLagrangianFEM * solidMechanicsSolver() const
accessor for the pointer to the solid mechanics solver
static string coupledSolverAttributePrefix()
String used to form the solverName used to register solvers in CoupledSolver.
virtual void postInputInitialization() override final
PhaseFieldDamageFEM * damageSolver() const
accessor for the pointer to the flow solver
virtual void initializePostInitialConditionsPreSubGroups() override final
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
virtual void mapSolutionBetweenSolvers(DomainPartition &Domain, integer const idx) override final
Maps the solution obtained from one solver to the fields used by the other solver(s)
static string catalogName()
name of the node manager in the object catalog
CRSMatrix< real64, globalIndex > m_localMatrix
Local system matrix and rhs.
DofManager m_dofManager
Data structure to handle degrees of freedom.
ParallelVector m_solution
System solution vector.
ParallelVector m_rhs
System right-hand side vector.
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1315
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196