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 eventCounter,
70  real64 const eventProgress,
71  DomainPartition & domain ) override;
72 
73  virtual real64 solverStep( real64 const & time_n,
74  real64 const & dt,
75  integer const cycleNumber,
76  DomainPartition & domain ) override;
77 
80  inline string const getFractureRegionName() const { return m_fractureRegionName; }
81 
82  void postInputInitialization() override final;
83 
84 protected:
85 
86  virtual void initializePostInitialConditionsPreSubGroups() override final;
87  virtual void postRestartInitialization() override final;
88 
89 private:
90 
91  int separationDriver( DomainPartition & domain,
92  MeshLevel & mesh,
93  stdVector< NeighborCommunicator > & neighbors,
94  int const tileColor,
95  int const numTileColors,
96  const bool prefrac,
97  const real64 time_np1 );
98 
104  void assignNewGlobalIndicesSerial( ObjectManagerBase & object,
105  std::set< localIndex > const & indexList );
106 
107 
113  void
114  assignNewGlobalIndicesSerial( ElementRegionManager & elementManager,
115  map< std::pair< localIndex, localIndex >, std::set< localIndex > > const & indexList );
116 
126  void identifyRupturedFaces( DomainPartition const & domain,
127  NodeManager & nodeManager,
128  EdgeManager & edgeManager,
129  FaceManager & faceManager,
130  ElementRegionManager const & elementManager,
131  bool const prefrac );
132 
145  real64 calculateEdgeSif( DomainPartition const & domain,
146  localIndex const edgeID,
147  localIndex & trailFaceID,
148  NodeManager const & nodeManager,
149  EdgeManager & edgeManager,
150  FaceManager const & faceManager,
151  ElementRegionManager const & elementManager,
152  real64 ( &vecTipNorm )[3],
153  real64 ( &vecTip )[3] );
154 
163  void calculateNodeAndFaceSif( DomainPartition const & domain,
164  NodeManager & nodeManager,
165  EdgeManager const & edgeManager,
166  FaceManager & faceManager,
167  ElementRegionManager const & elementManager );
168 
183  int calculateElementForcesOnEdge( DomainPartition const & domain,
184  localIndex const edgeID,
185  real64 edgeLength,
186  localIndex_array & nodeIndices,
187  NodeManager const & nodeManager,
188  EdgeManager const & edgeManager,
189  ElementRegionManager const & elementManager,
190  real64 ( &vecTipNorm )[3],
191  real64 ( &fNode )[3],
192  real64 & GdivBeta,
193  bool threeNodesPinched,
194  bool calculatef_u );
195 
209  void markRuptureFaceFromEdge( localIndex const edgeID,
210  localIndex const & trailFaceID,
211  NodeManager const & nodeManager,
212  EdgeManager const & edgeManager,
213  FaceManager & faceManager,
214  ElementRegionManager const & elementManager,
215  real64 ( &vecTipNorm )[3],
216  real64 ( &vecTip )[3],
217  ModifiedObjectLists & modifiedObjects,
218  int const edgeMode );
219 
229  void markRuptureFaceFromNode( localIndex const nodeIndex,
230  NodeManager const & nodeManager,
231  EdgeManager const & edgeManager,
232  FaceManager & faceManager,
233  ElementRegionManager const & elementManager,
234  ModifiedObjectLists & modifiedObjects );
235 
245  void postUpdateRuptureStates( NodeManager const & nodeManager,
246  EdgeManager const & edgeManager,
247  FaceManager const & faceManager,
248  ElementRegionManager const & elementManager,
249  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
250  stdVector< std::set< localIndex > > & edgesToRupturedFaces );
251 
267  stdVector< std::set< localIndex > > groupRupturedFacesIntoSets(
268  stdVector< std::set< localIndex > > const & nodesToRupturedFaces,
269  NodeManager const & nodeManager,
270  FaceManager const & faceManager ) const;
271 
283  void buildFilteredRuptureMaps(
284  std::set< localIndex > const & fractureSetFaces,
285  NodeManager const & nodeManager,
286  EdgeManager const & edgeManager,
287  FaceManager const & faceManager,
288  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
289  stdVector< std::set< localIndex > > & edgesToRupturedFaces ) const;
290 
297  int checkOrphanElement( ElementRegionManager const & elementManager,
298  FaceManager const & faceManager,
299  localIndex iFace );
300 
310  int checkEdgeSplitability( localIndex const edgeID,
311  NodeManager const & nodeManager,
312  FaceManager const & faceManager,
313  EdgeManager const & edgeManager,
314  const bool prefrac );
315 
316 
317 // void UpdatePathCheckingArrays();
318 
333  bool processNode( const localIndex nodeID,
334  real64 const time,
335  NodeManager & nodeManager,
336  EdgeManager & edgeManager,
337  FaceManager & faceManager,
338  ElementRegionManager & elemManager,
339  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
340  stdVector< std::set< localIndex > > & edgesToRupturedFaces,
341  ElementRegionManager & elementManager,
342  ModifiedObjectLists & modifiedObjects,
343  const bool prefrac );
344 
360  bool findFracturePlanes( localIndex const nodeID,
361  NodeManager const & nodeManager,
362  EdgeManager const & edgeManager,
363  FaceManager const & faceManager,
364  ElementRegionManager const & elemManager,
365  stdVector< std::set< localIndex > > const & nodesToRupturedFaces,
366  stdVector< std::set< localIndex > > const & edgesToRupturedFaces,
367  std::set< localIndex > & separationPathFaces,
368  map< localIndex, int > & edgeLocations,
369  map< localIndex, int > & faceLocations,
370  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
371 
372 
388  void performFracture( localIndex const nodeID,
389  real64 const time_np1,
390  NodeManager & nodeManager,
391  EdgeManager & edgeManager,
392  FaceManager & faceManager,
393  ElementRegionManager & elementManager,
394  ModifiedObjectLists & modifiedObjects,
395  stdVector< std::set< localIndex > > & nodesToRupturedFaces,
396  stdVector< std::set< localIndex > > & edgesToRupturedFaces,
397  std::set< localIndex > const & separationPathFaces,
398  map< localIndex, int > const & edgeLocations,
399  map< localIndex, int > const & faceLocations,
400  map< std::pair< CellElementSubRegion const *, localIndex >, int > const & elemLocations );
401 
402  void mapConsistencyCheck( localIndex const nodeID,
403  NodeManager const & nodeManager,
404  EdgeManager const & edgeManager,
405  FaceManager const & faceManager,
406  ElementRegionManager const & elementManager,
407  map< std::pair< CellElementSubRegion const *, localIndex >, int > const & elemLocations );
408 
440  bool assignLocationsBFS( std::set< localIndex > const & separationPathFaces,
441  ElementRegionManager const & elemManager,
442  FaceManager const & faceManager,
443  stdVector< std::pair< CellElementSubRegion const *, localIndex > > const & nodeToElementMaps,
444  map< localIndex, std::pair< localIndex, localIndex > > const & localFacesToEdges,
445  map< localIndex, int > & edgeLocations,
446  map< localIndex, int > & faceLocations,
447  map< std::pair< CellElementSubRegion const *, localIndex >, int > & elemLocations );
448 
457  real64 calculateKinkAngle( localIndex const nodeID,
458  NodeManager const & nodeManager,
459  EdgeManager const & edgeManager,
460  FaceManager const & faceManager );
461 
470  void calculateKinkAngles( FaceManager const & faceManager,
471  EdgeManager & edgeManager,
472  NodeManager const & nodeManager,
473  ModifiedObjectLists const & modifiedObjects,
474  bool const prefrac );
475 
480  void synchronizeTipSets( FaceManager & faceManager,
481  EdgeManager & edgeManager,
482  NodeManager & nodeManager,
483  ModifiedObjectLists & receivedObjects );
484 
485 
486 // void setDegreeFromCrackTip( NodeManager & nodeManager,
487 // FaceManager & faceManager );
488 
497  real64 minimumToughnessOnEdge( localIndex const edgeID,
498  NodeManager const & nodeManager,
499  EdgeManager const & edgeManager,
500  FaceManager const & faceManager );
501 
510  real64 minimumToughnessOnNode( localIndex const nodeID,
511  NodeManager const & nodeManager,
512  EdgeManager const & edgeManager,
513  FaceManager const & faceManager );
514 
515 
516  real64 calculateRuptureRate( SurfaceElementRegion & faceElementRegion );
517 
532  bool isGhostBoundaryFace( localIndex const faceIndex ) const
533  {
534  return m_originalFacesToElemIndex( faceIndex, 1 ) == -1;
535  }
536 
537  real64 scalingToughness( R1Tensor const fractureOrigin,
538  real64 const (&faceCenter)[3],
539  real64 const initialRockToughness,
540  real64 const toughnessScalingFactor );
541 
545  struct viewKeyStruct : PhysicsSolverBase::viewKeyStruct
546  {
547  constexpr static char const * failCriterionString() { return "failCriterion"; }
548  constexpr static char const * solidMaterialNameString() { return "solidMaterialNames"; }
549  constexpr static char const * fExternalString() { return "fExternal"; }
550  constexpr static char const * tipNodesString() { return "tipNodes"; }
551  constexpr static char const * tipEdgesString() { return "tipEdges"; }
552  constexpr static char const * tipFacesString() { return "tipFaces"; }
553  constexpr static char const * trailingFacesString() { return "trailingFaces"; }
554  constexpr static char const * fractureRegionNameString() { return "fractureRegion"; }
555  constexpr static char const * mpiCommOrderString() { return "mpiCommOrder"; }
556  constexpr static char const * isPoroelasticString() {return "isPoroelastic";}
557 
558  //TODO: rock toughness should be a material parameter, and we need to make rock toughness to KIC a constitutive
559  // relation.
560  constexpr static char const * initialRockToughnessString() { return "initialRockToughness"; }
561  constexpr static char const * toughnessScalingFactorString() { return "toughnessScalingFactor"; }
562  //TODO: fracture origin can be obtained from the initial fracture geometry
563  constexpr static char const * fractureOriginString() { return "fractureOrigin"; }
564 
565 // //TODO: Once the node-based SIF criterion becomes mature and robust, remove the edge-based criterion.
566  constexpr static char const * nodeBasedSIFString() { return "nodeBasedSIF"; }
567  };
568 
569 
570 private:
571 
572  constexpr static real64 m_nonRuptureTime = 1e9;
573 
575  integer m_failCriterion=1;
576 
577  array1d< localIndex > m_solidMaterialFullIndex;
578 
579  int m_nodeBasedSIF;
580 
581  int m_isPoroelastic;
582 
583  real64 m_initialRockToughness;
584 
585  real64 m_toughnessScalingFactor;
586 
587  R1Tensor m_fractureOrigin;
588 
589  // Flag for consistent communication ordering
590  int m_mpiCommOrder;
591 
593  SortedArray< localIndex > m_separableFaceSet;
594 
596  ArrayOfSets< localIndex > m_originalNodetoFaces;
597 
599  ArrayOfSets< localIndex > m_originalNodetoEdges;
600 
602  ArrayOfArrays< localIndex > m_originalFaceToEdges;
603 
605  array1d< SortedArray< localIndex > > m_usedFacesForNode;
606 
608  array2d< localIndex > m_originalFacesToElemRegion;
609 
611  array2d< localIndex > m_originalFacesToElemSubRegion;
612 
614  array2d< localIndex > m_originalFacesToElemIndex;
615 
617  string m_fractureRegionName;
618 
619  SortedArray< localIndex > m_tipNodes;
620 
621  SortedArray< localIndex > m_tipEdges;
622 
623  SortedArray< localIndex > m_tipFaces;
624 
625  SortedArray< localIndex > m_trailingFaces;
626 
627  SortedArray< localIndex > m_faceElemsRupturedThisSolve;
628 
631  localIndex m_numFractureElementsBefore = 0;
632 
633 };
634 
635 } /* namespace geos */
636 
637 #endif /* GEOS_PHYSICSSOLVERS_SURFACEGENERATION_SURFACEGENERATOR_HPP_ */
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.
virtual real64 solverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain) override
entry function to perform a solver step
virtual bool execute(real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Main extension point of executable targets.
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:367
std::set< T > set
A set of local indices.
Definition: DataTypes.hpp:262
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
Tensor< real64, 3 > R1Tensor
Alias for a local (stack-based) rank-1 tensor type.
Definition: DataTypes.hpp:165
int integer
Signed integer type.
Definition: DataTypes.hpp:81
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector
Structure to hold scoped key names.