GEOS
ProjectionEDFMHelper.hpp
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 
16 #ifndef GEOS_FINITEVOLUME_PROJECTIONEDFMHELPER_HPP_
17 #define GEOS_FINITEVOLUME_PROJECTIONEDFMHELPER_HPP_
18 
19 #include "common/DataTypes.hpp"
21 
22 namespace geos
23 {
24 
25 class MeshLevel;
26 class CellElementStencilTPFA;
27 class EmbeddedSurfaceToCellStencil;
28 
34 {
41 
49  : region( r ), subRegion( sr ), index( i )
50  {}
51 
57  bool operator==( CellDescriptor const & other ) const
58  {
59  return( region==other.region && subRegion==other.subRegion && index==other.index );
60  }
61 };
62 
68 {
69 public:
70 
79  CellElementStencilTPFA & stencil,
80  EmbeddedSurfaceToCellStencil & edfmStencil,
81  string const & embeddedSurfaceRegionName );
82 
88 
89 private:
90 
99  std::vector< localIndex > selectFaces( FixedOneToManyRelation const & subRegionFaces,
100  CellDescriptor const & hostCellID,
101  localIndex const fracElement,
102  EmbeddedSurfaceSubRegion const & fractureSubRegion ) const;
103 
111  bool intersection( real64 const ( &fracCenter )[3],
112  arraySlice1d< real64 const > const & fracNormal,
113  localIndex const edgeIdx ) const;
114 
120  bool isBoundaryFace( localIndex const faceIdx ) const;
121 
130  bool onLargerSide( localIndex const faceIdx,
131  real64 const signedDistanceCellCenterToFrac,
132  real64 const ( &fracCenter )[3],
133  arraySlice1d< real64 const > const & fracNormal ) const;
134 
135  /*
136  * @brief compute the signed distance between the fracture and as cell center
137  * @param[in] hostCellID id of the host cell
138  * @param[in] fracNormal the normal vector of the fracture element
139  * @param[in] fracCenter the coordinates of the center of the fracture cell
140  * @param[out] cellCenterToFracCenter distance vector between the cell and the fracture.
141  * return The signed distance between the fracture and the cell (based on the frac normal direction)
142  */
143  real64 getSignedDistanceCellCenterToFracPlane( CellDescriptor const & hostCellID,
144  arraySlice1d< real64 const > const & fracNormal,
145  real64 const (&fracCenter)[3],
146  real64 ( &cellCenterToFracCenter )[3] ) const;
147 
148  /*
149  * @brief returns true if the signed distance from the neighbor center to the frac is of the same sign as signedDistanceCellCenterToFrac
150  *(computed in the host cell)
151  * @@param[in] faceIdx the face index
152  * @param[in] signedDistanceCellCenterToFrac signed distance between the fracture and the cell (based on the frac normal direction)
153  * @param[in] hostCellID id of the host cell (region, subregion and element index)
154  * @param[in] fractureSubRegion the embeddedSurfaceSubRegion
155  * return whether the neighboring cell has the fracture on the same side of the face or not.
156  */
157  bool neighborOnSameSide( localIndex const faceIdx,
158  real64 const signedDistanceCellCenterToFrac,
159  CellDescriptor const & hostCellID,
160  EmbeddedSurfaceSubRegion const & fractureSubRegion ) const;
161 
168  CellDescriptor otherCell( localIndex const faceIdx, CellDescriptor const & hostCellID ) const;
169 
178  void computeFractureMatrixWeights( CellDescriptor const & neighborCell,
179  localIndex const fracElement,
180  EmbeddedSurfaceSubRegion const & fractureSubRegion,
181  localIndex const faceIdx,
182  real64 ( &weights )[2] ) const;
183 
191  void addNonNeighboringConnection( localIndex const fracElement,
192  CellDescriptor const & cell,
193  real64 const (&weights)[2],
194  EmbeddedSurfaceSubRegion const & fractureSubRegion ) const;
195 
196  // Private variables
197 
199  ElementRegionManager const & m_elementManager;
203  arrayView2d< localIndex const > const m_edgeToNodes;
205  arrayView2d< localIndex const > const m_faceToRegions;
207  arrayView2d< localIndex const > const m_faceToSubRegions;
209  arrayView2d< localIndex const > const m_faceToCells;
213  ArrayOfArraysView< localIndex const > const m_faceToNodes;
217  CellElementStencilTPFA & m_cellStencil;
219  EmbeddedSurfaceToCellStencil & m_edfmStencil;
221  string const m_embeddedSurfaceRegionName;
222 
223 };
224 
225 } // end namespace geos
226 
227 
228 #endif // __PROJECTIONEDFMHELPER_H_
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
array1d< array1d< VIEWTYPE > > ElementViewAccessor
The ElementViewAccessor at the ElementRegionManager level is an array of array of VIEWTYPE.
Provides management of the interior stencil points for a face elements when using Two-Point flux appr...
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
A class that contains methods to modify cell and edfm stencils based on projection edfm.
ProjectionEDFMHelper(MeshLevel const &mesh, CellElementStencilTPFA &stencil, EmbeddedSurfaceToCellStencil &edfmStencil, string const &embeddedSurfaceRegionName)
Constructor.
void addNonNeighboringConnections() const
add Fracture-matrix connections to the edfmStencil and remove the appropriate connections from the ce...
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:286
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
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
Definition: DataTypes.hpp:184
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196
A structure containing a single cell (element) identifier triplet.
localIndex region
region index
localIndex subRegion
subregion index
bool operator==(CellDescriptor const &other) const
Comparison operator between two CellDescriptors.
CellDescriptor(localIndex r, localIndex sr, localIndex i)
Constructor for the CellDescriptor struct.
localIndex index
cell index