GEOS
WellLiquidRateConstraint.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 WellLiquidRateConstraint.hpp
18  */
19 
20 
21 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_WELLLIQUIDRATECONSTRAINT_HPP
22 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_WELLLIQUIDRATECONSTRAINT_HPP
23 
25 
27 #include "WellConstraintsBase.hpp"
28 
29 namespace geos
30 {
31 
32 
40 {
41 public:
42 
43 
48 
54  explicit LiquidRateConstraint( string const & name, dataRepository::Group * const parent );
55 
56 
61 
66 
71 
76 
82 
88 
93  static string catalogName()
94  {
95  return "LiquidRateConstraint";
96  }
98 
103 
107  const string_array & getPhaseNames() const { return m_phaseNames; }
108 
113  void setPhaseNames( const string_array & phaseNames ) { m_phaseNames=phaseNames; }
114 
120 
122 
127  {
129  static constexpr char const * liquidRateString() { return "liquidRate"; }
131  static constexpr char const * phaseNamesString() { return "phaseNames"; }
132  };
133 
134  // Temp interface - tjb
135  virtual ConstraintTypeId getControl() const override { return ConstraintTypeId::LIQUIDRATE; };
136 
137  virtual bool checkViolation( WellConstraintBase const & currentConstraint, real64 const & currentTime ) const override;
138 
139 protected:
140 
141  virtual void postInputInitialization() override;
142 
143  template< typename T >
144  void validateLiquidType( T const & fluidModel )
145  {
146  m_phaseIndices.resize( m_phaseNames.size());
147  for( size_t ip =0; ip<m_phaseNames.size(); ip++ )
148  {
149  integer phaseIndex = fluidModel.getPhaseIndex( m_phaseNames[ip] );
150  GEOS_THROW_IF( phaseIndex == -1,
151  "LiquidProductionConstraint " << viewKeyStruct::liquidRateString() <<
152  ": Invalid Liquid type for simulation fluid model " << m_phaseNames[ip],
153  InputError );
154  m_phaseIndices[ip]=phaseIndex;
155  }
156  }
157 protected:
158 
163 
164 };
165 
166 
167 
168 } //namespace geos
169 
170 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_WELLLiquidRateConstraint_HPP
#define GEOS_THROW_IF(EXP, msg, TYPE)
Conditionally throw an exception.
Definition: Logger.hpp:151
This class describes a Liquid rate constraint used to control of type WellConstraintType.
array1d< integer > m_phaseIndices
Indices of the phases defining the fluid.
virtual bool checkViolation(WellConstraintBase const &currentConstraint, real64 const &currentTime) const override
Check if this constraint is violated.
void setPhaseNames(const string_array &phaseNames)
Set phases associated with liquid constraint.
string_array m_phaseNames
Name of the targeted phase.
LiquidRateConstraint(LiquidRateConstraint const &)=delete
Deleted copy constructor.
LiquidRateConstraint(LiquidRateConstraint &&)=delete
Deleted move constructor.
const string_array & getPhaseNames() const
Get the target phase name.
virtual void postInputInitialization() override
LiquidRateConstraint(string const &name, dataRepository::Group *const parent)
Constructor for WellControls Objects.
LiquidRateConstraint & operator=(LiquidRateConstraint &&)=delete
Deleted move operator.
const array1d< integer > & getPhaseIndices() const
Get the phase indices.
LiquidRateConstraint & operator=(LiquidRateConstraint const &)=delete
Deleted assignment operator.
~LiquidRateConstraint() override
Default destructor.
LiquidRateConstraint()=delete
Deleted default constructor.
static string catalogName()
name of the node manager in the object catalog
stdVector< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:361
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
Exception class used to report errors in user input.
Definition: Logger.hpp:464
Struct to serve as a container for variable strings and keys.
static constexpr char const * phaseNamesString()
String key for the phases names.
static constexpr char const * liquidRateString()
String key for the liquid rate.