fixing warnings in other folder under opm-simulators

This commit is contained in:
Kai Bao 2019-06-26 09:50:56 +02:00
parent 53b15527c2
commit 9a2fcdbfd5
14 changed files with 50 additions and 61 deletions

View File

@ -659,7 +659,6 @@ public:
if (enableTuning_) {
// if support for the TUNING keyword is enabled, we get the initial time
// steping parameters from it instead of from command line parameters
const auto& schedule = simulator.vanguard().schedule();
const auto& tuning = schedule.getTuning();
initialTimeStepSize_ = tuning.getTSINIT(0);
maxTimeStepAfterWellEvent_ = tuning.getTMAXWC(0);
@ -745,7 +744,7 @@ public:
void deserialize(Restarter& res)
{
// reload the current episode/report step from the deck
beginEpisode(/*isOnRestart=*/true);
beginEpisode();
// deserialize the wells
wellModel_.deserialize(res);
@ -773,7 +772,7 @@ public:
/*!
* \brief Called by the simulator before an episode begins.
*/
void beginEpisode(bool isOnRestart = false)
void beginEpisode()
{
// Proceed to the next report step
auto& simulator = this->simulator();
@ -1514,7 +1513,7 @@ public:
// convert the source term from the total mass rate of the
// cell to the one per unit of volume as used by the model.
unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
const unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx) {
rate[eqIdx] /= this->model().dofTotalVolume(globalDofIdx);
@ -1528,7 +1527,6 @@ public:
// if requested, compensate systematic mass loss for cells which were "well
// behaved" in the last time step
if (enableDriftCompensation_) {
unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
const auto& simulator = this->simulator();
const auto& model = this->model();
@ -2651,10 +2649,10 @@ private:
//////
// set temperature
//////
Scalar temperature = tempiData[cartesianDofIdx];
if (!std::isfinite(temperature) || temperature <= 0)
temperature = FluidSystem::surfaceTemperature;
dofFluidState.setTemperature(temperature);
Scalar temperatureLoc = tempiData[cartesianDofIdx];
if (!std::isfinite(temperatureLoc) || temperatureLoc <= 0)
temperatureLoc = FluidSystem::surfaceTemperature;
dofFluidState.setTemperature(temperatureLoc);
//////
// set saturations

View File

@ -80,7 +80,7 @@ namespace Opm
OPM_THROW(std::runtime_error, "Trying to add well " << wellChild.name() << " Step: " << boost::lexical_cast<std::string>(timeStep) << " to group named " << wellChild.groupName() << ", but this group does not exist in the WellCollection.");
}
std::shared_ptr<WellsGroupInterface> child = createWellWellsGroup(wellChild, summaryState, timeStep, phaseUsage);
std::shared_ptr<WellsGroupInterface> child = createWellWellsGroup(wellChild, summaryState, phaseUsage);
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
if (!parent_as_group) {

View File

@ -1588,7 +1588,7 @@ namespace Opm
'CMODE_UNDEFINED' - we do not carry that over the specification
objects here.
*/
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, const SummaryState& summaryState, size_t timeStep, const PhaseUsage& phase_usage )
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, const SummaryState& summaryState, const PhaseUsage& phase_usage )
{
InjectionSpecification injection_specification;
ProductionSpecification production_specification;

View File

@ -543,7 +543,6 @@ namespace Opm
/// \param[in] the phase usage
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well,
const SummaryState& summaryState,
size_t timeStep,
const PhaseUsage& phase_usage );
/// Creates the WellsGroupInterface for the given Group

View File

@ -294,7 +294,6 @@ namespace Opm
void WellsManager::setupWellControls(const std::vector<Well2>& wells,
const SummaryState& summaryState,
size_t timeStep,
std::vector<std::string>& well_names,
const PhaseUsage& phaseUsage,
const std::vector<int>& wells_on_proc) {
@ -599,7 +598,7 @@ namespace Opm
}
// only handle the guide rates from the keyword WGRUPCON
void WellsManager::setupGuideRates(const std::vector<Well2>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
void WellsManager::setupGuideRates(const std::vector<Well2>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
{
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter ) {
const auto& well = *wellIter;

View File

@ -170,7 +170,7 @@ namespace Opm
WellsManager(const WellsManager& other);
WellsManager& operator=(const WellsManager& other);
static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed );
void setupWellControls(const std::vector<Well2>& wells, const SummaryState& summaryState, size_t timeStep,
void setupWellControls(const std::vector<Well2>& wells, const SummaryState& summaryState,
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
const std::vector<int>& wells_on_proc);
@ -191,7 +191,7 @@ namespace Opm
std::vector<int>& wells_on_proc,
const std::unordered_set<std::string>& deactivated_wells);
void setupGuideRates(const std::vector<Well2>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
void setupGuideRates(const std::vector<Well2>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
// Data
Wells* w_;

View File

@ -226,16 +226,16 @@ void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t
destroy_wells( w );
// Add wells.
for (int w = 0; w < num_wells; ++w) {
const int w_num_perf = wellperf_data[w].size();
for (int iw = 0; iw < num_wells; ++iw) {
const int w_num_perf = wellperf_data[iw].size();
std::vector<int> perf_cells (w_num_perf);
std::vector<double> perf_prodind(w_num_perf);
std::vector<int> perf_satnumid(w_num_perf);
for (int perf = 0; perf < w_num_perf; ++perf) {
perf_cells [perf] = wellperf_data[w][perf].cell;
perf_prodind[perf] = wellperf_data[w][perf].well_index;
perf_satnumid[perf] = wellperf_data[w][perf].satnumid;
perf_cells [perf] = wellperf_data[iw][perf].cell;
perf_prodind[perf] = wellperf_data[iw][perf].well_index;
perf_satnumid[perf] = wellperf_data[iw][perf].satnumid;
}
const double* comp_frac = NULL;
@ -243,21 +243,21 @@ void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t
// We initialize all wells with a null component fraction,
// and must (for injection wells) overwrite it later.
const int ok =
add_well(well_data[w].type,
well_data[w].reference_bhp_depth,
add_well(well_data[iw].type,
well_data[iw].reference_bhp_depth,
w_num_perf,
comp_frac,
perf_cells.data(),
perf_prodind.data(),
perf_satnumid.data(),
well_names[w].c_str(),
well_data[w].allowCrossFlow,
well_names[iw].c_str(),
well_data[iw].allowCrossFlow,
w_);
if (!ok) {
OPM_THROW(std::runtime_error,
"Failed adding well "
<< well_names[w]
<< well_names[iw]
<< " to Wells data structure.");
}
}
@ -368,7 +368,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
pu, cartesian_to_compressed, interleavedPerm.data(), ntg,
wells_on_proc, deactivated_wells);
setupWellControls(wells, summaryState, timeStep, well_names, pu, wells_on_proc);
setupWellControls(wells, summaryState, well_names, pu, wells_on_proc);
{
const auto& fieldGroup = schedule.getGroup( "FIELD" );
@ -401,7 +401,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
if (well_collection_.groupControlActive()) {
// here does not consider the well potentials related guide rate setting
setupGuideRates(wells, timeStep, well_data, well_names_to_index);
setupGuideRates(wells, well_data, well_names_to_index);
}
// Debug output.

View File

@ -437,8 +437,8 @@ namespace Opm {
resultDenom += pressureNew*pressureNew;
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++ phaseIdx) {
Scalar tmp = saturationsNew[phaseIdx] - saturationsOld[phaseIdx];
resultDelta += tmp*tmp;
const Scalar tmpSat = saturationsNew[phaseIdx] - saturationsOld[phaseIdx];
resultDelta += tmpSat * tmpSat;
resultDenom += saturationsNew[phaseIdx]*saturationsNew[phaseIdx];
}
}
@ -882,9 +882,9 @@ namespace Opm {
const BlackoilWellModel<TypeTag>&
wellModel() const { return well_model_; }
void beginReportStep(bool isRestart)
void beginReportStep()
{
ebosSimulator_.problem().beginEpisode(isRestart);
ebosSimulator_.problem().beginEpisode();
}
void endReportStep()

View File

@ -204,10 +204,6 @@ public:
wellModel_().initFromRestartFile(*restartValues);
}
// beginReportStep(...) wants to know when we are at the
// beginning of a restart
bool firstRestartStep = isRestart();
// Main simulation loop.
while (!timer.done()) {
// Report timestep.
@ -252,9 +248,7 @@ public:
ebosSimulator_.startNextEpisode(ebosSimulator_.startTime() + schedule().getTimeMap().getTimePassedUntil(timer.currentStepNum()),
timer.currentStepLength());
ebosSimulator_.setEpisodeIndex(timer.currentStepNum());
solver->model().beginReportStep(firstRestartStep);
firstRestartStep = false;
solver->model().beginReportStep();
// If sub stepping is enabled allow the solver to sub cycle
// in case the report steps are too large for the solver to converge

View File

@ -335,7 +335,6 @@ protected:
}
else
{
const WellModel& wellModel = simulator_.problem().wellModel();
typedef WellModelMatrixAdapter< Matrix, Vector, Vector, WellModel, false > Operator;
Operator opA(*matrix_, *matrix_, wellModel);
solve( opA, x, *rhs_ );

View File

@ -520,8 +520,8 @@ namespace Opm {
failing_wells.insert(wf.wellName());
}
if (sr_size >= num_steps) {
for (int step = 1; step < num_steps; ++step) {
const auto& srep = sr[sr_size - 1 - step];
for (int s = 1; s < num_steps; ++s) {
const auto& srep = sr[sr_size - 1 - s];
// Report must be from same report step and substep, otherwise we have
// not chopped/retried enough times on this step.
if (srep.report_step != rep_step || srep.current_step != sub_step) {

View File

@ -174,7 +174,7 @@ namespace Opm {
int well_was_shut = 0;
for (const auto& well : well_container_) {
if (well->name() == wellname) {
if (well->underPredictionMode() {
if (well->underPredictionMode()) {
wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
well_was_shut = 1;
}

View File

@ -67,24 +67,24 @@ BOOST_AUTO_TEST_CASE(deferredlogger)
std::ostringstream log_stream;
initLogger(log_stream);
auto deferredlogger = Opm::DeferredLogger();
deferredlogger.info("info 1");
deferredlogger.warning("warning 1");
deferredlogger.error("error 1");
deferredlogger.error("error 2");
deferredlogger.problem("problem 1");
deferredlogger.bug("bug 1");
deferredlogger.debug("debug 1");
deferredlogger.note("note 1");
deferredlogger.note("tagme", "note 2");
deferredlogger.note("tagme", "note 3");
deferredlogger.note("tagme", "note 3");
deferredlogger.note("tagme", "note 3");
deferredlogger.note("tagme", "note 3");
deferredlogger.note("tagme", "note 3");
deferredlogger.note("tagme", "note 3");
auto deferred_logger = Opm::DeferredLogger();
deferred_logger.info("info 1");
deferred_logger.warning("warning 1");
deferred_logger.error("error 1");
deferred_logger.error("error 2");
deferred_logger.problem("problem 1");
deferred_logger.bug("bug 1");
deferred_logger.debug("debug 1");
deferred_logger.note("note 1");
deferred_logger.note("tagme", "note 2");
deferred_logger.note("tagme", "note 3");
deferred_logger.note("tagme", "note 3");
deferred_logger.note("tagme", "note 3");
deferred_logger.note("tagme", "note 3");
deferred_logger.note("tagme", "note 3");
deferred_logger.note("tagme", "note 3");
deferredlogger.logMessages();
deferred_logger.logMessages();
auto counter = OpmLog::getBackend<CounterLog>("COUNTER");
BOOST_CHECK_EQUAL( 1 , counter->numMessages(Log::MessageType::Warning) );

View File

@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
for (size_t i=0; i<wells.size(); i++) {
const auto& well = wells[i];
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, summaryState, 2, pu);
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, summaryState, pu);
BOOST_CHECK_EQUAL(well.name(), wellsGroup->name());
if (well.isInjector()) {
const auto controls = well.injectionControls(summaryState);