mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add temperature to SingleWellState
This commit is contained in:
@@ -175,7 +175,7 @@ loadRestartData(const data::Wells& rst_wells,
|
|||||||
auto& ws = well_state.well(well_index);
|
auto& ws = well_state.well(well_index);
|
||||||
ws.bhp = rst_well.bhp;
|
ws.bhp = rst_well.bhp;
|
||||||
ws.thp = rst_well.thp;
|
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) {
|
if (rst_well.current_control.isProducer) {
|
||||||
well_state.currentProductionControl(well_index, rst_well.current_control.prod);
|
well_state.currentProductionControl(well_index, rst_well.current_control.prod);
|
||||||
|
|||||||
@@ -1732,7 +1732,7 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
weighted_temperature = well_info.communication().sum(weighted_temperature);
|
weighted_temperature = well_info.communication().sum(weighted_temperature);
|
||||||
total_weight = well_info.communication().sum(total_weight);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
SingleWellState::SingleWellState(bool is_producer)
|
SingleWellState::SingleWellState(bool is_producer, double temp)
|
||||||
: producer(is_producer)
|
: producer(is_producer)
|
||||||
|
, temperature(temp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ void SingleWellState::init_timestep(const SingleWellState& other) {
|
|||||||
|
|
||||||
this->bhp = other.bhp;
|
this->bhp = other.bhp;
|
||||||
this->thp = other.thp;
|
this->thp = other.thp;
|
||||||
|
this->temperature = other.temperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,13 @@ namespace Opm {
|
|||||||
|
|
||||||
class SingleWellState {
|
class SingleWellState {
|
||||||
public:
|
public:
|
||||||
explicit SingleWellState(bool is_producer);
|
SingleWellState(bool is_producer, double temp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool producer;
|
bool producer;
|
||||||
double bhp{0};
|
double bhp{0};
|
||||||
double thp{0};
|
double thp{0};
|
||||||
|
double temperature{};
|
||||||
|
|
||||||
void init_timestep(const SingleWellState& other);
|
void init_timestep(const SingleWellState& other);
|
||||||
void shut();
|
void shut();
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
|||||||
this->status_.clear();
|
this->status_.clear();
|
||||||
this->parallel_well_info_.clear();
|
this->parallel_well_info_.clear();
|
||||||
this->wellrates_.clear();
|
this->wellrates_.clear();
|
||||||
this->temperature_.clear();
|
|
||||||
this->segment_state.clear();
|
this->segment_state.clear();
|
||||||
this->well_potentials_.clear();
|
this->well_potentials_.clear();
|
||||||
this->productivity_index_.clear();
|
this->productivity_index_.clear();
|
||||||
@@ -90,8 +89,9 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
|
|||||||
// May be overwritten below.
|
// May be overwritten below.
|
||||||
const auto& pu = this->phase_usage_;
|
const auto& pu = this->phase_usage_;
|
||||||
const int np = pu.num_phases;
|
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->status_.add(well.name(), Well::Status::OPEN);
|
||||||
this->parallel_well_info_.add(well.name(), well_info);
|
this->parallel_well_info_.add(well.name(), well_info);
|
||||||
this->wellrates_.add(well.name(), std::vector<double>(np, 0));
|
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->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->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));
|
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 )
|
if ( num_perf_this_well == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -513,7 +509,7 @@ WellState::report(const int* globalCellIdxMap,
|
|||||||
data::Well well;
|
data::Well well;
|
||||||
well.bhp = ws.bhp;
|
well.bhp = ws.bhp;
|
||||||
well.thp = ws.thp;
|
well.thp = ws.thp;
|
||||||
well.temperature = this->temperature( well_index );
|
well.temperature = ws.temperature;
|
||||||
|
|
||||||
if( pu.phase_used[BlackoilPhases::Aqua] ) {
|
if( pu.phase_used[BlackoilPhases::Aqua] ) {
|
||||||
well.rates.set(rt::wat, wv[ pu.phase_pos[BlackoilPhases::Aqua] ] );
|
well.rates.set(rt::wat, wv[ pu.phase_pos[BlackoilPhases::Aqua] ] );
|
||||||
|
|||||||
@@ -310,10 +310,6 @@ public:
|
|||||||
return this->phase_usage_;
|
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.
|
/// One rate per well and phase.
|
||||||
const WellContainer<std::vector<double>>& wellRates() const { return wellrates_; }
|
const WellContainer<std::vector<double>>& wellRates() const { return wellrates_; }
|
||||||
std::vector<double>& wellRates(std::size_t well_index) { return wellrates_[well_index]; }
|
std::vector<double>& wellRates(std::size_t well_index) { return wellrates_[well_index]; }
|
||||||
@@ -371,7 +367,6 @@ private:
|
|||||||
WellContainer<SingleWellState> wells_;
|
WellContainer<SingleWellState> wells_;
|
||||||
WellContainer<Well::Status> status_;
|
WellContainer<Well::Status> status_;
|
||||||
WellContainer<const ParallelWellInfo*> parallel_well_info_;
|
WellContainer<const ParallelWellInfo*> parallel_well_info_;
|
||||||
WellContainer<double> temperature_;
|
|
||||||
WellContainer<std::vector<double>> wellrates_;
|
WellContainer<std::vector<double>> wellrates_;
|
||||||
PhaseUsage phase_usage_;
|
PhaseUsage phase_usage_;
|
||||||
WellContainer<PerfData> perfdata;
|
WellContainer<PerfData> perfdata;
|
||||||
|
|||||||
@@ -577,9 +577,9 @@ GAS
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(TestSingleWellState) {
|
BOOST_AUTO_TEST_CASE(TestSingleWellState) {
|
||||||
Opm::SingleWellState ws1(true);
|
Opm::SingleWellState ws1(true, 1);
|
||||||
Opm::SingleWellState ws2(true);
|
Opm::SingleWellState ws2(true, 2);
|
||||||
Opm::SingleWellState ws3(false);
|
Opm::SingleWellState ws3(false, 3);
|
||||||
|
|
||||||
ws1.bhp = 100;
|
ws1.bhp = 100;
|
||||||
ws1.thp = 200;
|
ws1.thp = 200;
|
||||||
|
|||||||
Reference in New Issue
Block a user