-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cell temperature in perforated cell to compute reservoir rates #5490
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,7 @@ serializationTestObject(const ParallelWellInfo<Scalar>& pinfo) | |
|
||
template<class Scalar> | ||
void WellState<Scalar>::base_init(const std::vector<Scalar>& cellPressures, | ||
const std::vector<Scalar>& cellTemperatures, | ||
const std::vector<Well>& wells_ecl, | ||
const std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>>& parallel_well_info, | ||
const std::vector<std::vector<PerforationData<Scalar>>>& well_perf_data, | ||
|
@@ -164,7 +165,7 @@ void WellState<Scalar>::base_init(const std::vector<Scalar>& cellPressures, | |
const Well& well = wells_ecl[w]; | ||
|
||
// Initialize bhp(), thp(), wellRates(), temperature(). | ||
initSingleWell(cellPressures, well, well_perf_data[w], parallel_well_info[w], summary_state); | ||
initSingleWell(cellPressures, cellTemperatures, well, well_perf_data[w], parallel_well_info[w], summary_state); | ||
} | ||
} | ||
} | ||
|
@@ -202,12 +203,12 @@ template<class Scalar> | |
void WellState<Scalar>::initSingleInjector(const Well& well, | ||
const ParallelWellInfo<Scalar>& well_info, | ||
Scalar pressure_first_connection, | ||
Scalar temperature_first_connection, | ||
const std::vector<PerforationData<Scalar>>& well_perf_data, | ||
const SummaryState& summary_state) | ||
{ | ||
const auto& pu = this->phase_usage_; | ||
const Scalar temp = well.temperature(); | ||
|
||
const Scalar temp = well.hasInjTemperature() ? well.inj_temperature() : temperature_first_connection; | ||
auto& ws = this->wells_.add(well.name(), SingleWellState<Scalar>{well.name(), | ||
well_info, | ||
false, | ||
|
@@ -228,18 +229,25 @@ void WellState<Scalar>::initSingleInjector(const Well& well, | |
|
||
template<class Scalar> | ||
void WellState<Scalar>::initSingleWell(const std::vector<Scalar>& cellPressures, | ||
const std::vector<Scalar>& cellTemperatures, | ||
const Well& well, | ||
const std::vector<PerforationData<Scalar>>& well_perf_data, | ||
const ParallelWellInfo<Scalar>& well_info, | ||
const SummaryState& summary_state) | ||
{ | ||
Scalar pressure_first_connection = -1; | ||
if (!well_perf_data.empty()) | ||
if (!well_perf_data.empty()) { | ||
pressure_first_connection = cellPressures[well_perf_data[0].cell_index]; | ||
} | ||
pressure_first_connection = well_info.broadcastFirstPerforationValue(pressure_first_connection); | ||
|
||
if (well.isInjector()) { | ||
this->initSingleInjector(well, well_info, pressure_first_connection, | ||
Scalar temperature_first_connection = -1; | ||
if (!well_perf_data.empty()) { | ||
temperature_first_connection = cellTemperatures[well_perf_data[0].cell_index]; | ||
} | ||
temperature_first_connection = well_info.broadcastFirstPerforationValue(temperature_first_connection); | ||
this->initSingleInjector(well, well_info, pressure_first_connection, temperature_first_connection, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. temperature related should go to the bracket within if condition |
||
well_perf_data, summary_state); | ||
} else { | ||
this->initSingleProducer(well, well_info, pressure_first_connection, | ||
|
@@ -249,6 +257,7 @@ void WellState<Scalar>::initSingleWell(const std::vector<Scalar>& cellPressures, | |
|
||
template<class Scalar> | ||
void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures, | ||
const std::vector<Scalar>& cellTemperatures, | ||
const Schedule& schedule, | ||
const std::vector<Well>& wells_ecl, | ||
const std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>>& parallel_well_info, | ||
|
@@ -258,7 +267,7 @@ void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures, | |
const SummaryState& summary_state) | ||
{ | ||
// call init on base class | ||
this->base_init(cellPressures, wells_ecl, parallel_well_info, | ||
this->base_init(cellPressures, cellTemperatures, wells_ecl, parallel_well_info, | ||
well_perf_data, summary_state); | ||
this->global_well_info = std::make_optional<GlobalWellInfo>(schedule, | ||
report_step, | ||
|
@@ -428,7 +437,7 @@ void WellState<Scalar>::resize(const std::vector<Well>& wells_ecl, | |
const SummaryState& summary_state) | ||
{ | ||
const std::vector<Scalar> tmp(numCells, 0.0); // <- UGLY HACK to pass the size | ||
init(tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state); | ||
init(tmp, tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state); | ||
|
||
if (handle_ms_well) { | ||
initWellStateMSWell(wells_ecl, nullptr); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,12 @@ namespace { | |
std::vector<double>(setup.grid.c_grid()->number_of_cells, | ||
100.0*Opm::unit::barsa); | ||
|
||
const auto& unit_sytem = setup.es.getDeckUnitSystem(); | ||
const double temp = unit_sytem.to_si(Opm::UnitSystem::measure::temperature, 25); | ||
const auto ctemp = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. although the code above uses const auto& unit_sytem = setup.es.getDeckUnitSystem();
const double temp = unit_sytem.to_si(Opm::UnitSystem::measure::temperature, 25); // 25C |
||
std::vector<double>(setup.grid.c_grid()->number_of_cells, | ||
temp); | ||
|
||
auto wells = setup.sched.getWells(timeStep); | ||
pinfos.resize(wells.size()); | ||
std::vector<std::reference_wrapper<Opm::ParallelWellInfo<double>>> ppinfos; | ||
|
@@ -171,7 +177,7 @@ namespace { | |
++pw; | ||
} | ||
|
||
state.init(cpress, setup.sched, | ||
state.init(cpress, ctemp, setup.sched, | ||
wells, ppinfos, | ||
timeStep, nullptr, setup.well_perf_data, setup.st); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a question here, the code change here mostly alters the situation that
CO2STORE
is active, while thepu.has_enery=false
.With the change in the PR, when CO2STORE is active, we always use the
well bhp and temperature
in the function below.The question is, do we always have an meaningful temperature calculated/set with
CO2STORE
option ON andhas_enery==false
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If well temperature is not set, we use the temperature in the top cell as default.