GEOS
SinglePhaseWell.hpp
Go to the documentation of this file.
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 
20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_SINGLEPHASEWELL_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_SINGLEPHASEWELL_HPP_
22 
23 #include "WellSolverBase.hpp"
24 
25 namespace geos
26 {
27 
28 namespace dataRepository
29 {
30 class Group;
31 }
32 
33 namespace constitutive
34 {
35 class SingleFluidBase;
36 }
37 class WellElementSubRegion;
38 
45 {
46 public:
47 
48 
54  SinglePhaseWell( const string & name,
55  Group * const parent );
56 
58  SinglePhaseWell() = delete;
59 
61  SinglePhaseWell( SinglePhaseWell const & ) = delete;
62 
65 
67  SinglePhaseWell & operator=( SinglePhaseWell const & ) = delete;
68 
71 
75  virtual ~SinglePhaseWell() override = default;
76 
81  static string catalogName() { return "SinglePhaseWell"; }
85  string getCatalogName() const override { return catalogName(); }
86 
87  virtual void registerDataOnMesh( Group & meshBodies ) override;
88 
96  virtual real64
97  calculateResidualNorm( real64 const & time_n,
98  real64 const & dt,
99  DomainPartition const & domain,
100  DofManager const & dofManager,
101  arrayView1d< real64 const > const & localRhs ) override;
102 
103  virtual bool
105  DofManager const & dofManager,
106  arrayView1d< real64 const > const & localSolution,
107  real64 const scalingFactor ) override;
108 
109  virtual void
110  applySystemSolution( DofManager const & dofManager,
111  arrayView1d< real64 const > const & localSolution,
112  real64 const scalingFactor,
113  real64 const dt,
114  DomainPartition & domain ) override;
115 
116  virtual void
118 
119  virtual void
120  implicitStepSetup( real64 const & time,
121  real64 const & dt,
122  DomainPartition & domain ) override;
123 
124  virtual void
126  real64 const & dt,
127  DomainPartition & domain ) override;
128 
131  virtual string wellElementDofName() const override { return viewKeyStruct::dofFieldString(); }
132 
133  virtual string resElementDofName() const override;
134 
135  virtual localIndex numFluidComponents() const override { return 1; }
136 
137  virtual localIndex numFluidPhases() const override { return 1; }
138 
144 
149  virtual void updateBHPForConstraint( WellElementSubRegion & subRegion );
150 
155  virtual void updateFluidModel( WellElementSubRegion & subRegion ) const;
156 
161  virtual void computePerforationRates( real64 const & time_n,
162  real64 const & dt, DomainPartition & domain ) override;
163 
168  virtual real64 updateSubRegionState( WellElementSubRegion & subRegion ) override;
169 
179  virtual void assembleFluxTerms( real64 const & time_n,
180  real64 const & dt,
181  DomainPartition & domain,
182  DofManager const & dofManager,
183  CRSMatrixView< real64, globalIndex const > const & localMatrix,
184  arrayView1d< real64 > const & localRhs ) override;
185 
193  virtual void assembleAccumulationTerms( real64 const & time_n,
194  real64 const & dt, DomainPartition & domain,
195  DofManager const & dofManager,
196  CRSMatrixView< real64, globalIndex const > const & localMatrix,
197  arrayView1d< real64 > const & localRhs ) override;
198 
207  DofManager const & dofManager,
208  CRSMatrixView< real64, globalIndex const > const & localMatrix,
209  arrayView1d< real64 > const & localRhs );
210 
220  virtual void assemblePressureRelations( real64 const & time_n,
221  real64 const & dt,
222  DomainPartition const & domain,
223  DofManager const & dofManager,
224  CRSMatrixView< real64, globalIndex const > const & localMatrix,
225  arrayView1d< real64 > const & localRhs ) override;
226 
228  {
229  static constexpr char const * dofFieldString() { return "singlePhaseWellVars"; }
230 
231  // control data (not registered on the mesh)
232  static constexpr char const * currentBHPString() { return "currentBHP"; }
233  static constexpr char const * dCurrentBHP_dPresString() { return "dCurrentBHP_dPres"; }
234 
235  static constexpr char const * currentVolRateString() { return "currentVolumetricRate"; }
236  static constexpr char const * dCurrentVolRate_dPresString() { return "dCurrentVolumetricRate_dPres"; }
237  static constexpr char const * dCurrentVolRate_dRateString() { return "dCurrentVolumetricRate_dRate"; }
238 
239  };
240 
241 protected:
242 
243  void printRates( real64 const & time_n,
244  real64 const & dt,
245  DomainPartition & domain ) override;
246 
249 
250 private:
251 
256  void initializeWells( DomainPartition & domain, real64 const & time_n, real64 const & dt ) override;
257 
264  virtual void validateWellConstraints( real64 const & time_n,
265  real64 const & dt,
266  WellElementSubRegion const & subRegion ) override;
267 
268 };
269 
270 } // namespace geos
271 
272 
273 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_SINGLEPHASEWELL_HPP_
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:44
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
void assembleVolumeBalanceTerms(DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
assembles the volume balance terms for all well elements
virtual real64 updateSubRegionState(WellElementSubRegion &subRegion) override
Recompute all dependent quantities from primary variables (including constitutive models) on the well...
virtual string resElementDofName() const override
get the name of DOF defined on well elements
virtual void updateVolRateForConstraint(WellElementSubRegion &subRegion)
Recompute the volumetric rate that are used in the well constraints.
virtual string wellElementDofName() const override
get the name of DOF defined on well elements
SinglePhaseWell(const string &name, Group *const parent)
main constructor for Group Objects
virtual ~SinglePhaseWell() override=default
default destructor
virtual void assemblePressureRelations(real64 const &time_n, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the pressure relations at all connections between well elements except at the well head
static string catalogName()
name of the node manager in the object catalog
SinglePhaseWell & operator=(SinglePhaseWell const &)=delete
deleted assignment operator
SinglePhaseWell(SinglePhaseWell const &)=delete
deleted copy constructor
virtual void updateFluidModel(WellElementSubRegion &subRegion) const
Update fluid constitutive model state.
SinglePhaseWell(SinglePhaseWell &&)=default
default move constructor
integer m_allowNegativePressure
flag if negative pressure is allowed
virtual void assembleFluxTerms(real64 const &time_n, real64 const &dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the flux terms for all connections between well elements
virtual localIndex numFluidComponents() const override
const getter for the number of fluid components
virtual void assembleAccumulationTerms(real64 const &time_n, real64 const &dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the accumulation term for all the well elements
virtual void registerDataOnMesh(Group &meshBodies) override
Register wrappers that contain data on the mesh objects.
SinglePhaseWell & operator=(SinglePhaseWell &&)=delete
deleted move operator
string getCatalogName() const override
virtual void computePerforationRates(real64 const &time_n, real64 const &dt, DomainPartition &domain) override
Recompute the perforation rates for all the wells.
virtual localIndex numFluidPhases() const override
Get the number of fluid phases.
virtual void updateBHPForConstraint(WellElementSubRegion &subRegion)
Recompute the BHP pressure that is used in the well constraints.
SinglePhaseWell()=delete
deleted default constructor
This class describes a collection of local well elements and perforations.
virtual void implicitStepComplete(real64 const &time, real64 const &dt, DomainPartition &domain) override
perform cleanup for implicit timestep
virtual void resetStateToBeginningOfStep(DomainPartition &domain) override
reset state of physics back to the beginning of the step.
virtual void implicitStepSetup(real64 const &time, real64 const &dt, DomainPartition &domain) override
function to perform setup for implicit timestep
virtual void applySystemSolution(DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 const dt, DomainPartition &domain) override
Function to apply the solution vector to the state.
virtual real64 calculateResidualNorm(real64 const &time_n, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localRhs) override
calculate the norm of the global system residual
virtual bool checkSystemSolution(DomainPartition &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor) override
Function to check system solution for physical consistency and constraint violation.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:310
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82