mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
froze wellState at nupcol iterations
This commit is contained in:
parent
f03c4004b3
commit
df6774c45c
@ -256,6 +256,7 @@ namespace Opm {
|
|||||||
|
|
||||||
WellState well_state_;
|
WellState well_state_;
|
||||||
WellState previous_well_state_;
|
WellState previous_well_state_;
|
||||||
|
WellState well_state_nupcol_;
|
||||||
|
|
||||||
const ModelParameters param_;
|
const ModelParameters param_;
|
||||||
bool terminal_output_;
|
bool terminal_output_;
|
||||||
|
@ -391,14 +391,6 @@ namespace Opm {
|
|||||||
: 0.0;
|
: 0.0;
|
||||||
guideRate_->compute(well->name(), reportStepIdx, simulationTime, oilpot, gaspot, waterpot);
|
guideRate_->compute(well->name(), reportStepIdx, simulationTime, oilpot, gaspot, waterpot);
|
||||||
}
|
}
|
||||||
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
|
|
||||||
std::vector<double> pot(numPhases(), 0.0);
|
|
||||||
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ false, well_state_, guideRate_.get(), pot);
|
|
||||||
std::vector<double> potInj(numPhases(), 0.0);
|
|
||||||
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ true, well_state_, guideRate_.get(), potInj);
|
|
||||||
|
|
||||||
// compute wsolvent fraction for REIN wells
|
|
||||||
updateWsolvent(fieldGroup, schedule(), reportStepIdx, well_state_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -853,20 +845,6 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
updateWellControls(local_deferredLogger, /*allow for switching to group controls*/true);
|
updateWellControls(local_deferredLogger, /*allow for switching to group controls*/true);
|
||||||
|
|
||||||
// only update REIN and VREP rates if iterationIdx is smaller than nupcol
|
|
||||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
|
||||||
const int nupcol = schedule().getNupcol(reportStepIdx);
|
|
||||||
if (iterationIdx < nupcol) {
|
|
||||||
if( localWellsActive() ) {
|
|
||||||
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
|
|
||||||
std::vector<double> rein(numPhases(), 0.0);
|
|
||||||
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
|
||||||
wellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState, well_state_, rein);
|
|
||||||
double resv = 0.0;
|
|
||||||
wellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_, resv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the well primary variables based on the value of well solutions
|
// Set the well primary variables based on the value of well solutions
|
||||||
initPrimaryVariablesEvaluation();
|
initPrimaryVariablesEvaluation();
|
||||||
|
|
||||||
@ -1199,13 +1177,19 @@ namespace Opm {
|
|||||||
well->updateWellControl(ebosSimulator_, well_state_, deferred_logger);
|
well->updateWellControl(ebosSimulator_, well_state_, deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int nupcol = schedule().getNupcol(reportStepIdx);
|
||||||
|
const int iterationIdx = ebosSimulator_.model().newtonMethod().numIterations();
|
||||||
|
if (iterationIdx < nupcol) {
|
||||||
|
well_state_nupcol_ = well_state_;
|
||||||
|
}
|
||||||
|
|
||||||
// the group target reduction rates needs to be update since wells may have swicthed to/from GRUP control
|
// the group target reduction rates needs to be update since wells may have swicthed to/from GRUP control
|
||||||
// Currently the group targer reduction does not honor NUPCOL
|
// Currently the group targer reduction does not honor NUPCOL
|
||||||
if( localWellsActive() ) {
|
if( localWellsActive() ) {
|
||||||
std::vector<double> groupTargetReduction(numPhases(), 0.0);
|
std::vector<double> groupTargetReduction(numPhases(), 0.0);
|
||||||
wellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ false, well_state_, groupTargetReduction);
|
wellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ false, well_state_nupcol_, well_state_, groupTargetReduction);
|
||||||
std::vector<double> groupTargetReductionInj(numPhases(), 0.0);
|
std::vector<double> groupTargetReductionInj(numPhases(), 0.0);
|
||||||
wellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ true, well_state_, groupTargetReductionInj);
|
wellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ true, well_state_nupcol_, well_state_, groupTargetReductionInj);
|
||||||
}
|
}
|
||||||
|
|
||||||
const double simulationTime = ebosSimulator_.time();
|
const double simulationTime = ebosSimulator_.time();
|
||||||
@ -1213,6 +1197,18 @@ namespace Opm {
|
|||||||
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ false, well_state_, guideRate_.get(), pot);
|
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ false, well_state_, guideRate_.get(), pot);
|
||||||
std::vector<double> potInj(numPhases(), 0.0);
|
std::vector<double> potInj(numPhases(), 0.0);
|
||||||
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ true, well_state_, guideRate_.get(), potInj);
|
wellGroupHelpers::updateGuideRateForGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, /*isInjector*/ true, well_state_, guideRate_.get(), potInj);
|
||||||
|
|
||||||
|
if( localWellsActive() ) {
|
||||||
|
std::vector<double> rein(numPhases(), 0.0);
|
||||||
|
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||||
|
wellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState, well_state_nupcol_, well_state_, rein);
|
||||||
|
double resv = 0.0;
|
||||||
|
wellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_, well_state_, resv);
|
||||||
|
}
|
||||||
|
|
||||||
|
// compute wsolvent fraction for REIN wells
|
||||||
|
updateWsolvent(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,20 +226,20 @@ namespace Opm {
|
|||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void updateGroupTargetReduction(const Group& group, const Schedule& schedule, const int reportStepIdx, const bool isInjector, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& groupTargetReduction)
|
inline void updateGroupTargetReduction(const Group& group, const Schedule& schedule, const int reportStepIdx, const bool isInjector, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& groupTargetReduction)
|
||||||
{
|
{
|
||||||
const int np = wellState.numPhases();
|
const int np = wellState.numPhases();
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
std::vector<double> thisGroupTargetReduction(np, 0.0);
|
std::vector<double> thisGroupTargetReduction(np, 0.0);
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
updateGroupTargetReduction(groupTmp, schedule, reportStepIdx, isInjector, wellState, thisGroupTargetReduction);
|
updateGroupTargetReduction(groupTmp, schedule, reportStepIdx, isInjector, wellStateNupcol, wellState, thisGroupTargetReduction);
|
||||||
|
|
||||||
// accumulate group contribution from sub group
|
// accumulate group contribution from sub group
|
||||||
if (isInjector) {
|
if (isInjector) {
|
||||||
const Group::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(groupName);
|
const Group::InjectionCMode& currentGroupControl = wellState.currentInjectionGroupControl(groupName);
|
||||||
if (currentGroupControl != Group::InjectionCMode::FLD) {
|
if (currentGroupControl != Group::InjectionCMode::FLD) {
|
||||||
for (int phase = 0; phase < np; phase++) {
|
for (int phase = 0; phase < np; phase++) {
|
||||||
groupTargetReduction[phase] += sumWellRates(groupTmp, schedule, wellState, reportStepIdx, phase, isInjector);
|
groupTargetReduction[phase] += sumWellRates(groupTmp, schedule, wellStateNupcol, reportStepIdx, phase, isInjector);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ namespace Opm {
|
|||||||
const Group::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName);
|
const Group::ProductionCMode& currentGroupControl = wellState.currentProductionGroupControl(groupName);
|
||||||
if (currentGroupControl != Group::ProductionCMode::FLD) {
|
if (currentGroupControl != Group::ProductionCMode::FLD) {
|
||||||
for (int phase = 0; phase < np; phase++) {
|
for (int phase = 0; phase < np; phase++) {
|
||||||
groupTargetReduction[phase] += sumWellRates(groupTmp, schedule, wellState, reportStepIdx, phase, isInjector);
|
groupTargetReduction[phase] += sumWellRates(groupTmp, schedule, wellStateNupcol, reportStepIdx, phase, isInjector);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -280,12 +280,12 @@ namespace Opm {
|
|||||||
if (isInjector) {
|
if (isInjector) {
|
||||||
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP)
|
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP)
|
||||||
for (int phase = 0; phase < np; phase++) {
|
for (int phase = 0; phase < np; phase++) {
|
||||||
groupTargetReduction[phase] += wellState.wellRates()[wellrate_index + phase];
|
groupTargetReduction[phase] += wellStateNupcol.wellRates()[wellrate_index + phase];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (wellState.currentProductionControls()[well_index] != Well::ProducerCMode::GRUP)
|
if (wellState.currentProductionControls()[well_index] != Well::ProducerCMode::GRUP)
|
||||||
for (int phase = 0; phase < np; phase++) {
|
for (int phase = 0; phase < np; phase++) {
|
||||||
groupTargetReduction[phase] -= wellState.wellRates()[wellrate_index + phase];
|
groupTargetReduction[phase] -= wellStateNupcol.wellRates()[wellrate_index + phase];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,34 +371,33 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState, double& resv) {
|
||||||
inline void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, WellStateFullyImplicitBlackoil& wellState, double& resv) {
|
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
double thisResv = 0.0;
|
double thisResv = 0.0;
|
||||||
updateVREPForGroups(groupTmp, schedule, reportStepIdx, wellState, thisResv);
|
updateVREPForGroups(groupTmp, schedule, reportStepIdx, wellStateNupcol, wellState, thisResv);
|
||||||
resv += thisResv;
|
resv += thisResv;
|
||||||
}
|
}
|
||||||
const int np = wellState.numPhases();
|
const int np = wellState.numPhases();
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
resv += sumWellPhaseRates(wellState.wellReservoirRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false);
|
resv += sumWellPhaseRates(wellStateNupcol.wellReservoirRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
wellState.setCurrentInjectionVREPRates(group.name(), resv);
|
wellState.setCurrentInjectionVREPRates(group.name(), resv);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void updateREINForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const PhaseUsage& pu, const SummaryState& st, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& rein) {
|
inline void updateREINForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, const PhaseUsage& pu, const SummaryState& st, const WellStateFullyImplicitBlackoil& wellStateNupcol, WellStateFullyImplicitBlackoil& wellState, std::vector<double>& rein) {
|
||||||
const int np = wellState.numPhases();
|
const int np = wellState.numPhases();
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
std::vector<double> thisRein(np, 0.0);
|
std::vector<double> thisRein(np, 0.0);
|
||||||
updateREINForGroups(groupTmp, schedule, reportStepIdx, pu, st, wellState, thisRein);
|
updateREINForGroups(groupTmp, schedule, reportStepIdx, pu, st, wellStateNupcol, wellState, thisRein);
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
rein[phase] = thisRein[phase];
|
rein[phase] = thisRein[phase];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
rein[phase] = sumWellPhaseRates(wellState.wellRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false);
|
rein[phase] = sumWellPhaseRates(wellStateNupcol.wellRates(), group, schedule, wellState, reportStepIdx, phase, /*isInjector*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add import rate and substract consumption rate for group for gas
|
// add import rate and substract consumption rate for group for gas
|
||||||
|
Loading…
Reference in New Issue
Block a user