mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Some clean-up adressing PR comments
This commit is contained in:
parent
5c7cfd8c21
commit
a7f718a368
@ -837,7 +837,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the total rate // TODO: should we have a limitation of the total rate change?
|
// update the total rate // TODO: should we have a limitation of the total rate change?
|
||||||
{
|
{
|
||||||
primary_variables_[seg][GTotal] = old_primary_variables[seg][GTotal] - relaxation_factor * dwells[seg][GTotal];
|
primary_variables_[seg][GTotal] = old_primary_variables[seg][GTotal] - relaxation_factor * dwells[seg][GTotal];
|
||||||
|
|
||||||
// make sure that no injector produce and no producer inject
|
// make sure that no injector produce and no producer inject
|
||||||
@ -1495,7 +1495,6 @@ namespace Opm
|
|||||||
assembleControlEq(Opm::DeferredLogger& deferred_logger) const
|
assembleControlEq(Opm::DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
EvalWell control_eq(0.0);
|
EvalWell control_eq(0.0);
|
||||||
const std::vector<double> g = {1.0, 1.0, 0.01};
|
|
||||||
|
|
||||||
switch (well_controls_get_current_type(well_controls_)) {
|
switch (well_controls_get_current_type(well_controls_)) {
|
||||||
case THP: // not handling this one for now
|
case THP: // not handling this one for now
|
||||||
@ -1510,47 +1509,48 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
case SURFACE_RATE:
|
case SURFACE_RATE:
|
||||||
{
|
{
|
||||||
// finding if it is a single phase control or combined phase control
|
// finding if it is a single phase control or combined phase control
|
||||||
int number_phases_under_control = 0;
|
int number_phases_under_control = 0;
|
||||||
const double* distr = well_controls_get_current_distr(well_controls_);
|
const double* distr = well_controls_get_current_distr(well_controls_);
|
||||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
|
||||||
if (distr[phase] > 0.0) {
|
|
||||||
++number_phases_under_control;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(number_phases_under_control > 0);
|
|
||||||
const double target_rate = well_controls_get_current_target(well_controls_);
|
|
||||||
|
|
||||||
if (well_type_ == INJECTOR) {
|
|
||||||
assert(number_phases_under_control == 1);
|
|
||||||
// only support single component injection
|
|
||||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||||
if (distr[phase] > 0.) { // under the control of this phase
|
if (distr[phase] > 0.0) {
|
||||||
control_eq = getSegmentGTotal(0) - g[phase] * target_rate;
|
++number_phases_under_control;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
assert(number_phases_under_control > 0);
|
||||||
// TODO: the two situations below should be able to be merged to be handled as one situation
|
const double target_rate = well_controls_get_current_target(well_controls_);
|
||||||
if (number_phases_under_control == 1) { // single phase control
|
const std::vector<double> g = {1.0, 1.0, 0.01};
|
||||||
|
|
||||||
|
if (well_type_ == INJECTOR) {
|
||||||
|
assert(number_phases_under_control == 1);
|
||||||
|
// only support single component injection
|
||||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||||
if (distr[phase] > 0.) { // under the control of this phase
|
if (distr[phase] > 0.) { // under the control of this phase
|
||||||
control_eq = getSegmentGTotal(0) * volumeFraction(0, flowPhaseToEbosCompIdx(phase)) - g[phase] * target_rate;
|
control_eq = getSegmentGTotal(0) - g[phase] * target_rate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // multiphase rate control
|
} else {
|
||||||
EvalWell rate_for_control(0.0);
|
// TODO: the two situations below should be able to be merged to be handled as one situation
|
||||||
const EvalWell G_total = getSegmentGTotal(0);
|
if (number_phases_under_control == 1) { // single phase control
|
||||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||||
if (distr[phase] > 0.) {
|
if (distr[phase] > 0.) { // under the control of this phase
|
||||||
rate_for_control += G_total * volumeFractionScaled(0, flowPhaseToEbosCompIdx(phase));
|
control_eq = getSegmentGTotal(0) * volumeFraction(0, flowPhaseToEbosCompIdx(phase)) - g[phase] * target_rate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else { // multiphase rate control
|
||||||
|
EvalWell rate_for_control(0.0);
|
||||||
|
const EvalWell G_total = getSegmentGTotal(0);
|
||||||
|
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||||
|
if (distr[phase] > 0.) {
|
||||||
|
rate_for_control += G_total * volumeFractionScaled(0, flowPhaseToEbosCompIdx(phase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: maybe the following equation can be scaled a little bit for gas phase
|
||||||
|
control_eq = rate_for_control - target_rate;
|
||||||
}
|
}
|
||||||
// TODO: maybe the following equation can be scaled a little bit for gas phase
|
|
||||||
control_eq = rate_for_control - target_rate;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESERVOIR_RATE:
|
case RESERVOIR_RATE:
|
||||||
@ -1569,8 +1569,6 @@ namespace Opm
|
|||||||
default:
|
default:
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Unknown well control control types for well " << name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error, "Unknown well control control types for well " << name(), deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// using control_eq to update the matrix and residuals
|
// using control_eq to update the matrix and residuals
|
||||||
|
|
||||||
resWell_[0][SPres] = control_eq.value();
|
resWell_[0][SPres] = control_eq.value();
|
||||||
@ -2455,16 +2453,9 @@ namespace Opm
|
|||||||
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
||||||
// special treatment is needed for segment 0
|
// special treatment is needed for segment 0
|
||||||
if (seg == 0) {
|
if (seg == 0) {
|
||||||
if ( (well_type_ == INJECTOR)) {
|
// we are not supposed to have injecting producers and producing injectors
|
||||||
// maybe it is safer to return -1 to make sure that we don't return the wrong segment number
|
assert( ! (well_type_ == PRODUCER && primary_variables_evaluation_[seg][GTotal] > 0.) );
|
||||||
// for injectors
|
assert( ! (well_type_ == INJECTOR && primary_variables_evaluation_[seg][GTotal] < 0.) );
|
||||||
upwinding_segments_[seg] = seg;
|
|
||||||
assert(primary_variables_evaluation_[seg][GTotal] >= 0.);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we don't handle injecting producers.
|
|
||||||
assert(primary_variables_evaluation_[seg][GTotal] <= 0.);
|
|
||||||
upwinding_segments_[seg] = seg;
|
upwinding_segments_[seg] = seg;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user