throw if temperature() is called for non-injectors
This commit is contained in:
parent
4bdf1091e8
commit
0a778c6e19
@ -1654,8 +1654,8 @@ Well{0} entered with disallowed 'FIELD' parent group:
|
||||
|
||||
for (const auto& well_name : well_names) {
|
||||
const auto& well = this->getWell(well_name, handlerContext.currentStep);
|
||||
const double current_temp = well.temperature();
|
||||
if (current_temp != temp && !well.isProducer()) {
|
||||
const double current_temp = !well.isProducer()? well.temperature(): 0.0;
|
||||
if (current_temp != temp) {
|
||||
auto well2 = this->snapshots.back().wells( well_name );
|
||||
well2.setWellTemperature(temp);
|
||||
this->snapshots.back().wells.update( std::move(well2) );
|
||||
@ -1976,7 +1976,7 @@ Well{0} entered with disallowed 'FIELD' parent group:
|
||||
|
||||
for (const auto& well_name : well_names) {
|
||||
const auto& well = this->getWell(well_name, handlerContext.currentStep);
|
||||
const double current_temp = well.temperature();
|
||||
const double current_temp = !well.isProducer()? well.temperature(): 0.0;
|
||||
if (current_temp != temp) {
|
||||
auto well2 = this->snapshots.back().wells( well_name );
|
||||
well2.setWellTemperature(temp);
|
||||
|
@ -1533,7 +1533,10 @@ double Well::alq_value() const {
|
||||
}
|
||||
|
||||
double Well::temperature() const {
|
||||
return this->well_temperature;
|
||||
if (!this->wtype.producer())
|
||||
return this->well_temperature;
|
||||
|
||||
throw std::runtime_error("Can only ask for temperature in an injector");
|
||||
}
|
||||
void Well::setWellTemperature(const double temp) {
|
||||
this->well_temperature = temp;
|
||||
@ -1812,7 +1815,7 @@ bool Well::operator==(const Well& data) const {
|
||||
&& (this->getProductionProperties() == data.getProductionProperties())
|
||||
&& (this->m_pavg == data.m_pavg)
|
||||
&& (this->getInjectionProperties() == data.getInjectionProperties())
|
||||
&& (this->temperature() == data.temperature())
|
||||
&& (this->well_temperature == data.well_temperature)
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -2248,13 +2248,13 @@ BOOST_AUTO_TEST_CASE(WTEMP_well_template) {
|
||||
Runspec runspec (deck);
|
||||
Schedule schedule( deck, grid, fp, runspec, python);
|
||||
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W1", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W1", 2).temperature(), 1e-5);
|
||||
BOOST_CHECK_THROW(schedule.getWell("W1", 1).temperature(), std::runtime_error);
|
||||
BOOST_CHECK_THROW(schedule.getWell("W1", 2).temperature(), std::runtime_error);
|
||||
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W2", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_THROW(schedule.getWell("W2", 1).temperature(), std::runtime_error);
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W2", 2).temperature(), 1e-5);
|
||||
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W3", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_THROW(schedule.getWell("W3", 1).temperature(), std::runtime_error);
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W3", 2).temperature(), 1e-5);
|
||||
}
|
||||
|
||||
@ -2295,14 +2295,13 @@ BOOST_AUTO_TEST_CASE(WTEMPINJ_well_template) {
|
||||
Runspec runspec (deck);
|
||||
Schedule schedule( deck, grid, fp, runspec, python);
|
||||
|
||||
// Producerwell - currently setting temperature only acts on injectors.
|
||||
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W1", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W1", 2).temperature(), 1e-5);
|
||||
BOOST_CHECK_THROW(schedule.getWell("W1", 1).temperature(), std::runtime_error);
|
||||
BOOST_CHECK_THROW(schedule.getWell("W1", 2).temperature(), std::runtime_error);
|
||||
|
||||
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W2", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W2", 2).temperature(), 1e-5);
|
||||
|
||||
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W3", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W2", 1).temperature(), 1e-5);
|
||||
BOOST_CHECK_CLOSE(313.15, schedule.getWell("W3", 2).temperature(), 1e-5);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user