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"
25 
26 namespace geos
27 {
28 
30 {
31  std::set< localIndex > newNodes;
32  std::set< localIndex > newEdges;
33  std::set< localIndex > newFaces;
34  std::set< localIndex > modifiedNodes;
35  std::set< localIndex > modifiedEdges;
36  std::set< localIndex > modifiedFaces;
37  map< std::pair< localIndex, localIndex >, std::set< localIndex > > newElements;
38  map< std::pair< localIndex, localIndex >, std::set< localIndex > > modifiedElements;
39 
40  void clearNewFromModified();
41 
42  void insert( ModifiedObjectLists const & lists );
43 };
44 
45 
46 class SpatialPartition;
47 
48 class NodeManager;
49 class EdgeManager;
50 class FaceManager;
52 class ElementRegionBase;
53 
61 {
62 public:
63  SurfaceGenerator( const string & name,
64  Group * const parent );
65  ~SurfaceGenerator() override;
66 
67 
68  static string catalogName() { return "SurfaceGenerator"; }
72  string getCatalogName() const override { return catalogName(); }
73 
74  virtual void registerDataOnMesh( Group & MeshBody ) override final;
75 
83  virtual bool execute( real64 const time_n,
84  real64 const dt,
85  integer const cycleNumber,
86  integer const GEOS_UNUSED_PARAM( eventCounter ),
87  real64 const GEOS_UNUSED_PARAM( eventProgress ),
88  DomainPartition & domain ) override
89  {
90  solverStep( time_n, dt, cycleNumber, domain );
91  return false;
92  }
93 
94  virtual real64 solverStep( real64 const & time_n,
95  real64 const & dt,
96  integer const cycleNumber,
97  DomainPartition & domain ) override;
98 
101  inline string const getFractureRegionName() const { return m_fractureRegionName; }
102 
103  void postInputInitialization() override final;
104 
105 protected:
106 
107  virtual void initializePostInitialConditionsPreSubGroups() override final;
108  virtual void postRestartInitialization() override final;
109 
110 private:
111 
112  int separationDriver( DomainPartition & domain,
113  MeshLevel & mesh,
114  std::vector< NeighborCommunicator > & neighbors,
115  int const tileColor,
116  int const numTileColors,
117  const bool prefrac,
118  const real64 time_np1 );
119 
125  void assignNewGlobalIndicesSerial( ObjectManagerBase & object,
126  std::set< localIndex > const & indexList );
127 
128 
134  void
135  assignNewGlobalIndicesSerial( ElementRegionManager & elementManager,
136  map< std::pair< localIndex, localIndex >, std::set< localIndex > > const & indexList );
137 
147  void identifyRupturedFaces( DomainPartition const & domain,
148  NodeManager & nodeManager,
149  EdgeManager & edgeManager,
150  FaceManager & faceManager,
151  ElementRegionManager const & elementManager,
152  bool const prefrac );
153 
166  real64 calculateEdgeSif( DomainPartition const & domain,
167  localIndex const edgeID,
168  localIndex & trailFaceID,
169  NodeManager const & nodeManager,
170  EdgeManager & edgeManager,
171  FaceManager const & faceManager,
172  ElementRegionManager const & elementManager,
173  real64 ( &vecTipNorm )[3],
174  real64 ( &vecTip )[3] );
175 
184  void calculateNodeAndFaceSif( DomainPartition const & domain,
185  NodeManager & nodeManager,
186  EdgeManager const & edgeManager,
187  FaceManager & faceManager,
188  ElementRegionManager const & elementManager );
189 
204  int calculateElementForcesOnEdge( DomainPartition const & domain,
205  localIndex const edgeID,
206  real64 edgeLength,
207  localIndex_array & nodeIndices,
208  NodeManager const & nodeManager,
209  EdgeManager const & edgeManager,
210  ElementRegionManager const & elementManager,
211  real64 ( &vecTipNorm )[3],
212  real64 ( &fNode )[3],
213  real64 & GdivBeta,
214  bool threeNodesPinched,
215  bool calculatef_u );
216 
230  void markRuptureFaceFromEdge( localIndex const edgeID,
231  localIndex const & trailFaceID,
232  NodeManager const & nodeManager,
233  EdgeManager const & edgeManager,
234  FaceManager & faceManager,
235  ElementRegionManager const & elementManager,
236  real64 ( &vecTipNorm )[3],
237  real64 ( &vecTip )[3],
238  ModifiedObjectLists & modifiedObjects,
239  int const edgeMode );
240 
250  void markRuptureFaceFromNode( localIndex const nodeIndex,
251  NodeManager const & nodeManager,
252  EdgeManager const & edgeManager,
253  FaceManager & faceManager,
254  ElementRegionManager const & elementManager,
255  ModifiedObjectLists & modifiedObjects );
256 
266  void postUpdateRuptureStates( NodeManager const & nodeManager,
267  EdgeManager const & edgeManager,
268  FaceManager const & faceManager,
269  ElementRegionManager const & elementManager,
270  std::vector< std::set< localIndex > > & nodesToRupturedFaces,
271  std::vector< std::set< localIndex > > & edgesToRupturedFaces );
272 
279  int checkOrphanElement( ElementRegionManager const & elementManager,
280  FaceManager const & faceManager,
281  localIndex iFace );
282 
292  int checkEdgeSplitability( localIndex const edgeID,
293  NodeManager const & nodeManager,
294  FaceManager const & faceManager,
295  EdgeManager const & edgeManager,
296  const bool prefrac );
297 
298 
299 // void UpdatePathCheckingArrays();
300 
315  bool processNode( const localIndex nodeID,
316  real64 const time,
317  NodeManager & nodeManager,
318  EdgeManager & edgeManager,
319  FaceManager & faceManager,
320  ElementRegionManager & elemManager,
321  std::vector< std::set< localIndex > > & nodesToRupturedFaces,
322  std::vector< std::set< localIndex > > & edgesToRupturedFaces,
323  ElementRegionManager & elementManager,
324  ModifiedObjectLists & modifiedObjects,
325  const bool prefrac );
326 
342  bool findFracturePlanes( localIndex const nodeID,
343  NodeManager const & nodeManager,
344  EdgeManager const & edgeManager,
345  FaceManager const & faceManager,
346  ElementRegionManager const & elemManager,
347  std::vector< std::set< localIndex > > const & nodesToRupturedFaces,
348  std::vector< std::set< localIndex > > const & edgesToRupturedFaces,
349  std::set< localIndex > & separationPathFaces,
350  map< localIndex, int > & edgeLocations,
351  map< localIndex, int > & faceLocations,
352  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
353 
354 
370  void performFracture( localIndex const nodeID,
371  real64 const time_np1,
372  NodeManager & nodeManager,
373  EdgeManager & edgeManager,
374  FaceManager & faceManager,
375  ElementRegionManager & elementManager,
376  ModifiedObjectLists & modifiedObjects,
377  std::vector< std::set< localIndex > > & nodesToRupturedFaces,
378  std::vector< std::set< localIndex > > & edgesToRupturedFaces,
379  std::set< localIndex > const & separationPathFaces,
380  map< localIndex, int > const & edgeLocations,
381  map< localIndex, int > const & faceLocations,
382  map< std::pair< CellElementSubRegion const *, localIndex >, int > const & elemLocations );
383 
384  void mapConsistencyCheck( localIndex const nodeID,
385  NodeManager const & nodeManager,
386  EdgeManager const & edgeManager,
387  FaceManager const & faceManager,
388  ElementRegionManager const & elementManager,
389  map< std::pair< CellElementSubRegion const *, localIndex >, int > const & elemLocations );
390 
403  bool setLocations( std::set< localIndex > const & separationPathFaces,
404  ElementRegionManager const & elemManager,
405  FaceManager const & faceManager,
406  std::vector< std::pair< CellElementSubRegion const *, localIndex > > const & nodeToElementMaps,
407  map< localIndex, std::pair< localIndex, localIndex > > const & localFacesToEdges,
408  map< localIndex, int > & edgeLocations,
409  map< localIndex, int > & faceLocations,
410  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
411 
426  bool setElemLocations( int const location,
427  std::pair< CellElementSubRegion const *, localIndex > const & elem,
428  std::set< localIndex > const & separationPathFaces,
429  ElementRegionManager const & elemManager,
430  FaceManager const & faceManager,
431  std::vector< std::pair< CellElementSubRegion const *, localIndex > > const & nodesToElements,
432  map< localIndex, std::pair< localIndex, localIndex > > const & localFacesToEdges,
433  map< localIndex, int > & edgeLocations,
434  map< localIndex, int > & faceLocations,
435  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
436 
445  real64 calculateKinkAngle( localIndex const nodeID,
446  NodeManager const & nodeManager,
447  EdgeManager const & edgeManager,
448  FaceManager const & faceManager );
449 
458  void calculateKinkAngles( FaceManager const & faceManager,
459  EdgeManager & edgeManager,
460  NodeManager const & nodeManager,
461  ModifiedObjectLists const & modifiedObjects,
462  bool const prefrac );
463 
468  void synchronizeTipSets( FaceManager & faceManager,
469  EdgeManager & edgeManager,
470  NodeManager & nodeManager,
471  ModifiedObjectLists & receivedObjects );
472 
473 
474 // void setDegreeFromCrackTip( NodeManager & nodeManager,
475 // FaceManager & faceManager );
476 
485  real64 minimumToughnessOnEdge( localIndex const edgeID,
486  NodeManager const & nodeManager,
487  EdgeManager const & edgeManager,
488  FaceManager const & faceManager );
489 
498  real64 minimumToughnessOnNode( localIndex const nodeID,
499  NodeManager const & nodeManager,
500  EdgeManager const & edgeManager,
501  FaceManager const & faceManager );
502 
503 
504  real64 calculateRuptureRate( SurfaceElementRegion & faceElementRegion );
505 
509  struct viewKeyStruct : PhysicsSolverBase::viewKeyStruct
510  {
511  constexpr static char const * failCriterionString() { return "failCriterion"; }
512  constexpr static char const * solidMaterialNameString() { return "solidMaterialNames"; }
513  constexpr static char const * fExternalString() { return "fExternal"; }
514  constexpr static char const * tipNodesString() { return "tipNodes"; }
515  constexpr static char const * tipEdgesString() { return "tipEdges"; }
516  constexpr static char const * tipFacesString() { return "tipFaces"; }
517  constexpr static char const * trailingFacesString() { return "trailingFaces"; }
518  constexpr static char const * fractureRegionNameString() { return "fractureRegion"; }
519  constexpr static char const * mpiCommOrderString() { return "mpiCommOrder"; }
520  constexpr static char const * isPoroelasticString() {return "isPoroelastic";}
521 
522  //TODO: rock toughness should be a material parameter, and we need to make rock toughness to KIC a constitutive
523  // relation.
524  constexpr static char const * rockToughnessString() { return "rockToughness"; }
525 
526 // //TODO: Once the node-based SIF criterion becomes mature and robust, remove the edge-based criterion.
527  constexpr static char const * nodeBasedSIFString() { return "nodeBasedSIF"; }
528  };
529 
530 
531 private:
532 
533  constexpr static real64 m_nonRuptureTime = 1e9;
534 
536  integer m_failCriterion=1;
537 
538  array1d< localIndex > m_solidMaterialFullIndex;
539 
540  int m_nodeBasedSIF;
541 
542  int m_isPoroelastic;
543 
544  real64 m_rockToughness;
545 
546  // Flag for consistent communication ordering
547  int m_mpiCommOrder;
548 
550  SortedArray< localIndex > m_separableFaceSet;
551 
553  ArrayOfSets< localIndex > m_originalNodetoFaces;
554 
556  ArrayOfSets< localIndex > m_originalNodetoEdges;
557 
559  ArrayOfArrays< localIndex > m_originalFaceToEdges;
560 
562  array1d< SortedArray< localIndex > > m_usedFacesForNode;
563 
565  array2d< localIndex > m_originalFacesToElemRegion;
566 
568  array2d< localIndex > m_originalFacesToElemSubRegion;
569 
571  array2d< localIndex > m_originalFacesToElemIndex;
572 
574  string m_fractureRegionName;
575 
576  SortedArray< localIndex > m_tipNodes;
577 
578  SortedArray< localIndex > m_tipEdges;
579 
580  SortedArray< localIndex > m_tipFaces;
581 
582  SortedArray< localIndex > m_trailingFaces;
583 
584  SortedArray< localIndex > m_faceElemsRupturedThisSolve;
585 
586 };
587 
588 } /* namespace geos */
589 
590 #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 ElementRegionBase is the base class to manage the data stored at the element level.
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:329
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:398
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
std::set< T > set
A set of local indices.
Definition: DataTypes.hpp:263
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
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
Definition: DataTypes.hpp:267
LvArray::ArrayOfSets< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfSets
Array of variable-sized sets. See LvArray::ArrayOfSets for details.
Definition: DataTypes.hpp:290
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:282