diff --git a/opm/core/simulator/WellState.hpp b/opm/core/simulator/WellState.hpp index 6e554e64c..95f037bed 100644 --- a/opm/core/simulator/WellState.hpp +++ b/opm/core/simulator/WellState.hpp @@ -60,7 +60,8 @@ namespace Opm // 2. Assign bhp equal to bhp control, if // applicable, otherwise assign equal to // first perforation cell pressure. - // thp set to thp control + // Similarly set thp to thp control, or + // -1e100 if not applicable switch (well_controls_get_current_type(ctrl)) { case BHP: bhp_[w] = well_controls_get_current_target( ctrl ); @@ -72,6 +73,7 @@ namespace Opm { const int first_cell = wells->well_cells[wells->well_connpos[w]]; bhp_[w] = state.pressure()[first_cell]; + thp_[w] = -1e100; } } } else { @@ -100,12 +102,24 @@ namespace Opm // little above or below (depending on if // the well is an injector or producer) // pressure in first perforation cell. - if (well_controls_get_current_type(ctrl) == BHP) { - bhp_[w] = well_controls_get_current_target( ctrl ); - } else { - const int first_cell = wells->well_cells[wells->well_connpos[w]]; - const double safety_factor = (wells->type[w] == INJECTOR) ? 1.01 : 0.99; - bhp_[w] = safety_factor*state.pressure()[first_cell]; + switch (well_controls_get_current_type(ctrl)) { + case BHP: + bhp_[w] = well_controls_get_current_target( ctrl ); + thp_[w] = -1e100; + break; + + case THP: + bhp_[w] = -1e100; + thp_[w] = well_controls_get_current_target( ctrl ); + break; + + default: + { + const int first_cell = wells->well_cells[wells->well_connpos[w]]; + const double safety_factor = (wells->type[w] == INJECTOR) ? 1.01 : 0.99; + bhp_[w] = safety_factor*state.pressure()[first_cell]; + thp_[w] = -1e100; + } } } } diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index cf0c0ca52..73f25ed9a 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -678,6 +678,11 @@ namespace Opm break; } + case THP: { + //TODO: Implement support + OPM_THROW(std::invalid_argument, "THP not implemented in WellNode::conditionsMet."); + } + case RESERVOIR_RATE: { double my_rate = 0.0; const double * ctrls_distr = well_controls_iget_distr( ctrls , ctrl_index );