GEOS
WellGeneratorBase.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 /*
17  * @file WellGeneratorBase.hpp
18  *
19  */
20 
21 #ifndef GEOS_MESH_GENERATORS_WELLGENERATORBASE_HPP_
22 #define GEOS_MESH_GENERATORS_WELLGENERATORBASE_HPP_
23 
24 #include "mesh/generators/WellGeneratorABC.hpp"
25 #include "dataRepository/Group.hpp"
26 #include "codingUtilities/Utilities.hpp"
27 #include "common/DataTypes.hpp"
28 
29 
30 namespace geos
31 {
32 
39 {
40 public:
41 
47  WellGeneratorBase( const string & name,
48  Group * const parent );
49 
51  virtual void expandObjectCatalogs() override;
52 
55 
56 
63  virtual Group * createChild( string const & childKey, string const & childName ) override;
64 
70 
74  void generateWellGeometry( ) override;
75 
76 
81 
82  // getters for element data
83 
88  globalIndex numElements() const override { return m_numElems; }
89 
95 
100  globalIndex numNodesPerElement() const override { return m_numNodesPerElem; }
101 
106  const array2d< real64 > & getPolyNodeCoord() const override { return m_polyNodeCoords; }
107 
111  real64 getMinSegmentLength() const override { return m_minSegmentLength; }
112 
116  real64 getMinElemLength() const override { return m_minElemLength; }
117 
121  const string_array & getPerforationList() const override { return m_perforationList; }
122 
128 
134 
139  arrayView1d< arrayView1d< globalIndex const > const > getPrevElemIndices() const override { return m_prevElemId.toNestedViewConst(); }
140 
146 
152 
157  real64 getElementRadius() const override { return m_radius; }
158 
159  // getters for node data
160 
165  globalIndex numNodes() const override { return m_numNodes; }
166 
172 
173  // getters for perforation data
178  globalIndex numPerforations() const override { return m_numPerforations; }
179 
185 
191 
197 
203 
207  int getPhysicalDimensionsNumber() const override { return m_nDims; }
208 
213  const string getWellRegionName() const override { return m_wellRegionName; }
214 
219  const string getWellControlsName() const override { return m_wellControlsName; }
220 
222  struct viewKeyStruct
223  {
224  constexpr static char const * polylineNodeCoordsString() { return "polylineNodeCoords"; }
225  constexpr static char const * polylineSegmentConnString() { return "polylineSegmentConn"; }
226  constexpr static char const * numElementsPerSegmentString() { return "numElementsPerSegment"; }
227  constexpr static char const * minSegmentLengthString() { return "minSegmentLength"; }
228  constexpr static char const * minElementLengthString() { return "minElementLength"; }
229  constexpr static char const * radiusString() { return "radius"; }
230  constexpr static char const * wellRegionNameString() { return "wellRegionName"; }
231  constexpr static char const * wellControlsNameString() { return "wellControlsName"; }
232  constexpr static char const * perforationString() { return "Perforation"; }
233  };
235 
236 protected:
237 
242  void postInputInitialization() override;
243 
248 
252  virtual void fillPolylineDataStructure() { };
253 
258 
263 
268 
273 
280 
285  void mergePerforations( array1d< array1d< localIndex > > const & elemToPerfMap );
286 
294  globalIndex currentNodeId ) const;
295 
297 
299  void logInternalWell() const;
300  void logPerforationTable() const;
302 
305 
308 
309  // XML Input
310 
313 
316 
319 
322 
325 
328 
331 
332 
333 
334  // Geometry of the well (later passed to the WellElementSubRegion)
335 
336  // well element data
337 
340 
343 
346 
349 
352 
355 
356 
357  // well node data
358 
361 
364 
367 
368  // perforation data
369 
372 
375 
378 
379 
380 
381  // Auxiliary data
382 
384  const int m_nDims;
385 
388 
391 
394 
397 
398  // Perforation data
399 
402 
405 
406 };
407 }
408 #endif /* GEOS_MESH_GENERATORS_WELLGENERATORBASE_HPP_ */
void checkPerforationLocationsValidity()
Make sure that the perforation locations are valid:
array2d< globalIndex > m_elemToNodesMap
Connectivity between elements and nodes.
int m_numElemsPerSegment
Number of well elements per polyline interval.
globalIndex const m_numNodesPerElem
Number of nodes per well element.
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new geometric object (box, plane, etc) as a child of this group.
int getPhysicalDimensionsNumber() const override
const int m_nDims
Number of physical dimensions.
void findPolylineHeadNodeIndex()
Find the head node of the well (i.e., top node of the polyline).
void postInputInitialization() override
This function provides capability to post process input values prior to any other initialization oper...
array2d< real64 > m_polyNodeCoords
Coordinates of the polyline nodes.
globalIndex numNodesPerElement() const override
Get the number of nodes per well element.
globalIndex numPerforations() const override
Get the global number of perforations on this well.
globalIndex numNodes() const override
Get the global number of well nodes.
arrayView1d< globalIndex const > getNextElemIndex() const override
Get the global indices mapping an element to the next.
arrayView2d< real64 const > getPerfCoords() const override
Get the locations of the perforations.
globalIndex getNextSegmentIndex(globalIndex topSegId, globalIndex currentNodeId) const
At a given node, find the next segment going in the direction of the bottom of the well.
arrayView1d< real64 const > getElemVolume() const override
Get the volume of the well elements.
void discretizePolyline()
Discretize the polyline by placing well elements.
const string_array & getPerforationList() const override
void constructPolylineNodeToSegmentMap()
Map each polyline node to the polyline segment(s) it is connected to.
real64 getMinSegmentLength() const override
real64 getElementRadius() const override
Get the radius in the well.
WellGeneratorBase(const string &name, Group *const parent)
Constructor.
arrayView2d< real64 const > getElemCoords() const override
Get the physical location of the centers of well elements.
array2d< real64 > m_nodeCoords
Physical location of the nodes.
real64 getMinElemLength() const override
array1d< SortedArray< globalIndex > > m_polyNodeToSegmentMap
Map from the polyline nodes to the polyline nodes.
void connectPerforationsToWellElements()
Map each perforation to a well element.
real64 m_minElemLength
Min well element length.
string m_wellControlsName
Name of the constraints associated with this well.
string_array m_perforationList
List of perforation names.
array1d< globalIndex > m_nextElemId
Global index of the next well element.
array1d< real64 > m_perfTransmissibility
Well Peaceman index at the perforation.
array2d< globalIndex > m_segmentToPolyNodeMap
Connectivity between the polyline nodes.
const string getWellRegionName() const override
array1d< real64 > m_perfDistFromHead
Physical location of the perforation wrt to well head.
array1d< real64 > m_elemVolume
Volume of well elements.
array1d< real64 > m_nodeDistFromHead
Physical location of the polyline node wrt to well head.
arrayView2d< globalIndex const > getElemToNodesMap() const override
Get the global indices of the well nodes nodes connected to each element.
arrayView2d< real64 const > getNodeCoords() const override
Get the physical location of the centers of well elements.
arrayView1d< real64 const > getPerfTransmissibility() const override
Get the well transmissibility at the perforations.
virtual void expandObjectCatalogs() override
This function is used to expand any catalogs in the data structure.
static CatalogInterface::CatalogType & getCatalog()
Accessor for the singleton Catalog object.
array2d< real64 > m_perfCoords
Absolute physical location of the perforation.
real64 m_radius
Radius area of the well (assumed to be valid for the entire well)
arrayView1d< real64 const > getPerfSkinFactor() const override
Get the skin factor at a perforation.
real64 m_minSegmentLength
Min segment length.
array1d< array1d< globalIndex > > m_prevElemId
Global indices of the prev well elements (maybe need multiple prevs for branching)
array1d< real64 > m_perfSkinFactor
Skin Factor at the perforation.
array1d< globalIndex > m_perfElemId
Global index of the well element.
const array2d< globalIndex > & getSegmentToPolyNodeMap() const override
Getter to the Segment to PolyNode mapping.
globalIndex m_polylineHeadNodeId
Index of the node at the well head.
globalIndex m_numNodes
Global number of well nodes.
void mergePerforations(array1d< array1d< localIndex > > const &elemToPerfMap)
Merge perforations on the elements with multiple perforations.
string m_wellRegionName
Name of the corresponding well region.
virtual void fillPolylineDataStructure()
Fills the intermediate polyline data structure.
arrayView1d< globalIndex const > getPerfElemIndex() const override
Get the global indices of the well elements connected to each perforation.
globalIndex m_numElems
Global number of well elements.
const array2d< real64 > & getPolyNodeCoord() const override
Get the Coordinates of the polyline nodes.
const string getWellControlsName() const override
globalIndex m_numPerforations
Global number of perforations.
void generateWellGeometry() override
Main function of the class that generates the well geometry.
globalIndex numElements() const override
Get the global number of well elements.
arrayView1d< arrayView1d< globalIndex const > const > getPrevElemIndices() const override
Get the global indices mapping an element to the previous ones.
array2d< real64 > m_elemCenterCoords
Physical location of the center of the well element.
This class provides the base class/interface for the catalog value objects.
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:88
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176