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 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 
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/MeshComponentBase.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 
59  virtual Group * createChild( string const & childKey, string const & childName ) override;
60 
65 
66 
71 
72  // getters for element data
73 
78  globalIndex numElements() const { return m_numElems; }
79 
85 
91 
97 
102 
107 
112 
118 
124 
129  arrayView1d< arrayView1d< globalIndex const > const > getPrevElemIndices() const { return m_prevElemId.toNestedViewConst(); }
130 
136 
142 
147  real64 getElementRadius() const { return m_radius; }
148 
149  // getters for node data
150 
155  globalIndex numNodes() const { return m_numNodes; }
156 
162 
163  // getters for perforation data
169 
175 
181 
187 
193 
197  int getPhysicalDimensionsNumber() const { return m_nDims; }
198 
203  const string getWellRegionName() const { return m_wellRegionName; }
204 
209  const string getWellControlsName() const { return m_wellControlsName; }
210 
212  struct viewKeyStruct
213  {
214  constexpr static char const * polylineNodeCoordsString() { return "polylineNodeCoords"; }
215  constexpr static char const * polylineSegmentConnString() { return "polylineSegmentConn"; }
216  constexpr static char const * numElementsPerSegmentString() { return "numElementsPerSegment"; }
217  constexpr static char const * minSegmentLengthString() { return "minSegmentLength"; }
218  constexpr static char const * minElementLengthString() { return "minElementLength"; }
219  constexpr static char const * radiusString() { return "radius"; }
220  constexpr static char const * wellRegionNameString() { return "wellRegionName"; }
221  constexpr static char const * wellControlsNameString() { return "wellControlsName"; }
222  constexpr static char const * perforationString() { return "Perforation"; }
223  };
225 
226 protected:
227 
232  void postInputInitialization() override;
233 
238 
242  virtual void fillPolylineDataStructure() { };
243 
248 
253 
258 
263 
270 
275  void mergePerforations( array1d< array1d< localIndex > > const & elemToPerfMap );
276 
284  globalIndex currentNodeId ) const;
285 
287 
289  void logInternalWell() const;
290  void logPerforationTable() const;
292 
295 
298 
299  // XML Input
300 
303 
306 
309 
312 
315 
318 
321 
322 
323 
324  // Geometry of the well (later passed to the WellElementSubRegion)
325 
326  // well element data
327 
330 
333 
336 
339 
342 
345 
346 
347  // well node data
348 
351 
354 
357 
358  // perforation data
359 
362 
365 
368 
369 
370 
371  // Auxiliary data
372 
374  const int m_nDims;
375 
378 
381 
384 
387 
388  // Perforation data
389 
392 
395 
396 };
397 }
398 #endif /* GEOS_MESH_GENERATORS_WELLGENERATORBASE_HPP_ */
void checkPerforationLocationsValidity()
Make sure that the perforation locations are valid:
arrayView1d< globalIndex const > getNextElemIndex() const
Get the global indices mapping an element to the next.
array2d< globalIndex > m_elemToNodesMap
Connectivity between elements and nodes.
int m_numElemsPerSegment
Number of well elements per polyline interval.
arrayView2d< real64 const > getElemCoords() const
Get the physical location of the centers of well elements.
globalIndex const m_numNodesPerElem
Number of nodes per well element.
arrayView1d< real64 const > getPerfTransmissibility() const
Get the well transmissibility at the perforations.
const string getWellRegionName() const
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new geometric object (box, plane, etc) as a child of this group.
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 getNextSegmentIndex(globalIndex topSegId, globalIndex currentNodeId) const
At a given node, find the next segment going in the direction of the bottom of the well.
void discretizePolyline()
Discretize the polyline by placing well elements.
void constructPolylineNodeToSegmentMap()
Map each polyline node to the polyline segment(s) it is connected to.
void generateWellGeometry()
Main function of the class that generates the well geometry.
WellGeneratorBase(const string &name, Group *const parent)
Constructor.
arrayView1d< real64 const > getPerfSkinFactor() const
Get the skin factor at a perforation.
array2d< real64 > m_nodeCoords
Physical location of the nodes.
real64 getElementRadius() const
Get the radius in the well.
globalIndex numNodes() const
Get the global number of well nodes.
const string getWellControlsName() const
array1d< SortedArray< globalIndex > > m_polyNodeToSegmentMap
Map from the polyline nodes to the polyline nodes.
void connectPerforationsToWellElements()
Map each perforation to a well element.
arrayView2d< globalIndex const > getElemToNodesMap() const
Get the global indices of the well nodes nodes connected to each element.
real64 m_minElemLength
Min well element length.
string m_wellControlsName
Name of the constraints associated with this well.
arrayView1d< globalIndex const > getPerfElemIndex() const
Get the global indices of the well elements connected to each perforation.
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.
arrayView2d< real64 const > getNodeCoords() const
Get the physical location of the centers of well elements.
array1d< real64 > m_perfDistFromHead
Physical location of the perforation wrt to well head.
const string_array & getPerforationList() const
array1d< real64 > m_elemVolume
Volume of well elements.
array1d< real64 > m_nodeDistFromHead
Physical location of the polyline node wrt to well head.
arrayView2d< real64 const > getPerfCoords() const
Get the locations of the perforations.
const array2d< globalIndex > & getSegmentToPolyNodeMap() const
Getter to the Segment to PolyNode mapping.
const array2d< real64 > & getPolyNodeCoord() const
Get the Coordinates of the polyline nodes.
virtual void expandObjectCatalogs() override
This function is used to expand any catalogs in the data structure.
arrayView1d< real64 const > getElemVolume() const
Get the volume of the well elements.
arrayView1d< arrayView1d< globalIndex const > const > getPrevElemIndices() const
Get the global indices mapping an element to the previous ones.
globalIndex numElements() const
Get the global number of well elements.
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)
globalIndex numNodesPerElement() const
Get the number of nodes per well element.
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.
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.
globalIndex m_numElems
Global number of well elements.
globalIndex numPerforations() const
Get the global number of perforations on this well.
real64 getMinSegmentLength() const
globalIndex m_numPerforations
Global number of perforations.
array2d< real64 > m_elemCenterCoords
Physical location of the center of the well element.
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