GEOSX
InternalWellGenerator.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 InternalWellGenerator.hpp
17  *
18  */
19 
20 #ifndef GEOSX_MESHUTILITIES_INTERNALWELLGENERATOR_HPP_
21 #define GEOSX_MESHUTILITIES_INTERNALWELLGENERATOR_HPP_
22 
23 #include "dataRepository/Group.hpp"
25 
26 namespace geosx
27 {
28 
29 namespace dataRepository
30 {
31 namespace keys
32 {
33 string const nodeCoords = "polylineNodeCoords";
34 string const segmentConn = "polylineSegmentConn";
35 string const nElems = "numElementsPerSegment";
36 string const radius = "radius";
37 string const wellRegionName = "wellRegionName";
38 string const wellControlsName = "wellControlsName";
39 string const meshBodyName = "meshName";
40 }
41 }
42 
49 {
50 public:
51 
55  struct NodeLocation
56  {
57  static constexpr integer TOP = 0;
58  static constexpr integer BOTTOM = 1;
59  };
60 
64 
71  InternalWellGenerator( const std::string & name,
72  Group * const parent );
73 
77  virtual ~InternalWellGenerator() override;
78 
80 
84 
90  static string CatalogName() { return "InternalWell"; }
91 
93 
97 
100  virtual void GenerateElementRegions( DomainPartition & ) override {}
101 
110  virtual Group * CreateChild( string const & childKey,
111  string const & childName ) override;
112 
116  virtual void ExpandObjectCatalogs() override;
117 
122  virtual void GenerateMesh( DomainPartition * const domain ) override;
123 
125  virtual void GetElemToNodesRelationInBox ( std::string const &,
126  int const *,
127  int const &,
128  int *,
129  int const ) override {}
130 
132  virtual void RemapMesh ( dataRepository::Group * const ) override {}
133 
135 
139 
141  // getters for element data
142 
147  globalIndex GetNumElements() const { return m_numElems; }
148 
153  arrayView2d< real64 const > GetElemCoords() const { return m_elemCenterCoords; }
154 
159  arrayView1d< globalIndex const > GetNextElemIndex() const { return m_nextElemId; }
160 
165  arrayView1d< arrayView1d< globalIndex const > const > GetPrevElemIndices() const { return m_prevElemId.toNestedViewConst(); }
166 
171  arrayView2d< globalIndex const > GetElemToNodesMap() const { return m_elemToNodesMap; }
172 
177  arrayView1d< real64 const > GetElemVolume() const { return m_elemVolume; }
178 
183  real64 GetElementRadius() const { return m_radius; }
184 
185  // getters for node data
186 
191  globalIndex GetNumNodes() const { return m_numNodes; }
192 
197  arrayView2d< real64 const > GetNodeCoords() const { return m_nodeCoords; }
198 
199 
200 
201  // getters for perforation data
202 
207  globalIndex GetNumPerforations() const { return m_numPerforations; }
208 
213  arrayView2d< real64 const > GetPerfCoords() const { return m_perfCoords; }
214 
219  arrayView1d< real64 const > GetPerfTransmissibility() const { return m_perfTransmissibility; }
220 
225  arrayView1d< globalIndex const > GetPerfElemIndex() const { return m_perfElemId; }
226 
228 
229 protected:
230 
235  void PostProcessInput() override final;
236 
237 private:
238 
242 
247  void ConstructPolylineNodeToSegmentMap();
248 
252  void FindPolylineHeadNodeIndex();
253 
257  void DiscretizePolyline();
258 
262  void ConnectPerforationsToWellElements();
263 
267  void MergePerforations();
268 
274  globalIndex GetNextSegmentIndex( globalIndex topSegId,
275  globalIndex currentNodeId ) const;
276 
278 
280  void DebugWellGeometry() const;
282 
283  // XML Input
284 
286  array2d< globalIndex > m_segmentToPolyNodeMap;
287 
289  int m_numElemsPerSegment;
290 
292  real64 m_radius;
293 
295  string m_wellRegionName;
296 
298  string m_wellControlsName;
299 
301  string m_meshBodyName;
302 
303 
304 
305  // Geometry of the well (later passed to the WellElementSubRegion)
306 
307  // well element data
308 
310  globalIndex m_numElems;
311 
313  array2d< real64 > m_elemCenterCoords;
314 
316  array1d< globalIndex > m_nextElemId;
317 
319  array1d< array1d< globalIndex > > m_prevElemId;
320 
322  array2d< globalIndex > m_elemToNodesMap;
323 
325  array1d< real64 > m_elemVolume;
326 
327 
328  // well node data
329 
331  globalIndex const m_numNodesPerElem;
332 
334  globalIndex m_numNodes;
335 
337  array2d< real64 > m_nodeCoords;
338 
339  // perforation data
340 
342  globalIndex m_numPerforations;
343 
345  array2d< real64 > m_perfCoords;
346 
348  array1d< real64 > m_perfTransmissibility;
349 
351  array1d< globalIndex > m_perfElemId;
352 
353 
354 
355  // Auxiliary data
356 
357  // Number of physical dimensions
358  const int m_nDims;
359 
361  array2d< real64 > m_polyNodeCoords;
362 
364  array1d< SortedArray< globalIndex > > m_polyNodeToSegmentMap;
365 
367  globalIndex m_polylineHeadNodeId;
368 
370  array1d< real64 > m_nodeDistFromHead;
371 
372  // Perforation data
373 
375  string_array m_perforationList;
376 
378  array1d< real64 > m_perfDistFromHead;
379 
380 };
381 }
382 
383 #endif /* GEOSX_MESHUTILITIES_INTERNALWELLGENERATOR_HPP_ */
arrayView2d< real64 const > GetNodeCoords() const
Get the physical location of the centers of well elements.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
static string CatalogName()
Get the catalog name.
globalIndex GetNumPerforations() const
Get the global number of perforations on this well.
arrayView1d< arrayView1d< globalIndex const > const > GetPrevElemIndices() const
Get the global indices mapping an element to the previous ones.
real64 GetElementRadius() const
Get the radius in the well.
arrayView1d< globalIndex const > GetPerfElemIndex() const
Get the global indices of the well elements connected to each perforation.
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
double real64
64-bit floating point type.
Definition: DataTypes.hpp:136
Struct to define the top and bottom node of a segment.
arrayView2d< real64 const > GetPerfCoords() const
Get the locations of the perforations.
The MeshGeneratorBase class provides an abstract base class implementation for different mesh types...
virtual void GenerateElementRegions(DomainPartition &) override
not implemented
virtual void GetElemToNodesRelationInBox(std::string const &, int const *, int const &, int *, int const) override
not implemented
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
arrayView2d< real64 const > GetElemCoords() const
Get the physical location of the centers of well elements.
arrayView2d< globalIndex const > GetElemToNodesMap() const
Get the global indices of the well nodes nodes connected to each element.
arrayView1d< real64 const > GetElemVolume() const
Get the volume of the well elements.
arrayView1d< real64 const > GetPerfTransmissibility() const
Get the well transmissibility at the perforations.
std::string string
String type.
Definition: DataTypes.hpp:131
virtual void RemapMesh(dataRepository::Group *const) override
not implemented
globalIndex GetNumNodes() const
Get the global number of well nodes.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
globalIndex GetNumElements() const
Get the global number of well elements.
arrayView1d< globalIndex const > GetNextElemIndex() const
Get the global indices mapping an element to the next.