21 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_WELLCONTROLS_HPP
22 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_WELLCONTROLS_HPP
27 #include "constitutive/fluid/multifluid/MultiFluidBase.hpp"
29 #include "physicsSolvers/fluidFlow/wells/WellInjectionConstraint.hpp"
30 #include "physicsSolvers/fluidFlow/wells/WellProductionConstraint.hpp"
31 #include "physicsSolvers/fluidFlow/wells/WellBHPConstraints.hpp"
32 #include "physicsSolvers/fluidFlow/wells/WellVolumeRateConstraint.hpp"
33 #include "physicsSolvers/fluidFlow/wells/WellPhaseVolumeRateConstraint.hpp"
34 #include "physicsSolvers/fluidFlow/wells/WellMassRateConstraint.hpp"
35 #include "physicsSolvers/fluidFlow/wells/WellLiquidRateConstraint.hpp"
36 #include "constitutive/fluid/multifluid/MultiFluidBase.hpp"
37 #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp"
40 namespace dataRepository
44 static constexpr
auto wellControls =
"WellControls";
157 template<
typename T0,
typename T1,
typename ... CASTTYPES,
typename CONTAINERTYPE,
typename LAMBDA >
160 using Pointee = std::remove_pointer_t< std::remove_reference_t< CONTAINERTYPE > >;
161 using T = std::conditional_t< std::is_const< Pointee >::value, T0
const, T0 >;
162 T *
const castedContainer =
dynamic_cast< T *
>( container );
164 if( castedContainer !=
nullptr )
166 lambda( *castedContainer );
174 template<
typename CONTAINERTYPE,
typename LAMBDA >
181 template<
typename T0,
typename CONTAINERTYPE,
typename LAMBDA >
184 using Pointee = std::remove_pointer_t< std::remove_reference_t< CONTAINERTYPE > >;
185 using T = std::conditional_t< std::is_const< Pointee >::value, T0
const, T0 >;
186 T *
const castedContainer =
dynamic_cast< T *
>( container );
188 if( castedContainer !=
nullptr )
190 lambda( *castedContainer );
201 template<
typename GROUPTYPE =
Group,
typename ... GROUPTYPES,
typename LAMBDA >
204 for(
auto const * constraintIter : m_injectionRateConstraintList )
208 lambda( castedSubGroup );
214 template<
typename GROUPTYPE =
Group,
typename ... GROUPTYPES,
typename LAMBDA >
217 for(
auto * constraintIter : m_injectionRateConstraintList )
221 lambda( castedSubGroup );
228 template<
typename GROUPTYPE =
Group,
typename ... GROUPTYPES,
typename LAMBDA >
231 for(
auto const * constraintIter : m_productionRateConstraintList )
235 lambda( castedSubGroup );
241 template<
typename GROUPTYPE =
Group,
typename ... GROUPTYPES,
typename LAMBDA >
244 for(
auto * constraintIter : m_productionRateConstraintList )
248 lambda( castedSubGroup );
364 void setWellState(
bool open );
365 bool getWellState()
const;
368 void setConstraintSwitch(
bool constraintSwitch );
369 bool getConstraintSwitch()
const;
371 void setCurrentConstraint(
WellConstraintBase * currentConstraint ) { m_currentConstraint = currentConstraint;}
373 WellConstraintBase
const * getCurrentConstraint()
const {
return m_currentConstraint; }
400 void setFluidSeparator( std::unique_ptr< constitutive::ConstitutiveBase > fluidSeparatorPtr ) { m_fluidSeparatorPtr = std::move( fluidSeparatorPtr );}
405 constitutive::MultiFluidBase &
getMultiFluidSeparator() {
return dynamicCast< constitutive::MultiFluidBase & >( *m_fluidSeparatorPtr ); }
411 constitutive::SingleFluidBase &
getSingleFluidSeparator() {
return dynamicCast< constitutive::SingleFluidBase & >( *m_fluidSeparatorPtr ); }
459 static constexpr
char const *
refElevString() {
return "referenceElevation"; }
461 static constexpr
char const *
typeString() {
return "type"; }
515 template<
typename Constra
intType >
void createConstraint (
string const & constraintName );
523 MaximumBHPConstraint * getMaxBHPConstraint() {
return m_maxBHPConstraint; };
524 MaximumBHPConstraint * getMaxBHPConstraint()
const {
return m_maxBHPConstraint; };
526 std::vector< WellConstraintBase * > getProdRateConstraints() {
return m_productionRateConstraintList; };
527 std::vector< WellConstraintBase * > getProdRateConstraints()
const {
return m_productionRateConstraintList; };
528 std::vector< WellConstraintBase * > getInjRateConstraints() {
return m_injectionRateConstraintList; }
529 std::vector< WellConstraintBase * > getInjRateConstraints()
const {
return m_injectionRateConstraintList; }
551 integer m_useSurfaceConditions;
554 std::unique_ptr< constitutive::ConstitutiveBase > m_fluidSeparatorPtr;
557 string m_referenceReservoirRegion;
567 string m_statusTableName;
570 string m_perfStatusTableName;
576 real64 m_initialPressureCoefficient;
593 bool m_constraintSwitch;
603 std::vector< WellConstraintBase * > m_productionRateConstraintList;
604 std::vector< WellConstraintBase * > m_injectionRateConstraintList;
612 real64 m_regionAveragePressure;
615 real64 m_regionAverageTemperature;
This class describes a minimum pressure constraint used to control a injection well.
This class describes the controls used to operate a well.
~WellControls() override
Default destructor.
integer estimateSolution() const
getter for esitmator switch
void setWellStatus(real64 const ¤tTime, WellControls::Status status)
Set well status from time and internal action, eg. all perfs closed.
bool isProducer() const
Is the well a producer?
virtual void postInputInitialization() override
WellControls & operator=(WellControls &&)=delete
Deleted move operator.
real64 getRegionAverageTemperature() const
Getter for the reservoir average temperature when m_useSurfaceConditions == 0.
void createConstraint(string const &constraintName)
Create a constraint.
string referenceReservoirRegion() const
Getter for the reservoir region associated with reservoir volume constraint.
Control getControl() const
Get the control type for the well.
void setNextDtFromTables(real64 const ¤tTime, real64 &nextDt)
set next time step based on tables intervals
struct geos::WellControls::viewKeyStruct viewKeysWellControls
ViewKey struct for the WellControls class.
bool isInjector() const
Is the well an injector?
real64 getReferenceElevation() const
Return the reference elvation where pressure constraint is measured.
WellControls::Status getWellStatus() const
Is the well open (or shut) based on internal action.
WellControls(WellControls &&)=delete
Deleted move constructor.
real64 getRegionAveragePressure() const
Getter for the reservoir average pressure when m_useSurfaceConditions == 0.
integer useSurfaceConditions() const
Getter for the flag specifying whether we check rates at surface or reservoir conditions.
void setReferenceGravityCoef(real64 const &refGravCoef)
Setter for the reference gravity.
void setFluidSeparator(std::unique_ptr< constitutive::ConstitutiveBase > fluidSeparatorPtr)
setter for multi fluid separator
WellControls(string const &name, dataRepository::Group *const parent)
Constructor for WellControls Objects.
void setRegionAverageTemperature(real64 regionAverageTemperature)
Set the reservoir average temperature when m_useSurfaceConditions == 0.
void setControl(Control const &newControl)
Set the control type for the well.
WellControls(WellControls const &)=delete
Deleted copy constructor.
WellControls & operator=(WellControls const &)=delete
Deleted assignment operator.
void forInjectionConstraints(LAMBDA &&lambda) const
constitutive::SingleFluidBase & getSingleFluidSeparator()
Getter for single fluid separator.
virtual void expandObjectCatalogs() override
Expand catalog for schema generation.
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new geometric object (box, plane, etc) as a child of this group.
void forProductionConstraints(LAMBDA &&lambda) const
real64 getTargetBHP(real64 const &targetTime) const
Returns the target bottom hole pressure value.
bool isCrossflowEnabled() const
Getter for the flag to enable crossflow.
integer getConstraintPhaseIndex() const
Const accessor for the phase constraint index.
WellControls()=delete
Deleted default constructor.
MinimumBHPConstraint * getMinBHPConstraint()
Getters for constraints.
bool isWellOpen() const
Is the well open (or shut) at currentTime, status initalized in WellSolverBase::implicitStepSetup.
const real64 & getSurfaceTemperature() const
Getter for the surface temperature when m_useSurfaceConditions == 1.
arrayView1d< real64 const > getInjectionStream() const
Const accessor for the injection stream.
real64 getReferenceGravityCoef() const
Getter for the reference gravity coefficient.
static bool applyLambdaToContainer(CONTAINERTYPE container, LAMBDA &&lambda)
Apply a given functor to a container if the container can be cast to one of the specified types.
real64 getInitialPressureCoefficient() const
Getter for the initial pressure coefficient.
const real64 & getSurfacePressure() const
Getter for the surface pressure when m_useSurfaceConditions == 1.
constitutive::MultiFluidBase & getMultiFluidSeparator()
Getter for multi fluid separator.
real64 getInjectionTemperature() const
Const accessor for the temperature of the injection stream.
void setRegionAveragePressure(real64 regionAveragePressure)
Set the reservoir average pressure when m_useSurfaceConditions == 0.
Group()=delete
Deleted default constructor.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
double real64
64-bit floating point type.
int integer
Signed integer type.
ENUM_STRINGS(LinearSolverParameters::SolverType, "direct", "cg", "gmres", "fgmres", "bicgstab", "richardson", "preconditioner")
Declare strings associated with enumeration values.
Struct to serve as a container for variable strings and keys.
static constexpr char const * initialPressureCoefficientString()
string key for the initial pressure coefficient
static constexpr char const * phaseProductionConstraintString()
string key for the maximum phase rate for a producer
static constexpr char const * totalVolInjectionConstraintString()
string key for the maximum volume rate for a injector
static constexpr char const * useSurfaceConditionsString()
String key for checking the rates at surface conditions.
static constexpr char const * perfStatusTableNameString()
string key for perforation status table name
static constexpr char const * maximumBHPConstraintString()
string key for the maximum BHP presssure for a injection
static constexpr char const * refElevString()
String key for the well reference elevation (for BHP control)
static constexpr char const * minimumBHPConstraintString()
string key for the minimum BHP presssure for a producer
static constexpr char const * enableCrossflowString()
string key for the crossflow flag
static constexpr char const * totalVolProductionConstraintString()
string key for the maximum volume rate for a producer
static constexpr char const * referenceReservoirRegionString()
String key for reference reservoir region.
static constexpr char const * phaseInjectionConstraintString()
string key for the maximum phase rate for a injection
static constexpr char const * surfaceTemperatureString()
String key for the surface temperature.
static constexpr char const * statusTableNameString()
string key for status table name
static constexpr char const * massProductionConstraintString()
string key for the maximum mass rate for a producer
static constexpr char const * surfacePressureString()
String key for the surface pressure.
static constexpr char const * estimateWellSolutionString()
string key for the esitmate well solution flag
static constexpr char const * typeString()
String key for the well type.
static constexpr char const * massInjectionConstraintString()
string key for the maximum mass rate for a injector
static constexpr char const * liquidProductionConstraintString()
string key for the liquid rate for a producer
static constexpr char const * currentControlString()
String key for the well current control.