GEOSX
PerforationData.hpp
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
15 /*
16  * @file PerforationData.hpp
17  */
18 
19 #ifndef GEOSX_MESHUTILITIES_PERFORATIONDATA_HPP
20 #define GEOSX_MESHUTILITIES_PERFORATIONDATA_HPP
21 
22 #include "dataRepository/Group.hpp"
25 #include "meshUtilities/InternalWellGenerator.hpp"
26 
27 namespace geosx
28 {
29 
30 class DomainPartition;
31 class MeshLevel;
32 class WellElementSubRegion;
33 class CellBlock;
34 
40 {
41 public:
42 
46 
53  explicit PerforationData( string const & name, dataRepository::Group * const parent );
54 
58  ~PerforationData() override;
59 
63  PerforationData() = delete;
64 
68  PerforationData( PerforationData const & ) = delete;
69 
73  PerforationData( PerforationData && ) = delete;
74 
79  PerforationData & operator=( PerforationData const & ) = delete;
80 
85  PerforationData & operator=( PerforationData && ) = delete;
86 
88 
92 
98  static string CatalogName() { return "PerforationData"; }
99 
103  virtual const string getCatalogName() const override { return CatalogName(); }
104 
106 
110 
116  void SetNumPerforationsGlobal( globalIndex nPerfs ) { m_numPerforationsGlobal = nPerfs; }
117 
118 
123  globalIndex GetNumPerforationsGlobal() const { return m_numPerforationsGlobal; }
124 
125 
131 
132 
137  ToElementRelation< array1d< localIndex > > const & GetMeshElements() const { return m_toMeshElements; }
138 
139 
144  arrayView1d< localIndex > GetWellElements() { return m_wellElementIndex; }
145 
146 
151  arrayView1d< localIndex const > GetWellElements() const { return m_wellElementIndex; }
152 
153 
158  arrayView2d< real64 > GetLocation() { return m_location; }
159 
160 
165  arrayView2d< real64 const > GetLocation() const { return m_location; }
166 
167 
172  arrayView1d< real64 const > GetWellTransmissibility() const { return m_wellTransmissibility; }
173 
174 
179  arrayView1d< real64 > GetWellTransmissibility() { return m_wellTransmissibility; }
180 
182 
186 
194  void ComputeWellTransmissibility( MeshLevel const & mesh,
195  WellElementSubRegion const * const wellElemSubRegion,
196  string const & permeabilityKey );
197 
199 
203 
210  void ConnectToMeshElements( MeshLevel const & mesh,
211  InternalWellGenerator const & wellGeometry );
212 
213 
220  void ConnectToWellElements( InternalWellGenerator const & wellGeometry,
221  unordered_map< globalIndex, localIndex > const & globalToLocalWellElementMap,
222  globalIndex elemOffsetGlobal );
223 
225 
231  {
233  static constexpr auto numPerforationsGlobalString = "numPerforationsGlobal";
235  static constexpr auto reservoirElementRegionString = "reservoirElementRegion";
237  static constexpr auto reservoirElementSubregionString = "reservoirElementSubregion";
239  static constexpr auto reservoirElementIndexString = "reservoirElementIndex";
241  static constexpr auto wellElementIndexString = "wellElementIndex";
243  static constexpr auto locationString = "location";
245  static constexpr auto wellTransmissibilityString = "wellTransmissibility";
246 
248  dataRepository::ViewKey numPerforationsGlobal = { numPerforationsGlobalString };
250  dataRepository::ViewKey reservoirElementRegion = { reservoirElementRegionString };
252  dataRepository::ViewKey reservoirElementSubregion = { reservoirElementSubregionString };
254  dataRepository::ViewKey reservoirElementIndex = { reservoirElementIndexString };
256  dataRepository::ViewKey wellElementIndex = { wellElementIndexString };
258  dataRepository::ViewKey location = { locationString };
260  dataRepository::ViewKey wellTransmissibility = { wellTransmissibilityString };
261 
262  }
265 
271  {}
274 
275 private:
276 
280 
293  void GetReservoirElementDimensions( MeshLevel const & mesh,
294  localIndex const er, localIndex const esr, localIndex const ei,
295  real64 & dx, real64 & dy, real64 & dz ) const;
296 
298 
300  void DebugLocalPerforations() const;
302 
304  globalIndex m_numPerforationsGlobal;
305 
307  ToElementRelation< array1d< localIndex > > m_toMeshElements;
308 
310  array1d< localIndex > m_wellElementIndex;
311 
313  array2d< real64 > m_location;
314 
316  array1d< real64 > m_wellTransmissibility;
317 
318 };
319 
320 } //namespace geosx
321 
322 #endif //GEOSX_MESHUTILITIES_PERFORATIONDATA_HPP
dataRepository::ViewKey location
ViewKey for the well location.
virtual const string getCatalogName() const override
Get the catalog name.
void ConnectToMeshElements(MeshLevel const &mesh, InternalWellGenerator const &wellGeometry)
Locate connected local mesh elements and resizes current object appropriately.
struct to serve as a container for group strings and keys
void SetNumPerforationsGlobal(globalIndex nPerfs)
Set the global number of perforations used for well initialization.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
struct to serve as a container for group strings and keys
arrayView2d< real64 const > GetLocation() const
Provide an immutable accessor to a const perforation location arrayView.
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:38
dataRepository::ViewKey reservoirElementSubregion
ViewKey for the reservoir element subregion index.
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:349
geosx::PerforationData::groupKeyStruct groupKeysPerforationData
groupKey struct for the PerforationData class
static constexpr auto wellElementIndexString
String key for the well element index.
static constexpr auto wellTransmissibilityString
String key for the well transmissibility.
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
dataRepository::ViewKey wellTransmissibility
ViewKey for the well transmissibility.
ToElementRelation< array1d< localIndex > > & GetMeshElements()
Get perforation-to-mesh-element connectivity.
A relationship to an element.
static constexpr auto reservoirElementIndexString
String key for the reservoir element index.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:136
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
geosx::PerforationData::viewKeyStruct viewKeysPerforationData
ViewKey struct for the PerforationData class.
PerforationData & operator=(PerforationData const &)=delete
Deleted assignment operator.
arrayView1d< real64 const > GetWellTransmissibility() const
Provide an immutable accessor to a const perforation well indices array.
ToElementRelation< array1d< localIndex > > const & GetMeshElements() const
Provide an immutable accessor to a const perforation-to-mesh-element connectivity.
void ComputeWellTransmissibility(MeshLevel const &mesh, WellElementSubRegion const *const wellElemSubRegion, string const &permeabilityKey)
Compute the well transmissibility for each local perforation on this well.
globalIndex GetNumPerforationsGlobal() const
Get the global number of perforations (used for well initialization).
~PerforationData() override
Default destructor.
dataRepository::ViewKey wellElementIndex
ViewKey for the well element index.
arrayView2d< real64 > GetLocation()
Get perforation locations.
static constexpr auto reservoirElementRegionString
String key for the reservoir element region index.
static constexpr auto locationString
String key for the perforation location.
arrayView1d< real64 > GetWellTransmissibility()
Get perforation well indices.
void ConnectToWellElements(InternalWellGenerator const &wellGeometry, unordered_map< globalIndex, localIndex > const &globalToLocalWellElementMap, globalIndex elemOffsetGlobal)
Connect each perforation to a local wellbore element.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
static constexpr auto reservoirElementSubregionString
String key for the reservoir element subregion index.
arrayView1d< localIndex > GetWellElements()
Get perforation-to-well-element connectivity.
arrayView1d< localIndex const > GetWellElements() const
Provide an immutable accessor to a const perforation-to-well-element connectivity.
static constexpr auto numPerforationsGlobalString
String key for the global number of perforations.
dataRepository::ViewKey reservoirElementRegion
ViewKey for the reservoir element region index.
PerforationData()=delete
Deleted default constructor.
static string CatalogName()
Get the catalog name.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
This class describes a collection of local well elements and perforations.
struct to serve as a container for variable strings and keys
dataRepository::ViewKey reservoirElementIndex
ViewKey for the reservoir element index.
dataRepository::ViewKey numPerforationsGlobal
ViewKey for the global number of perforations.
Struct to serve as a container for variable strings and keys.