GEOSX
WellGeneratorBase.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 TotalEnergies
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 WellGeneratorBase.hpp
17  *
18  */
19 
20 #ifndef GEOS_MESH_GENERATORS_WELLGENERATORBASE_HPP_
21 #define GEOS_MESH_GENERATORS_WELLGENERATORBASE_HPP_
22 
23 #include "mesh/generators/WellGeneratorABC.hpp"
24 #include "dataRepository/Group.hpp"
25 #include "codingUtilities/Utilities.hpp"
26 #include "common/DataTypes.hpp"
27 
28 
29 namespace geos
30 {
31 
38 {
39 public:
40 
46  WellGeneratorBase( const string & name,
47  Group * const parent );
48 
50  virtual void expandObjectCatalogs() override;
51 
54 
55 
62  virtual Group * createChild( string const & childKey, string const & childName ) override;
63 
69 
73  void generateWellGeometry( ) override;
74 
75 
80 
81  // getters for element data
82 
87  globalIndex numElements() const override { return m_numElems; }
88 
94 
99  globalIndex numNodesPerElement() const override { return m_numNodesPerElem; }
100 
105  const array2d< real64 > & getPolyNodeCoord() const override { return m_polyNodeCoords; }
106 
110  real64 getMinSegmentLength() const override { return m_minSegmentLength; }
111 
115  real64 getMinElemLength() const override { return m_minElemLength; }
116 
120  const string_array & getPerforationList() const override { return m_perforationList; }
121 
127 
133 
138  arrayView1d< arrayView1d< globalIndex const > const > getPrevElemIndices() const override { return m_prevElemId.toNestedViewConst(); }
139 
145 
151 
156  real64 getElementRadius() const override { return m_radius; }
157 
158  // getters for node data
159 
164  globalIndex numNodes() const override { return m_numNodes; }
165 
171 
172  // getters for perforation data
177  globalIndex numPerforations() const override { return m_numPerforations; }
178 
184 
190 
196 
202 
206  int getPhysicalDimensionsNumber() const override { return m_nDims; }
207 
212  const string getWellRegionName() const override { return m_wellRegionName; }
213 
218  const string getWellControlsName() const override { return m_wellControlsName; }
219 
221  struct viewKeyStruct
222  {
223  constexpr static char const * polylineNodeCoordsString() { return "polylineNodeCoords"; }
224  constexpr static char const * polylineSegmentConnString() { return "polylineSegmentConn"; }
225  constexpr static char const * numElementsPerSegmentString() { return "numElementsPerSegment"; }
226  constexpr static char const * minSegmentLengthString() { return "minSegmentLength"; }
227  constexpr static char const * minElementLengthString() { return "minElementLength"; }
228  constexpr static char const * radiusString() { return "radius"; }
229  constexpr static char const * wellRegionNameString() { return "wellRegionName"; }
230  constexpr static char const * wellControlsNameString() { return "wellControlsName"; }
231  constexpr static char const * perforationString() { return "Perforation"; }
232  };
234 
235 protected:
236 
241  void postProcessInput() override;
242 
247 
251  virtual void fillPolylineDataStructure() { };
252 
257 
262 
267 
272 
279 
284  void mergePerforations( array1d< array1d< localIndex > > const & elemToPerfMap );
285 
293  globalIndex currentNodeId ) const;
294 
296 
298  void debugWellGeometry() const;
300 
303 
306 
307  // XML Input
308 
311 
314 
317 
320 
323 
326 
329 
330 
331 
332  // Geometry of the well (later passed to the WellElementSubRegion)
333 
334  // well element data
335 
338 
341 
344 
347 
350 
353 
354 
355  // well node data
356 
359 
362 
365 
366  // perforation data
367 
370 
373 
376 
377 
378 
379  // Auxiliary data
380 
382  const int m_nDims;
383 
386 
389 
392 
395 
396  // Perforation data
397 
400 
403 
404 };
405 }
406 #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).
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.
void postProcessInput() override
This function provides capability to post process input values prior to any other initialization oper...
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:220
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:232
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
double real64
64-bit floating point type.
Definition: DataTypes.hpp:139
GEOSX_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:236
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:216