GEOS
SurfaceGenerator.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 TotalEnergies
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 
19 #ifndef GEOS_PHYSICSSOLVERS_SURFACEGENERATION_SURFACEGENERATOR_HPP_
20 #define GEOS_PHYSICSSOLVERS_SURFACEGENERATION_SURFACEGENERATOR_HPP_
21 
22 #include "mesh/mpiCommunications/NeighborCommunicator.hpp"
24 #include "mesh/DomainPartition.hpp"
26 
27 namespace geos
28 {
29 
30 class SpatialPartition;
31 class NodeManager;
32 class EdgeManager;
33 class FaceManager;
34 class ElementRegionManager;
35 class ElementRegionBase;
36 
44 {
45 public:
46  SurfaceGenerator( const string & name,
47  Group * const parent );
48  ~SurfaceGenerator() override;
49 
50 
51  static string catalogName() { return "SurfaceGenerator"; }
55  string getCatalogName() const override { return catalogName(); }
56 
57  virtual void registerDataOnMesh( Group & MeshBody ) override final;
58 
66  virtual bool execute( real64 const time_n,
67  real64 const dt,
68  integer const cycleNumber,
69  integer const GEOS_UNUSED_PARAM( eventCounter ),
70  real64 const GEOS_UNUSED_PARAM( eventProgress ),
71  DomainPartition & domain ) override
72  {
73  solverStep( time_n, dt, cycleNumber, domain );
74  return false;
75  }
76 
77  virtual real64 solverStep( real64 const & time_n,
78  real64 const & dt,
79  integer const cycleNumber,
80  DomainPartition & domain ) override;
81 
84  inline string const getFractureRegionName() const { return m_fractureRegionName; }
85 
86  void postInputInitialization() override final;
87 
88 protected:
89 
90  virtual void initializePostInitialConditionsPreSubGroups() override final;
91  virtual void postRestartInitialization() override final;
92 
93 private:
94 
95  int separationDriver( DomainPartition & domain,
96  MeshLevel & mesh,
97  stdVector< NeighborCommunicator > & neighbors,
98  int const tileColor,
99  int const numTileColors,
100  const bool prefrac,
101  const real64 time_np1 );
102 
108  void assignNewGlobalIndicesSerial( ObjectManagerBase & object,
109  std::set< localIndex > const & indexList );
110 
111 
117  void
118  assignNewGlobalIndicesSerial( ElementRegionManager & elementManager,
119  map< std::pair< localIndex, localIndex >, std::set< localIndex > > const & indexList );
120 
130  void identifyRupturedFaces( DomainPartition const & domain,
131  NodeManager & nodeManager,
132  EdgeManager & edgeManager,
133  FaceManager & faceManager,
134  ElementRegionManager const & elementManager,
135  bool const prefrac );
136 
149  real64 calculateEdgeSif( DomainPartition const & domain,
150  localIndex const edgeID,
151  localIndex & trailFaceID,
152  NodeManager const & nodeManager,
153  EdgeManager & edgeManager,
154  FaceManager const & faceManager,
155  ElementRegionManager const & elementManager,
156  real64 ( &vecTipNorm )[3],
157  real64 ( &vecTip )[3] );
158 
167  void calculateNodeAndFaceSif( DomainPartition const & domain,
168  NodeManager & nodeManager,
169  EdgeManager const & edgeManager,
170  FaceManager & faceManager,
171  ElementRegionManager const & elementManager );
172 
187  int calculateElementForcesOnEdge( DomainPartition const & domain,
188  localIndex const edgeID,
189  real64 edgeLength,
190  localIndex_array & nodeIndices,
191  NodeManager const & nodeManager,
192  EdgeManager const & edgeManager,
193  ElementRegionManager const & elementManager,
194  real64 ( &vecTipNorm )[3],
195  real64 ( &fNode )[3],
196  real64 & GdivBeta,
197  bool threeNodesPinched,
198  bool calculatef_u );
199 
213  void markRuptureFaceFromEdge( localIndex const edgeID,
214  localIndex const & trailFaceID,
215  NodeManager const & nodeManager,
216  EdgeManager const & edgeManager,
217  FaceManager & faceManager,
218  ElementRegionManager const & elementManager,
219  real64 ( &vecTipNorm )[3],
220  real64 ( &vecTip )[3],
221  ModifiedObjectLists & modifiedObjects,
222  int const edgeMode );
223 
233  void markRuptureFaceFromNode( localIndex const nodeIndex,
234  NodeManager const & nodeManager,
235  EdgeManager const & edgeManager,
236  FaceManager & faceManager,
237  ElementRegionManager const & elementManager,
238  ModifiedObjectLists & modifiedObjects );
239 
249  void postUpdateRuptureStates( NodeManager const & nodeManager,
250  EdgeManager const & edgeManager,
251  FaceManager const & faceManager,
252  ElementRegionManager const & elementManager,
253  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
254  stdVector< std::set< localIndex > > & edgesToRupturedFaces );
255 
262  int checkOrphanElement( ElementRegionManager const & elementManager,
263  FaceManager const & faceManager,
264  localIndex iFace );
265 
275  int checkEdgeSplitability( localIndex const edgeID,
276  NodeManager const & nodeManager,
277  FaceManager const & faceManager,
278  EdgeManager const & edgeManager,
279  const bool prefrac );
280 
281 
282 // void UpdatePathCheckingArrays();
283 
298  bool processNode( const localIndex nodeID,
299  real64 const time,
300  NodeManager & nodeManager,
301  EdgeManager & edgeManager,
302  FaceManager & faceManager,
303  ElementRegionManager & elemManager,
304  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
305  stdVector< std::set< localIndex > > & edgesToRupturedFaces,
306  ElementRegionManager & elementManager,
307  ModifiedObjectLists & modifiedObjects,
308  const bool prefrac );
309 
325  bool findFracturePlanes( localIndex const nodeID,
326  NodeManager const & nodeManager,
327  EdgeManager const & edgeManager,
328  FaceManager const & faceManager,
329  ElementRegionManager const & elemManager,
330  stdVector< std::set< localIndex > > const & nodesToRupturedFaces,
331  stdVector< std::set< localIndex > > const & edgesToRupturedFaces,
332  std::set< localIndex > & separationPathFaces,
333  map< localIndex, int > & edgeLocations,
334  map< localIndex, int > & faceLocations,
335  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
336 
337 
353  void performFracture( localIndex const nodeID,
354  real64 const time_np1,
355  NodeManager & nodeManager,
356  EdgeManager & edgeManager,
357  FaceManager & faceManager,
358  ElementRegionManager & elementManager,
359  ModifiedObjectLists & modifiedObjects,
360  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
361  stdVector< std::set< localIndex > > & edgesToRupturedFaces,
362  std::set< localIndex > const & separationPathFaces,
363  map< localIndex, int > const & edgeLocations,
364  map< localIndex, int > const & faceLocations,
365  map< std::pair< CellElementSubRegion const *, localIndex >, int > const & elemLocations );
366 
367  void mapConsistencyCheck( localIndex const nodeID,
368  NodeManager const & nodeManager,
369  EdgeManager const & edgeManager,
370  FaceManager const & faceManager,
371  ElementRegionManager const & elementManager,
372  map< std::pair< CellElementSubRegion const *, localIndex >, int > const & elemLocations );
373 
386  bool setLocations( std::set< localIndex > const & separationPathFaces,
387  ElementRegionManager const & elemManager,
388  FaceManager const & faceManager,
389  stdVector< std::pair< CellElementSubRegion const *, localIndex > > const & nodeToElementMaps,
390  map< localIndex, std::pair< localIndex, localIndex > > const & localFacesToEdges,
391  map< localIndex, int > & edgeLocations,
392  map< localIndex, int > & faceLocations,
393  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
394 
409  bool setElemLocations( int const location,
410  std::pair< CellElementSubRegion const *, localIndex > const & elem,
411  std::set< localIndex > const & separationPathFaces,
412  ElementRegionManager const & elemManager,
413  FaceManager const & faceManager,
414  stdVector< std::pair< CellElementSubRegion const *, localIndex > > const & nodesToElements,
415  map< localIndex, std::pair< localIndex, localIndex > > const & localFacesToEdges,
416  map< localIndex, int > & edgeLocations,
417  map< localIndex, int > & faceLocations,
418  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
419 
428  real64 calculateKinkAngle( localIndex const nodeID,
429  NodeManager const & nodeManager,
430  EdgeManager const & edgeManager,
431  FaceManager const & faceManager );
432 
441  void calculateKinkAngles( FaceManager const & faceManager,
442  EdgeManager & edgeManager,
443  NodeManager const & nodeManager,
444  ModifiedObjectLists const & modifiedObjects,
445  bool const prefrac );
446 
451  void synchronizeTipSets( FaceManager & faceManager,
452  EdgeManager & edgeManager,
453  NodeManager & nodeManager,
454  ModifiedObjectLists & receivedObjects );
455 
456 
457 // void setDegreeFromCrackTip( NodeManager & nodeManager,
458 // FaceManager & faceManager );
459 
468  real64 minimumToughnessOnEdge( localIndex const edgeID,
469  NodeManager const & nodeManager,
470  EdgeManager const & edgeManager,
471  FaceManager const & faceManager );
472 
481  real64 minimumToughnessOnNode( localIndex const nodeID,
482  NodeManager const & nodeManager,
483  EdgeManager const & edgeManager,
484  FaceManager const & faceManager );
485 
486 
487  real64 calculateRuptureRate( SurfaceElementRegion & faceElementRegion );
488 
489  real64 scalingToughness( R1Tensor const fractureOrigin,
490  real64 const (&faceCenter)[3],
491  real64 const initialRockToughness,
492  real64 const toughnessScalingFactor );
493 
497  struct viewKeyStruct : PhysicsSolverBase::viewKeyStruct
498  {
499  constexpr static char const * failCriterionString() { return "failCriterion"; }
500  constexpr static char const * solidMaterialNameString() { return "solidMaterialNames"; }
501  constexpr static char const * fExternalString() { return "fExternal"; }
502  constexpr static char const * tipNodesString() { return "tipNodes"; }
503  constexpr static char const * tipEdgesString() { return "tipEdges"; }
504  constexpr static char const * tipFacesString() { return "tipFaces"; }
505  constexpr static char const * trailingFacesString() { return "trailingFaces"; }
506  constexpr static char const * fractureRegionNameString() { return "fractureRegion"; }
507  constexpr static char const * mpiCommOrderString() { return "mpiCommOrder"; }
508  constexpr static char const * isPoroelasticString() {return "isPoroelastic";}
509 
510  //TODO: rock toughness should be a material parameter, and we need to make rock toughness to KIC a constitutive
511  // relation.
512  constexpr static char const * initialRockToughnessString() { return "initialRockToughness"; }
513  constexpr static char const * toughnessScalingFactorString() { return "toughnessScalingFactor"; }
514  //TODO: fracture origin can be obtained from the initial fracture geometry
515  constexpr static char const * fractureOriginString() { return "fractureOrigin"; }
516 
517 // //TODO: Once the node-based SIF criterion becomes mature and robust, remove the edge-based criterion.
518  constexpr static char const * nodeBasedSIFString() { return "nodeBasedSIF"; }
519  };
520 
521 
522 private:
523 
524  constexpr static real64 m_nonRuptureTime = 1e9;
525 
527  integer m_failCriterion=1;
528 
529  array1d< localIndex > m_solidMaterialFullIndex;
530 
531  int m_nodeBasedSIF;
532 
533  int m_isPoroelastic;
534 
535  real64 m_initialRockToughness;
536 
537  real64 m_toughnessScalingFactor;
538 
539  R1Tensor m_fractureOrigin;
540 
541  // Flag for consistent communication ordering
542  int m_mpiCommOrder;
543 
545  SortedArray< localIndex > m_separableFaceSet;
546 
548  ArrayOfSets< localIndex > m_originalNodetoFaces;
549 
551  ArrayOfSets< localIndex > m_originalNodetoEdges;
552 
554  ArrayOfArrays< localIndex > m_originalFaceToEdges;
555 
557  array1d< SortedArray< localIndex > > m_usedFacesForNode;
558 
560  array2d< localIndex > m_originalFacesToElemRegion;
561 
563  array2d< localIndex > m_originalFacesToElemSubRegion;
564 
566  array2d< localIndex > m_originalFacesToElemIndex;
567 
569  string m_fractureRegionName;
570 
571  SortedArray< localIndex > m_tipNodes;
572 
573  SortedArray< localIndex > m_tipEdges;
574 
575  SortedArray< localIndex > m_tipFaces;
576 
577  SortedArray< localIndex > m_trailingFaces;
578 
579  SortedArray< localIndex > m_faceElemsRupturedThisSolve;
580 
581 };
582 
583 } /* namespace geos */
584 
585 #endif /* GEOS_PHYSICSSOLVERS_SURFACEGENERATION_SURFACEGENERATOR_HPP_ */
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
Definition: GeosxMacros.hpp:72
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
This class provides an interface to ObjectManagerBase in order to manage edge data.
Definition: EdgeManager.hpp:43
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:44
The class is used to manage mesh body.
Definition: MeshBody.hpp:36
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:46
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
Base class for all physics solvers.
void postInputInitialization() override final
virtual void initializePostInitialConditionsPreSubGroups() override final
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
virtual void postRestartInitialization() override final
Performs initialization required after reading from a restart file.
string getCatalogName() const override
virtual void registerDataOnMesh(Group &MeshBody) override final
Register wrappers that contain data on the mesh objects.
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:337
virtual real64 solverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain) override
entry function to perform a solver step
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:407
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:200
std::set< T > set
A set of local indices.
Definition: DataTypes.hpp:271
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:81
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
Definition: DataTypes.hpp:275
LvArray::ArrayOfSets< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfSets
Array of variable-sized sets. See LvArray::ArrayOfSets for details.
Definition: DataTypes.hpp:298
std::vector< T, Allocator > stdVector
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:184
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:290