fixing warnings under simulator/wells

This commit is contained in:
Kai Bao
2019-06-26 09:52:38 +02:00
parent aa06942695
commit 53b15527c2
10 changed files with 36 additions and 48 deletions
+2 -3
View File
@@ -389,7 +389,7 @@ namespace Opm {
void prepareGroupControl(Opm::DeferredLogger& deferred_logger); void prepareGroupControl(Opm::DeferredLogger& deferred_logger);
void computeRESV(const std::size_t step, Opm::DeferredLogger& deferred_logger); void computeRESV(Opm::DeferredLogger& deferred_logger);
void extractLegacyCellPvtRegionIndex_(); void extractLegacyCellPvtRegionIndex_();
@@ -414,11 +414,10 @@ namespace Opm {
void wellsToState( const data::Wells& wells, void wellsToState( const data::Wells& wells,
const PhaseUsage& phases, const PhaseUsage& phases,
const bool handle_ms_well, const bool handle_ms_well,
const int report_step,
WellStateFullyImplicitBlackoil& state ) const; WellStateFullyImplicitBlackoil& state ) const;
// whether there exists any multisegment well open on this process // whether there exists any multisegment well open on this process
bool anyMSWellOpenLocal(const Wells* wells, const int report_step) const; bool anyMSWellOpenLocal(const Wells* wells) const;
const Well2& getWellEcl(const std::string& well_name) const; const Well2& getWellEcl(const std::string& well_name) const;
}; };
@@ -169,23 +169,18 @@ namespace Opm {
forceShutWellByNameIfPredictionMode(const std::string& wellname, forceShutWellByNameIfPredictionMode(const std::string& wellname,
const double simulation_time) const double simulation_time)
{ {
Opm::DeferredLogger local_deferredLogger;
// Only add the well to the closed list on the // Only add the well to the closed list on the
// process that owns it. // process that owns it.
int well_was_shut = 0; int well_was_shut = 0;
for (const auto& well : well_container_) { for (const auto& well : well_container_) {
if (well->name() == wellname) { if (well->name() == wellname) {
if (well->underPredictionMode(local_deferredLogger)) { if (well->underPredictionMode() {
wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time); wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
well_was_shut = 1; well_was_shut = 1;
} }
break; break;
} }
} }
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
if (terminal_output_) {
global_deferredLogger.logMessages();
}
// Communicate across processes if a well was shut. // Communicate across processes if a well was shut.
well_was_shut = ebosSimulator_.vanguard().grid().comm().max(well_was_shut); well_was_shut = ebosSimulator_.vanguard().grid().comm().max(well_was_shut);
@@ -263,8 +258,8 @@ namespace Opm {
well_state_.init(wells(), cellPressures, schedule(), wells_ecl_, timeStepIdx, &previous_well_state_, phase_usage_); well_state_.init(wells(), cellPressures, schedule(), wells_ecl_, timeStepIdx, &previous_well_state_, phase_usage_);
// handling MS well related // handling MS well related
if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells(), timeStepIdx)) { // if we use MultisegmentWell model if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells())) { // if we use MultisegmentWell model
well_state_.initWellStateMSWell(wells(), wells_ecl_, timeStepIdx, phase_usage_, &previous_well_state_); well_state_.initWellStateMSWell(wells(), wells_ecl_, phase_usage_, &previous_well_state_);
} }
// update the previous well state. This is used to restart failed steps. // update the previous well state. This is used to restart failed steps.
@@ -276,7 +271,7 @@ namespace Opm {
int exception_thrown = 0; int exception_thrown = 0;
try { try {
computeRESV(timeStepIdx, local_deferredLogger); computeRESV(local_deferredLogger);
} catch (const std::exception& e){ } catch (const std::exception& e){
exception_thrown = 1; exception_thrown = 1;
} }
@@ -502,9 +497,9 @@ namespace Opm {
if (nw > 0) { if (nw > 0) {
const auto phaseUsage = phaseUsageFromDeck(eclState()); const auto phaseUsage = phaseUsageFromDeck(eclState());
const size_t numCells = Opm::UgGridHelpers::numCells(grid()); const size_t numCells = Opm::UgGridHelpers::numCells(grid());
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells, report_step)); const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells));
well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, report_step, numCells, phaseUsage); // Resize for restart step well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage); // Resize for restart step
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, report_step, well_state_); wellsToState(restartValues.wells, phaseUsage, handle_ms_well, well_state_);
previous_well_state_ = well_state_; previous_well_state_ = well_state_;
} }
initial_step_ = false; initial_step_ = false;
@@ -1645,7 +1640,7 @@ namespace Opm {
template<typename TypeTag> template<typename TypeTag>
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
computeRESV(const std::size_t step, Opm::DeferredLogger& deferred_logger) computeRESV(Opm::DeferredLogger& deferred_logger)
{ {
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells()); const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells());
@@ -1731,7 +1726,6 @@ namespace Opm {
wellsToState( const data::Wells& wells, wellsToState( const data::Wells& wells,
const PhaseUsage& phases, const PhaseUsage& phases,
const bool handle_ms_well, const bool handle_ms_well,
const int report_step,
WellStateFullyImplicitBlackoil& state) const WellStateFullyImplicitBlackoil& state) const
{ {
@@ -1825,7 +1819,7 @@ namespace Opm {
template<typename TypeTag> template<typename TypeTag>
bool bool
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
anyMSWellOpenLocal(const Wells* wells, const int report_step) const anyMSWellOpenLocal(const Wells* wells) const
{ {
bool any_ms_well_open = false; bool any_ms_well_open = false;
@@ -276,7 +276,6 @@ namespace Opm
// updating the well_state based on well solution dwells // updating the well_state based on well solution dwells
void updateWellState(const BVectorWell& dwells, void updateWellState(const BVectorWell& dwells,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger,
const double relaxation_factor=1.0) const; const double relaxation_factor=1.0) const;
@@ -528,11 +528,11 @@ namespace Opm
MultisegmentWell<TypeTag>:: MultisegmentWell<TypeTag>::
recoverWellSolutionAndUpdateWellState(const BVector& x, recoverWellSolutionAndUpdateWellState(const BVector& x,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const Opm::DeferredLogger& /* deferred_logger*/) const
{ {
BVectorWell xw(1); BVectorWell xw(1);
recoverSolutionWell(x, xw); recoverSolutionWell(x, xw);
updateWellState(xw, well_state, deferred_logger); updateWellState(xw, well_state);
} }
@@ -712,13 +712,13 @@ namespace Opm
template <typename TypeTag> template <typename TypeTag>
void void
MultisegmentWell<TypeTag>:: MultisegmentWell<TypeTag>::
solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& deferred_logger) solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& /* deferred_logger */)
{ {
// We assemble the well equations, then we check the convergence, // We assemble the well equations, then we check the convergence,
// which is why we do not put the assembleWellEq here. // which is why we do not put the assembleWellEq here.
const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_); const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_);
updateWellState(dx_well, well_state, deferred_logger); updateWellState(dx_well, well_state);
} }
@@ -803,7 +803,6 @@ namespace Opm
MultisegmentWell<TypeTag>:: MultisegmentWell<TypeTag>::
updateWellState(const BVectorWell& dwells, updateWellState(const BVectorWell& dwells,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger,
const double relaxation_factor) const const double relaxation_factor) const
{ {
const double dFLimit = param_.dwell_fraction_max_; const double dFLimit = param_.dwell_fraction_max_;
@@ -1686,9 +1685,9 @@ namespace Opm
// handling the velocity head of intlet segments // handling the velocity head of intlet segments
for (const int inlet : segment_inlets_[seg]) { for (const int inlet : segment_inlets_[seg]) {
const EvalWell density = segment_densities_[inlet]; const EvalWell inlet_density = segment_densities_[inlet];
const EvalWell mass_rate = segment_mass_rates_[inlet]; const EvalWell inlet_mass_rate = segment_mass_rates_[inlet];
const EvalWell inlet_velocity_head = mswellhelpers::velocityHead(area, mass_rate, density); const EvalWell inlet_velocity_head = mswellhelpers::velocityHead(area, inlet_mass_rate, inlet_density);
resWell_[seg][SPres] += inlet_velocity_head.value(); resWell_[seg][SPres] += inlet_velocity_head.value();
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) { for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {
duneD_[seg][inlet][SPres][pv_idx] += inlet_velocity_head.derivative(pv_idx + numEq); duneD_[seg][inlet][SPres][pv_idx] += inlet_velocity_head.derivative(pv_idx + numEq);
@@ -1927,7 +1926,7 @@ namespace Opm
deferred_logger.debug(sstr.str()); deferred_logger.debug(sstr.str());
} }
updateWellState(dx_well, well_state, deferred_logger, relaxation_factor); updateWellState(dx_well, well_state, relaxation_factor);
// TODO: should we do something more if a switching of control happens // TODO: should we do something more if a switching of control happens
this->updateWellControl(ebosSimulator, well_state, deferred_logger); this->updateWellControl(ebosSimulator, well_state, deferred_logger);
+1 -2
View File
@@ -485,8 +485,7 @@ namespace Opm
// checking convergence of extra equations, if there are any // checking convergence of extra equations, if there are any
void checkConvergenceExtraEqs(const std::vector<double>& res, void checkConvergenceExtraEqs(const std::vector<double>& res,
ConvergenceReport& report, ConvergenceReport& report) const;
DeferredLogger& deferred_logger) const;
// updating the connectionRates_ related polymer molecular weight // updating the connectionRates_ related polymer molecular weight
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly, void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
+3 -4
View File
@@ -1393,7 +1393,7 @@ namespace Opm
return; return;
} }
if (!this->underPredictionMode(deferred_logger) ) { if (!this->underPredictionMode() ) {
return; return;
} }
@@ -2016,7 +2016,7 @@ namespace Opm
checkConvergenceControlEq(report, deferred_logger); checkConvergenceControlEq(report, deferred_logger);
checkConvergenceExtraEqs(res, report, deferred_logger); checkConvergenceExtraEqs(res, report);
return report; return report;
} }
@@ -3148,8 +3148,7 @@ namespace Opm
void void
StandardWell<TypeTag>:: StandardWell<TypeTag>::
checkConvergenceExtraEqs(const std::vector<double>& res, checkConvergenceExtraEqs(const std::vector<double>& res,
ConvergenceReport& report, ConvergenceReport& report) const
DeferredLogger& deferred_logger) const
{ {
// if different types of extra equations are involved, this function needs to be refactored further // if different types of extra equations are involved, this function needs to be refactored further
+3 -3
View File
@@ -253,7 +253,7 @@ namespace Opm
bool wellHasTHPConstraints() const; bool wellHasTHPConstraints() const;
/// Returns true if the well is currently in prediction mode (i.e. not history mode). /// Returns true if the well is currently in prediction mode (i.e. not history mode).
bool underPredictionMode(Opm::DeferredLogger& deferred_logger) const; bool underPredictionMode() const;
// update perforation water throughput based on solved water rate // update perforation water throughput based on solved water rate
virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0; virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0;
@@ -416,8 +416,8 @@ namespace Opm
OperabilityStatus operability_status_; OperabilityStatus operability_status_;
void wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg, void wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step, const double simulation_time, const WellState& well_state,
const WellState& well_state, WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger); WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger);
virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg, virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step, const double simulation_time, const int report_step,
+5 -5
View File
@@ -543,7 +543,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
bool bool
WellInterface<TypeTag>:: WellInterface<TypeTag>::
underPredictionMode(Opm::DeferredLogger& deferred_logger) const underPredictionMode() const
{ {
return well_ecl_.predictionMode(); return well_ecl_.predictionMode();
} }
@@ -799,7 +799,7 @@ namespace Opm
// Based on current understanding, only under prediction mode, we need to shut well due to various // Based on current understanding, only under prediction mode, we need to shut well due to various
// reasons or limits. With more knowlage or testing cases later, this might need to be corrected. // reasons or limits. With more knowlage or testing cases later, this might need to be corrected.
if (!underPredictionMode(deferred_logger) ) { if (!underPredictionMode() ) {
return; return;
} }
@@ -997,7 +997,7 @@ namespace Opm
} }
if (testing_reason == WellTestConfig::Reason::ECONOMIC) { if (testing_reason == WellTestConfig::Reason::ECONOMIC) {
wellTestingEconomic(simulator, B_avg, simulation_time, report_step, wellTestingEconomic(simulator, B_avg, simulation_time,
well_state, well_test_state, deferred_logger); well_state, well_test_state, deferred_logger);
} }
} }
@@ -1010,8 +1010,8 @@ namespace Opm
void void
WellInterface<TypeTag>:: WellInterface<TypeTag>::
wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg, wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step, const double simulation_time, const WellState& well_state,
const WellState& well_state, WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger) WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger)
{ {
deferred_logger.info(" well " + name() + " is being tested for economic limits"); deferred_logger.info(" well " + name() + " is being tested for economic limits");
@@ -297,14 +297,13 @@ namespace Opm
void resize(const Wells* wells, const std::vector<Well2>& wells_ecl, const Schedule& schedule, void resize(const Wells* wells, const std::vector<Well2>& wells_ecl, const Schedule& schedule,
const bool handle_ms_well, const int report_step, const size_t numCells, const bool handle_ms_well, const size_t numCells, const PhaseUsage& pu)
const PhaseUsage& pu)
{ {
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
init(wells, tmp, schedule, wells_ecl, 0, nullptr, pu); init(wells, tmp, schedule, wells_ecl, 0, nullptr, pu);
if (handle_ms_well) { if (handle_ms_well) {
initWellStateMSWell(wells, wells_ecl, report_step, pu, nullptr); initWellStateMSWell(wells, wells_ecl, pu, nullptr);
} }
} }
@@ -609,7 +608,7 @@ namespace Opm
/// init the MS well related. /// init the MS well related.
void initWellStateMSWell(const Wells* wells, const std::vector<Well2>& wells_ecl, void initWellStateMSWell(const Wells* wells, const std::vector<Well2>& wells_ecl,
const int time_step, const PhaseUsage& pu, const WellStateFullyImplicitBlackoil* prev_well_state) const PhaseUsage& pu, const WellStateFullyImplicitBlackoil* prev_well_state)
{ {
// still using the order in wells // still using the order in wells
const int nw = wells->number_of_wells; const int nw = wells->number_of_wells;
@@ -79,7 +79,7 @@ namespace {
state.initWellStateMSWell(wmgr.c_wells(), state.initWellStateMSWell(wmgr.c_wells(),
setup.sched.getWells2(timeStep), setup.sched.getWells2(timeStep),
timeStep, setup.pu, nullptr); setup.pu, nullptr);
return state; return state;
} }