Add temperature to SingleWellState

This commit is contained in:
Joakim Hove 2021-08-03 21:25:03 +02:00
parent 1dd9b91ad3
commit d5ab308fbd
7 changed files with 13 additions and 21 deletions

View File

@ -175,7 +175,7 @@ loadRestartData(const data::Wells& rst_wells,
auto& ws = well_state.well(well_index);
ws.bhp = rst_well.bhp;
ws.thp = rst_well.thp;
well_state.update_temperature(well_index, rst_well.temperature);
ws.temperature = rst_well.temperature;
if (rst_well.current_control.isProducer) {
well_state.currentProductionControl(well_index, rst_well.current_control.prod);

View File

@ -1732,7 +1732,7 @@ namespace Opm {
}
weighted_temperature = well_info.communication().sum(weighted_temperature);
total_weight = well_info.communication().sum(total_weight);
this->wellState().update_temperature(wellID, weighted_temperature/total_weight);
this->wellState().well(wellID).temperature = weighted_temperature/total_weight;
}
}

View File

@ -21,8 +21,9 @@
namespace Opm {
SingleWellState::SingleWellState(bool is_producer)
SingleWellState::SingleWellState(bool is_producer, double temp)
: producer(is_producer)
, temperature(temp)
{}
@ -32,6 +33,7 @@ void SingleWellState::init_timestep(const SingleWellState& other) {
this->bhp = other.bhp;
this->thp = other.thp;
this->temperature = other.temperature;
}

View File

@ -25,14 +25,13 @@ namespace Opm {
class SingleWellState {
public:
explicit SingleWellState(bool is_producer);
SingleWellState(bool is_producer, double temp);
bool producer;
double bhp{0};
double thp{0};
double temperature{};
void init_timestep(const SingleWellState& other);
void shut();

View File

@ -44,7 +44,6 @@ void WellState::base_init(const std::vector<double>& cellPressures,
this->status_.clear();
this->parallel_well_info_.clear();
this->wellrates_.clear();
this->temperature_.clear();
this->segment_state.clear();
this->well_potentials_.clear();
this->productivity_index_.clear();
@ -90,8 +89,9 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
// May be overwritten below.
const auto& pu = this->phase_usage_;
const int np = pu.num_phases;
double temp = well.isInjector() ? well.injectionControls(summary_state).temperature : 273.15 + 15.56;
auto& ws = this->wells_.add(well.name(), SingleWellState{well.isProducer()});
auto& ws = this->wells_.add(well.name(), SingleWellState{well.isProducer(), temp});
this->status_.add(well.name(), Well::Status::OPEN);
this->parallel_well_info_.add(well.name(), well_info);
this->wellrates_.add(well.name(), std::vector<double>(np, 0));
@ -100,10 +100,6 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
this->segment_state.add(well.name(), SegmentState{});
this->perfdata.add(well.name(), PerfData{static_cast<std::size_t>(num_perf_this_well), well.isInjector(), this->phase_usage_});
this->productivity_index_.add(well.name(), std::vector<double>(np, 0));
if ( well.isInjector() )
this->temperature_.add(well.name(), well.injectionControls(summary_state).temperature);
else
this->temperature_.add(well.name(), 273.15 + 15.56); // standard condition temperature
if ( num_perf_this_well == 0 )
return;
@ -513,7 +509,7 @@ WellState::report(const int* globalCellIdxMap,
data::Well well;
well.bhp = ws.bhp;
well.thp = ws.thp;
well.temperature = this->temperature( well_index );
well.temperature = ws.temperature;
if( pu.phase_used[BlackoilPhases::Aqua] ) {
well.rates.set(rt::wat, wv[ pu.phase_pos[BlackoilPhases::Aqua] ] );

View File

@ -310,10 +310,6 @@ public:
return this->phase_usage_;
}
/// One temperature per well.
void update_temperature(std::size_t well_index, double value) { temperature_[well_index] = value; }
double temperature(std::size_t well_index) const { return temperature_[well_index]; }
/// One rate per well and phase.
const WellContainer<std::vector<double>>& wellRates() const { return wellrates_; }
std::vector<double>& wellRates(std::size_t well_index) { return wellrates_[well_index]; }
@ -371,7 +367,6 @@ private:
WellContainer<SingleWellState> wells_;
WellContainer<Well::Status> status_;
WellContainer<const ParallelWellInfo*> parallel_well_info_;
WellContainer<double> temperature_;
WellContainer<std::vector<double>> wellrates_;
PhaseUsage phase_usage_;
WellContainer<PerfData> perfdata;

View File

@ -577,9 +577,9 @@ GAS
BOOST_AUTO_TEST_CASE(TestSingleWellState) {
Opm::SingleWellState ws1(true);
Opm::SingleWellState ws2(true);
Opm::SingleWellState ws3(false);
Opm::SingleWellState ws1(true, 1);
Opm::SingleWellState ws2(true, 2);
Opm::SingleWellState ws3(false, 3);
ws1.bhp = 100;
ws1.thp = 200;