GEOS
FaceElementSubRegion.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 
20 #ifndef GEOS_MESH_FACEELEMENTSUBREGION_HPP_
21 #define GEOS_MESH_FACEELEMENTSUBREGION_HPP_
22 
24 #include "mesh/generators/FaceBlockABC.hpp"
25 
26 namespace geos
27 {
28 
38 {
39 public:
40 
43 
48 
53  static string catalogName()
54  { return "FaceElementSubRegion"; }
55 
60  virtual string getCatalogName() const override
61  {
62  return catalogName();
63  }
64 
66 
71 
77  FaceElementSubRegion( string const & name,
78  dataRepository::Group * const parent );
79 
81 
86  void copyFromCellBlock( FaceBlockABC const & faceBlock );
87 
92 
93  virtual void calculateElementGeometricQuantities( NodeManager const & nodeManager,
94  FaceManager const & faceManager ) override;
101  arrayView1d< real64 const > const & faceArea );
102 
107  void calculateElementCentersOnly( NodeManager const & nodeManager );
108 
109  virtual localIndex packUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
110 
112  arrayView1d< localIndex const > const & packList ) const override;
113 
114  virtual localIndex unpackUpDownMaps( buffer_unit_type const * & buffer,
115  array1d< localIndex > & packList,
116  bool const overwriteUpMaps,
117  bool const overwriteDownMaps ) override;
118 
119 
126 
134  arrayView1d< localIndex const > const & packList ) const;
135 
145  array1d< localIndex > & packList,
146  bool const overwriteUpMaps,
147  bool const overwriteDownMaps );
148 
149 
150 
151  virtual void fixUpDownMaps( bool const clearIfUnmapped ) override;
152 
160  void fixSecondaryMappings( NodeManager const & nodeManager,
161  EdgeManager const & edgeManager,
162  FaceManager const & faceManager,
163  ElementRegionManager const & elemManager );
164 
166 
172  void inheritGhostRankFromParentFace( FaceManager const & faceManager,
173  std::set< localIndex > const & indices );
174 
186  ElementRegionManager const & elemManager );
187 
196  void flipFaceMap( FaceManager & faceManager,
197  ElementRegionManager const & elemManager );
198 
209  NodeManager const & nodeManager );
210 
216  {
218  static constexpr char const * dNdXString() { return "dNdX"; }
220  static constexpr char const * detJString() { return "detJ"; }
222  static constexpr char const * edgesToFractureConnectorsEdgesString() { return "edgesToFractureConnectors"; }
224  static constexpr char const * fractureConnectorEdgesToEdgesString() { return "fractureConnectorsToEdges"; }
226  static constexpr char const * fractureConnectorsEdgesToFaceElementsIndexString() { return "fractureConnectorsToElementIndex"; }
228  static constexpr char const * elem2dToCollocatedNodesBucketsString() { return "elem2dToCollocatedNodesBuckets"; }
229 
230 #if GEOS_USE_SEPARATION_COEFFICIENT
232  constexpr static char const * separationCoeffString() { return "separationCoeff"; }
234  constexpr static char const * dSeparationCoeffdAperString() { return "dSeparationCoeffdAper"; }
235 #endif
236  };
237 
238  virtual void setupRelatedObjectsInRelations( MeshLevel const & mesh ) override;
239 
240 
246 
251  FaceMapType const & faceList() const
252  {
253  return m_toFacesRelation;
254  }
255 
260  {
261  return m_toFacesRelation;
262  }
264 
265 
271 
276  //virtual localIndex numNodesPerElement( localIndex const k ) const override { return m_toNodesRelation[k].size(); }
277 
278 #ifdef GEOS_USE_SEPARATION_COEFFICIENT
283  arrayView1d< real64 > getSeparationCoefficient() { return m_separationCoefficient; }
287  arrayView1d< real64 const > getSeparationCoefficient() const { return m_separationCoefficient; }
288 #endif
289 
291 
294 
297 
300 
303 
306 
309 
312 
317  std::set< std::set< globalIndex > > getCollocatedNodes() const;
318 
323  { return m_dNdX; }
324 
329  { return m_dNdX.toViewConst(); }
330 
335  { return m_detJ; }
336 
341  { return m_detJ; }
342 
344 
352 
360  {
361  return m_2dElemToCollocatedNodesBuckets.toViewConst();
362  }
363 
369  {
370  return m_2dElemToElems;
371  }
372 
377  {
378  return m_2dElemToElems;
379  }
380 
381 private:
382 
390  template< bool DO_PACKING >
391  localIndex packUpDownMapsImpl( buffer_unit_type * & buffer,
392  arrayView1d< localIndex const > const & packList ) const;
393 
394 
395  template< bool DO_PACKING >
396  localIndex packToFaceRelationImpl( buffer_unit_type * & buffer,
397  arrayView1d< localIndex const > const & packList ) const;
398 
400  array4d< real64 > m_dNdX;
401 
403  array2d< real64 > m_detJ;
404 
406  FaceMapType m_toFacesRelation;
407 
412  ArrayOfArrays< array1d< globalIndex > > m_2dElemToCollocatedNodesBuckets;
413 
415  FixedToManyElementRelation m_2dElemToElems;
416 
417 #ifdef GEOS_USE_SEPARATION_COEFFICIENT
419  array1d< real64 > m_separationCoefficient;
420 #endif
421 
422 };
423 
424 } /* namespace geos */
425 
426 #endif /* GEOS_MESH_FACEELEMENTSUBREGION_HPP_ */
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...
ElementType getElementType() const
Get the type of element in this subregion.
Block of 2d elements (geometrical surfaces in 3d).
void inheritGhostRankFromParentFace(FaceManager const &faceManager, std::set< localIndex > const &indices)
Function to set the ghostRank for a list of FaceElements and set them to the value of their bounding ...
FixedToManyElementRelation & getToCellRelation()
Get the surface element to cells map.
ArrayOfArraysView< array1d< globalIndex > const > get2dElemToCollocatedNodesBuckets() const
Returns the 2d element to node to collocated nodes bucket mapping.
virtual string getCatalogName() const override
Get catalog name.
virtual void setupRelatedObjectsInRelations(MeshLevel const &mesh) override
Link the connectivity maps of the subregion to the managers storing the mesh information.
arrayView2d< real64 const > detJ() const
FaceMapType & faceList()
Get the face element to faces map.
FaceMapType const & faceList() const
Get the face element to faces map.
FixedOneToManyRelation FaceMapType
Face element to faces map type.
SortedArray< localIndex > m_recalculateConnectionsFor2dFaces
map from the edges to the fracture connectors index (edges that are fracture connectors)
void orderKf1NodesConsistentlyWithKf0(FaceManager &faceManager, NodeManager const &nodeManager)
Reorder the node list of the second face (kf1) of each fracture element so that its nodes are paired ...
FixedToManyElementRelation const & getToCellRelation() const
Get the surface element to cells map.
virtual localIndex packUpDownMapsSize(arrayView1d< localIndex const > const &packList) const override
Computes the pack size of the specific elements in the @ packList.
void calculateSingleElementGeometricQuantities(localIndex const k, arrayView1d< real64 const > const &faceArea)
Function to compute the geometric quantities of a specific face element.
virtual localIndex unpackUpDownMaps(buffer_unit_type const *&buffer, array1d< localIndex > &packList, bool const overwriteUpMaps, bool const overwriteDownMaps) override
Unpacks the specific elements in the @ packList.
ElementType getElementType(localIndex ei) const
Returns the type of element ei.
map< localIndex, array1d< globalIndex > > m_unmappedGlobalIndicesInToEdges
Get the number of nodes per face element.
void calculateElementCentersOnly(NodeManager const &nodeManager)
Computes centroids for all face elements from node positions.
void fixNeighboringFacesNormals(FaceManager &faceManager, ElementRegionManager const &elemManager)
Function to flip the face normals of faces adjacent to the faceElements if they are not pointing in t...
localIndex packToFaceRelation(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Pack the FaceElement to face relation.
arrayView4d< real64 const > dNdX() const
map< localIndex, array1d< globalIndex > > m_unmappedGlobalIndicesInToFaces
Unmapped face elements to faces map.
static string catalogName()
Get catalog name.
FaceElementSubRegion(string const &name, dataRepository::Group *const parent)
Constructor.
void fixSecondaryMappings(NodeManager const &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, ElementRegionManager const &elemManager)
Fixes the mappings between the FaceElementSubRegion and regions next to it (e.g., matrix regions).
void copyFromCellBlock(FaceBlockABC const &faceBlock)
Fill the FaceElementSubRegion by copying those of the source face block.
SortedArray< localIndex > m_newFaceElements
List of the new face elements that have been generated.
void flipFaceMap(FaceManager &faceManager, ElementRegionManager const &elemManager)
Function to flip the face map based on the gloal index of the nighboring elements.
ArrayOfArrays< localIndex > m_2dFaceTo2dElems
A map of fracture connector local indices face element local indices.
virtual localIndex packUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const override
Packs the specific elements in the @ packList.
localIndex unpackToFaceRelation(buffer_unit_type const *&buffer, array1d< localIndex > &packList, bool const overwriteUpMaps, bool const overwriteDownMaps)
Unpack the FaceElement to face relation.
virtual void fixUpDownMaps(bool const clearIfUnmapped) override
Call ObjectManagerBase::fixUpDownMaps for the connectivity maps needed by the derived class (i....
std::set< std::set< globalIndex > > getCollocatedNodes() const
Computes and returns all the buckets of collocated nodes.
map< localIndex, localIndex > m_edgesTo2dFaces
A map of edge local indices to the fracture connector local indices.
virtual void calculateElementGeometricQuantities(NodeManager const &nodeManager, FaceManager const &faceManager) override
Calculate the geometric quantities for each element in the subregion.
localIndex packToFaceRelationSize(arrayView1d< localIndex const > const &packList) const
Size of packing of the FaceElement to face relation.
array1d< localIndex > m_2dFaceToEdge
A map of fracture connector local indices to edge local indices.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:44
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
Base template for ordered and unordered maps.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:191
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
Definition: DataTypes.hpp:285
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
InterObjectRelation< array2d< localIndex > > FixedOneToManyRelation
A relationship from single objects to many other objects, where each object is related to the same nu...
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
Definition: DataTypes.hpp:266
Array< T, 4, PERMUTATION > array4d
Alias for 4D array.
Definition: DataTypes.hpp:223
ElementType
Denotes type of cell/element shape.
Definition: ElementType.hpp:32
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
Definition: DataTypes.hpp:227
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:108
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:281
Struct containing the keys to all face element views.
static constexpr char const * dNdXString()
static constexpr char const * detJString()
static constexpr char const * elem2dToCollocatedNodesBucketsString()
static constexpr char const * fractureConnectorsEdgesToFaceElementsIndexString()
static constexpr char const * fractureConnectorEdgesToEdgesString()
static constexpr char const * edgesToFractureConnectorsEdgesString()
Struct containing the keys to all surface element views.