adding wellHasTHPConstraints() to decide if there is THP control

for a specific well.
This commit is contained in:
Kai Bao
2017-03-31 12:52:44 +02:00
parent 86dc231cc3
commit 7b2e6760e1
2 changed files with 26 additions and 0 deletions

View File

@@ -1739,6 +1739,11 @@ namespace Opm {
well_potentials.resize(nw * np, 0.0);
for (int w = 0; w < nw; ++w) {
bool is_thp_determined = wellHasTHPConstraints(w);
if (!is_thp_determined) {
// bhp needs to be determined for the well potential calculation
// There can be more than one BHP/THP constraints.
// TODO: there is an option to ignore the THP limit when calculating well potentials,
@@ -2751,4 +2756,23 @@ namespace Opm {
}
template<typename FluidSystem, typename BlackoilIndices>
bool
StandardWellsDense<FluidSystem, BlackoilIndices>::
wellHasTHPConstraints(const int well_index) const
{
const WellType& well_type = wells().type[well_index];
const WellControls* well_control = wells().ctrls[well_index];
const int nwc = well_controls_get_num(well_control);
for (int ctrl_index = 0; ctrl_index < nwc; ++ctrl_index) {
if (well_controls_iget_type(well_control, ctrl_index) == THP) {
return true;
}
}
return false;
}
} // namespace Opm