mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adding two THP control related fucntions to WellInterface
getTHPConstraint() and getTHPControlIndex();
This commit is contained in:
parent
01efbc639c
commit
eeae6aa4fc
@ -316,6 +316,10 @@ namespace Opm
|
|||||||
|
|
||||||
bool wellHasTHPConstraints() const;
|
bool wellHasTHPConstraints() const;
|
||||||
|
|
||||||
|
double getTHPConstraint() const;
|
||||||
|
|
||||||
|
int getTHPControlIndex() const;
|
||||||
|
|
||||||
// Component fractions for each phase for the well
|
// Component fractions for each phase for the well
|
||||||
const std::vector<double>& compFrac() const;
|
const std::vector<double>& compFrac() const;
|
||||||
|
|
||||||
|
@ -364,18 +364,48 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
bool
|
bool
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wellHasTHPConstraints() const
|
wellHasTHPConstraints() const
|
||||||
|
{
|
||||||
|
return getTHPControlIndex() >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
double
|
||||||
|
WellInterface<TypeTag>::
|
||||||
|
getTHPConstraint() const
|
||||||
|
{
|
||||||
|
const int thp_control_index = getTHPControlIndex();
|
||||||
|
|
||||||
|
if (thp_control_index < 0) {
|
||||||
|
OPM_THROW(std::runtime_error, " there is no THP constraint/limit for well " << name()
|
||||||
|
<< ", while we are requesting it ");
|
||||||
|
}
|
||||||
|
|
||||||
|
return well_controls_iget_target(well_controls_, thp_control_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
int
|
||||||
|
WellInterface<TypeTag>::
|
||||||
|
getTHPControlIndex() const
|
||||||
{
|
{
|
||||||
const int nwc = well_controls_get_num(well_controls_);
|
const int nwc = well_controls_get_num(well_controls_);
|
||||||
for (int ctrl_index = 0; ctrl_index < nwc; ++ctrl_index) {
|
for (int ctrl_index = 0; ctrl_index < nwc; ++ctrl_index) {
|
||||||
if (well_controls_iget_type(well_controls_, ctrl_index) == THP) {
|
if (well_controls_iget_type(well_controls_, ctrl_index) == THP) {
|
||||||
return true;
|
return ctrl_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user