fixing warnings under simulator/wells

This commit is contained in:
Kai Bao 2019-06-25 21:53:37 +02:00
parent aa06942695
commit 53b15527c2
10 changed files with 36 additions and 48 deletions

View File

@ -389,7 +389,7 @@ namespace Opm {
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_();
@ -414,11 +414,10 @@ namespace Opm {
void wellsToState( const data::Wells& wells,
const PhaseUsage& phases,
const bool handle_ms_well,
const int report_step,
WellStateFullyImplicitBlackoil& state ) const;
// 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;
};

View File

@ -169,23 +169,18 @@ namespace Opm {
forceShutWellByNameIfPredictionMode(const std::string& wellname,
const double simulation_time)
{
Opm::DeferredLogger local_deferredLogger;
// Only add the well to the closed list on the
// process that owns it.
int well_was_shut = 0;
for (const auto& well : well_container_) {
if (well->name() == wellname) {
if (well->underPredictionMode(local_deferredLogger)) {
if (well->underPredictionMode() {
wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
well_was_shut = 1;
}
break;
}
}
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
if (terminal_output_) {
global_deferredLogger.logMessages();
}
// Communicate across processes if a 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_);
// handling MS well related
if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells(), timeStepIdx)) { // if we use MultisegmentWell model
well_state_.initWellStateMSWell(wells(), wells_ecl_, timeStepIdx, phase_usage_, &previous_well_state_);
if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells())) { // if we use MultisegmentWell model
well_state_.initWellStateMSWell(wells(), wells_ecl_, phase_usage_, &previous_well_state_);
}
// update the previous well state. This is used to restart failed steps.
@ -276,7 +271,7 @@ namespace Opm {
int exception_thrown = 0;
try {
computeRESV(timeStepIdx, local_deferredLogger);
computeRESV(local_deferredLogger);
} catch (const std::exception& e){
exception_thrown = 1;
}
@ -502,9 +497,9 @@ namespace Opm {
if (nw > 0) {
const auto phaseUsage = phaseUsageFromDeck(eclState());
const size_t numCells = Opm::UgGridHelpers::numCells(grid());
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells, report_step));
well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, report_step, numCells, phaseUsage); // Resize for restart step
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, report_step, well_state_);
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells));
well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage); // Resize for restart step
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, well_state_);
previous_well_state_ = well_state_;
}
initial_step_ = false;
@ -1645,7 +1640,7 @@ namespace Opm {
template<typename TypeTag>
void
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());
@ -1731,8 +1726,7 @@ namespace Opm {
wellsToState( const data::Wells& wells,
const PhaseUsage& phases,
const bool handle_ms_well,
const int report_step,
WellStateFullyImplicitBlackoil& state ) const
WellStateFullyImplicitBlackoil& state) const
{
using rt = data::Rates::opt;
@ -1825,7 +1819,7 @@ namespace Opm {
template<typename TypeTag>
bool
BlackoilWellModel<TypeTag>::
anyMSWellOpenLocal(const Wells* wells, const int report_step) const
anyMSWellOpenLocal(const Wells* wells) const
{
bool any_ms_well_open = false;

View File

@ -276,7 +276,6 @@ namespace Opm
// updating the well_state based on well solution dwells
void updateWellState(const BVectorWell& dwells,
WellState& well_state,
Opm::DeferredLogger& deferred_logger,
const double relaxation_factor=1.0) const;

View File

@ -528,11 +528,11 @@ namespace Opm
MultisegmentWell<TypeTag>::
recoverWellSolutionAndUpdateWellState(const BVector& x,
WellState& well_state,
Opm::DeferredLogger& deferred_logger) const
Opm::DeferredLogger& /* deferred_logger*/) const
{
BVectorWell xw(1);
recoverSolutionWell(x, xw);
updateWellState(xw, well_state, deferred_logger);
updateWellState(xw, well_state);
}
@ -712,13 +712,13 @@ namespace Opm
template <typename TypeTag>
void
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,
// which is why we do not put the assembleWellEq here.
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>::
updateWellState(const BVectorWell& dwells,
WellState& well_state,
Opm::DeferredLogger& deferred_logger,
const double relaxation_factor) const
{
const double dFLimit = param_.dwell_fraction_max_;
@ -1686,9 +1685,9 @@ namespace Opm
// handling the velocity head of intlet segments
for (const int inlet : segment_inlets_[seg]) {
const EvalWell density = segment_densities_[inlet];
const EvalWell mass_rate = segment_mass_rates_[inlet];
const EvalWell inlet_velocity_head = mswellhelpers::velocityHead(area, mass_rate, density);
const EvalWell inlet_density = segment_densities_[inlet];
const EvalWell inlet_mass_rate = segment_mass_rates_[inlet];
const EvalWell inlet_velocity_head = mswellhelpers::velocityHead(area, inlet_mass_rate, inlet_density);
resWell_[seg][SPres] += inlet_velocity_head.value();
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {
duneD_[seg][inlet][SPres][pv_idx] += inlet_velocity_head.derivative(pv_idx + numEq);
@ -1927,7 +1926,7 @@ namespace Opm
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
this->updateWellControl(ebosSimulator, well_state, deferred_logger);

View File

@ -485,8 +485,7 @@ namespace Opm
// checking convergence of extra equations, if there are any
void checkConvergenceExtraEqs(const std::vector<double>& res,
ConvergenceReport& report,
DeferredLogger& deferred_logger) const;
ConvergenceReport& report) const;
// updating the connectionRates_ related polymer molecular weight
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,

View File

@ -1393,7 +1393,7 @@ namespace Opm
return;
}
if (!this->underPredictionMode(deferred_logger) ) {
if (!this->underPredictionMode() ) {
return;
}
@ -2016,7 +2016,7 @@ namespace Opm
checkConvergenceControlEq(report, deferred_logger);
checkConvergenceExtraEqs(res, report, deferred_logger);
checkConvergenceExtraEqs(res, report);
return report;
}
@ -3148,8 +3148,7 @@ namespace Opm
void
StandardWell<TypeTag>::
checkConvergenceExtraEqs(const std::vector<double>& res,
ConvergenceReport& report,
DeferredLogger& deferred_logger) const
ConvergenceReport& report) const
{
// if different types of extra equations are involved, this function needs to be refactored further

View File

@ -253,7 +253,7 @@ namespace Opm
bool wellHasTHPConstraints() const;
/// 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
virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0;
@ -416,8 +416,8 @@ namespace Opm
OperabilityStatus operability_status_;
void wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step,
const WellState& well_state, WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger);
const double simulation_time, const WellState& well_state,
WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger);
virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step,

View File

@ -543,7 +543,7 @@ namespace Opm
template<typename TypeTag>
bool
WellInterface<TypeTag>::
underPredictionMode(Opm::DeferredLogger& deferred_logger) const
underPredictionMode() const
{
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
// reasons or limits. With more knowlage or testing cases later, this might need to be corrected.
if (!underPredictionMode(deferred_logger) ) {
if (!underPredictionMode() ) {
return;
}
@ -997,7 +997,7 @@ namespace Opm
}
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);
}
}
@ -1010,8 +1010,8 @@ namespace Opm
void
WellInterface<TypeTag>::
wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step,
const WellState& well_state, WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger)
const double simulation_time, const WellState& well_state,
WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger)
{
deferred_logger.info(" well " + name() + " is being tested for economic limits");

View File

@ -297,14 +297,13 @@ namespace Opm
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 PhaseUsage& pu)
const bool handle_ms_well, const size_t numCells, const PhaseUsage& pu)
{
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
init(wells, tmp, schedule, wells_ecl, 0, nullptr, pu);
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.
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
const int nw = wells->number_of_wells;

View File

@ -79,7 +79,7 @@ namespace {
state.initWellStateMSWell(wmgr.c_wells(),
setup.sched.getWells2(timeStep),
timeStep, setup.pu, nullptr);
setup.pu, nullptr);
return state;
}