From 15fd5dad470573470c8eaca935130896dafc4234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 7 Oct 2015 11:19:53 +0200 Subject: [PATCH] Suppress warnings in the multisegment well code. --- examples/flow_multisegment.cpp | 4 +- opm/autodiff/BlackoilMultiSegmentModel.hpp | 9 - .../BlackoilMultiSegmentModel_impl.hpp | 183 +++++++++--------- ...FullyImplicitBlackoilMultiSegment_impl.hpp | 4 +- opm/autodiff/WellMultiSegment.cpp | 12 +- opm/autodiff/WellMultiSegment.hpp | 16 +- opm/autodiff/WellStateMultiSegment.hpp | 142 +++++++------- 7 files changed, 183 insertions(+), 187 deletions(-) diff --git a/examples/flow_multisegment.cpp b/examples/flow_multisegment.cpp index 98af261b3..bd33f151f 100644 --- a/examples/flow_multisegment.cpp +++ b/examples/flow_multisegment.cpp @@ -27,7 +27,7 @@ #include -#include +#include #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) #include @@ -43,7 +43,7 @@ #undef USE_DUNE_CORNERPOINTGRID #endif -#include +#include #include diff --git a/opm/autodiff/BlackoilMultiSegmentModel.hpp b/opm/autodiff/BlackoilMultiSegmentModel.hpp index 757ca2a85..212a8251d 100644 --- a/opm/autodiff/BlackoilMultiSegmentModel.hpp +++ b/opm/autodiff/BlackoilMultiSegmentModel.hpp @@ -100,15 +100,6 @@ namespace Opm { ReservoirState& reservoir_state, WellState& well_state); - /// Called once after each time step. - /// In this class, this function does nothing. - /// \param[in] dt time step size - /// \param[in, out] reservoir_state reservoir state variables - /// \param[in, out] well_state well state variables - void afterStep(const double dt, - ReservoirState& reservoir_state, - WellState& well_state) {}; - /// Assemble the residual and Jacobian of the nonlinear system. /// \param[in] reservoir_state reservoir state variables diff --git a/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp b/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp index f1489e8ab..86cacca43 100644 --- a/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp +++ b/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp @@ -96,7 +96,7 @@ namespace Opm { BlackoilMultiSegmentModel:: prepareStep(const double dt, ReservoirState& reservoir_state, - WellState& well_state) + WellState& /* well_state */) { pvdt_ = geo_.poreVolume() / dt; if (active_[Gas]) { @@ -208,14 +208,15 @@ namespace Opm { well_cells.reserve(nperf); for (int i = 0; i < nw; ++i) { const std::vector& temp_well_cells = wellsMultiSegment()[i]->wellCells(); + const int num_cells_this_well = temp_well_cells.size(); const int n_current = well_cells.size(); if (wellsMultiSegment()[i]->isMultiSegmented()) { - for (int j = 0; j < temp_well_cells.size(); ++j) { + for (int j = 0; j < num_cells_this_well; ++j) { well_cells_segmented_idx.push_back(j + n_current); } well_cells_segmented.insert(well_cells_segmented.end(), temp_well_cells.begin(), temp_well_cells.end()); } else { - for (int j = 0; j < temp_well_cells.size(); ++j) { + for (int j = 0; j < num_cells_this_well; ++j) { well_cells_non_segmented_idx.push_back(j + n_current); } well_cells_non_segmented.insert(well_cells_non_segmented.end(), temp_well_cells.begin(), temp_well_cells.end()); @@ -477,7 +478,7 @@ namespace Opm { well_cells.insert(well_cells.end(), temp_well_cells.begin(), temp_well_cells.end()); } - assert(nperf == well_cells.size()); + assert(nperf == int(well_cells.size())); std::vector mob_perfcells(np, ADB::null()); std::vector b_perfcells(np, ADB::null()); @@ -526,7 +527,7 @@ namespace Opm { well_cells.insert(well_cells.end(), well->wellCells().begin(), well->wellCells().end()); } - assert(well_cells.size() == nperf); + assert(int(well_cells.size()) == nperf); for (int phase = 0; phase < np; ++phase) { residual_.material_balance_eq[phase] -= superset(cq_s[phase], well_cells, nc); @@ -794,7 +795,7 @@ namespace Opm { template void BlackoilMultiSegmentModel::updatePerfPhaseRatesAndPressures(const std::vector& cq_s, - const SolutionState& state, + const SolutionState& /* state */, WellState& xw) { // Update the perforation phase rates (used to calculate the pressure drop in the wellbore). @@ -948,10 +949,11 @@ namespace Opm { } } - if (int debug = 0) { - std::cout << " xw.bhp() is " << xw.bhp()[w] << std::endl; - std::cout << " ctrl_index " << ctrl_index << " nwc " << nwc << std::endl; - } +#if 0 + // Debug output + std::cout << " xw.bhp() is " << xw.bhp()[w] << std::endl; + std::cout << " ctrl_index " << ctrl_index << " nwc " << nwc << std::endl; +#endif if (ctrl_index != nwc) { // Constraint number ctrl_index was broken, switch to it. @@ -1046,7 +1048,7 @@ namespace Opm { template void BlackoilMultiSegmentModel::addWellControlEq(const SolutionState& state, const WellState& xw, - const V& aliveWells) + const V& /* aliveWells */) { // the name of the function is a a little misleading. // Basically it is the function for the pressure equation. @@ -1156,39 +1158,40 @@ namespace Opm { start_segment += nseg; } - if (int debug = 0) { - std::cout << "output bhp_targets " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << i << " " << bhp_targets(i) << std::endl; - } - std::cout << " bhp_well_elems " << std::endl; - std::cout << " the size of bhp_well_elems is " << bhp_well_elems.size() << std::endl; - for (int i = 0; i < bhp_well_elems.size(); ++i) { - std::cout << " bhp_well_elems " << i << " is " << bhp_well_elems[i] << std::endl; - } - std::cout << " rate_well_elems " << std::endl; - std::cout << " the size of rate_well_elems is " << rate_well_elems.size() << std::endl; - for (int i = 0; i < rate_well_elems.size(); ++i) { - std::cout << " rate_well_elems " << i << " is " << rate_well_elems[i] << std::endl; - } - std::cout << " bhp_top_elems " << std::endl; - std::cout << " the size of bhp_top_elems is " << bhp_top_elems.size() << std::endl; - for (int i = 0; i < bhp_top_elems.size(); ++i) { - std::cout << " bhp_top_elems " << i << " is " << bhp_top_elems[i] << std::endl; - } - std::cout << " rate_top_elems " << std::endl; - std::cout << " the size of the rate_top_elems " << rate_top_elems.size() << std::endl; - for (int i = 0; i < rate_top_elems.size(); ++i) { - std::cout << " rate_top_elems " << i << " is " << rate_top_elems[i] << std::endl; - } - std::cout << " the others_elems " << std::endl; - std::cout << " the size of others_elems is " << others_elems.size() << std::endl; - for(int i = 0; i < others_elems.size(); ++i) { - std::cout << "others_elems " << i << " is " << others_elems[i] << std::endl; - } - - std::cin.ignore(); +#if 0 + // Debug output. + std::cout << "output bhp_targets " << std::endl; + for (int i = 0; i < nw; ++i) { + std::cout << i << " " << bhp_targets(i) << std::endl; } + std::cout << " bhp_well_elems " << std::endl; + std::cout << " the size of bhp_well_elems is " << bhp_well_elems.size() << std::endl; + for (size_t i = 0; i < bhp_well_elems.size(); ++i) { + std::cout << " bhp_well_elems " << i << " is " << bhp_well_elems[i] << std::endl; + } + std::cout << " rate_well_elems " << std::endl; + std::cout << " the size of rate_well_elems is " << rate_well_elems.size() << std::endl; + for (size_t i = 0; i < rate_well_elems.size(); ++i) { + std::cout << " rate_well_elems " << i << " is " << rate_well_elems[i] << std::endl; + } + std::cout << " bhp_top_elems " << std::endl; + std::cout << " the size of bhp_top_elems is " << bhp_top_elems.size() << std::endl; + for (size_t i = 0; i < bhp_top_elems.size(); ++i) { + std::cout << " bhp_top_elems " << i << " is " << bhp_top_elems[i] << std::endl; + } + std::cout << " rate_top_elems " << std::endl; + std::cout << " the size of the rate_top_elems " << rate_top_elems.size() << std::endl; + for (size_t i = 0; i < rate_top_elems.size(); ++i) { + std::cout << " rate_top_elems " << i << " is " << rate_top_elems[i] << std::endl; + } + std::cout << " the others_elems " << std::endl; + std::cout << " the size of others_elems is " << others_elems.size() << std::endl; + for(size_t i = 0; i < others_elems.size(); ++i) { + std::cout << "others_elems " << i << " is " << others_elems[i] << std::endl; + } + + std::cin.ignore(); +#endif // for each segment: 1, if the segment is the top segment, then control equation @@ -1486,10 +1489,10 @@ namespace Opm { template void BlackoilMultiSegmentModel::updateWellState(const V& dwells, - WellState& well_state) + WellState& well_state) { - if( !wellsMultiSegment().empty() ) + if (!wellsMultiSegment().empty()) { const int np = numPhases(); const int nw = wellsMultiSegment().size(); @@ -1549,56 +1552,56 @@ namespace Opm { // TODO: handling the THP control related. } - if (int debug = 0) { - std::cout << " output all the well state informations after updateWellState()" << std::endl; - const int np = well_state.numberOfPhases(); - const int nw = well_state.numberOfWells(); - const int nperf_total = well_state.numberOfPerforations(); - const int nseg_total = well_state.numberOfSegments(); +#if 0 + // Debug output. + std::cout << " output all the well state informations after updateWellState()" << std::endl; + const int np = well_state.numberOfPhases(); + const int nw = well_state.numberOfWells(); + const int nperf_total = well_state.numberOfPerforations(); + const int nseg_total = well_state.numberOfSegments(); - std::cout << " number of wells : " << nw << " nubmer of segments : " << nseg_total << std::endl; - std::cout << " number of phase : " << np << " nubmer of perforations " << nperf_total << std::endl; + std::cout << " number of wells : " << nw << " nubmer of segments : " << nseg_total << std::endl; + std::cout << " number of phase : " << np << " nubmer of perforations " << nperf_total << std::endl; - std::cout << " bhps : " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << well_state.bhp()[i] << std::endl; - } + std::cout << " bhps : " << std::endl; + for (int i = 0; i < nw; ++i) { + std::cout << well_state.bhp()[i] << std::endl; + } - std::cout << " thps : " << std::endl; + std::cout << " thps : " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << well_state.thp()[i] << std::endl; - } + for (int i = 0; i < nw; ++i) { + std::cout << well_state.thp()[i] << std::endl; + } - std::cout << " well rates " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << i; - for (int p = 0; p < np; ++p) { - std::cout << " " << well_state.wellRates()[np * i + p]; - } - std::cout << std::endl; - } - - std::cout << " segment pressures and segment phase rates : " << std::endl; - for (int i = 0; i < nseg_total; ++i) { - std::cout << i << " " << well_state.segPress()[i]; - for (int p = 0; p < np; ++p) { - std::cout << " " << well_state.segPhaseRates()[np * i + p]; - } - std::cout << std::endl; - } - - std::cout << " perf pressures and pref phase rates : " << std::endl; - for (int i = 0; i < nperf_total; ++i) { - std::cout << i << " " << well_state.perfPress()[i]; - for (int p = 0; p < np; ++p) { - std::cout << " " << well_state.perfPhaseRates()[np * i + p]; - } - std::cout << std::endl; - } - std::cout << " output all the well state informations after updateWellState() DONE!!!!" << std::endl; + std::cout << " well rates " << std::endl; + for (int i = 0; i < nw; ++i) { + std::cout << i; + for (int p = 0; p < np; ++p) { + std::cout << " " << well_state.wellRates()[np * i + p]; } + std::cout << std::endl; + } + std::cout << " segment pressures and segment phase rates : " << std::endl; + for (int i = 0; i < nseg_total; ++i) { + std::cout << i << " " << well_state.segPress()[i]; + for (int p = 0; p < np; ++p) { + std::cout << " " << well_state.segPhaseRates()[np * i + p]; + } + std::cout << std::endl; + } + + std::cout << " perf pressures and pref phase rates : " << std::endl; + for (int i = 0; i < nperf_total; ++i) { + std::cout << i << " " << well_state.perfPress()[i]; + for (int p = 0; p < np; ++p) { + std::cout << " " << well_state.perfPhaseRates()[np * i + p]; + } + std::cout << std::endl; + } + std::cout << " output all the well state informations after updateWellState() DONE!!!!" << std::endl; +#endif } @@ -1738,7 +1741,7 @@ namespace Opm { template void - BlackoilMultiSegmentModel::computeSegmentDensities(const SolutionState& state, + BlackoilMultiSegmentModel::computeSegmentDensities(const SolutionState& /* state */, const std::vector& cq_s, const std::vector& b_perf, const WellState& xw) @@ -1753,7 +1756,7 @@ namespace Opm { const int nseg_total = xw.numberOfSegments(); const int np = numPhases(); - assert(np == b_perf.size()); + assert(np == int(b_perf.size())); well_segment_densities_ = ADB::constant(V::Zero(nseg_total)); // initialize to be zero diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp index 8495d4537..56ba2f59a 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp @@ -118,8 +118,8 @@ namespace Opm wells_multisegment[i].reset(new WellMultiSegment(wells_ecl[i], timer.currentStepNum(), wells)); } +#if 0 // for DEBUGGING OUTPUT - if (int debug = 0) { std::cout << " the number of the wells from EclipseState " << wells_ecl.size() << std::endl; for (size_t i = 0; i < wells_ecl.size(); ++i) { std::cout << " well name " << wells_ecl[i]->name() << std::endl; @@ -184,7 +184,7 @@ namespace Opm std::cout << " output well information for well " << well->name() << " done!!!! " << std::endl; } std::cin.ignore(); - } +#endif // DEBUGGING OUTPUT is DONE diff --git a/opm/autodiff/WellMultiSegment.cpp b/opm/autodiff/WellMultiSegment.cpp index ac570f8b9..a8bfb4f29 100644 --- a/opm/autodiff/WellMultiSegment.cpp +++ b/opm/autodiff/WellMultiSegment.cpp @@ -330,23 +330,23 @@ namespace Opm return m_well_name_; } - const bool WellMultiSegment::isMultiSegmented() const { + bool WellMultiSegment::isMultiSegmented() const { return m_is_multi_segment_; } - const enum WellType WellMultiSegment::wellType() const { + WellType WellMultiSegment::wellType() const { return m_well_type_; } - const struct WellControls* WellMultiSegment::wellControls() const { + const WellControls* WellMultiSegment::wellControls() const { return m_well_controls_; } - const int WellMultiSegment::numberOfPerforations() const { + int WellMultiSegment::numberOfPerforations() const { return m_number_of_perforations_; } - const int WellMultiSegment::numberOfSegments() const { + int WellMultiSegment::numberOfSegments() const { return m_number_of_segments_; } @@ -354,7 +354,7 @@ namespace Opm return m_comp_frac_; } - const int WellMultiSegment::numberOfPhases() const { + int WellMultiSegment::numberOfPhases() const { return m_number_of_phases_; } diff --git a/opm/autodiff/WellMultiSegment.hpp b/opm/autodiff/WellMultiSegment.hpp index 9e82be39a..a4fc6a23e 100644 --- a/opm/autodiff/WellMultiSegment.hpp +++ b/opm/autodiff/WellMultiSegment.hpp @@ -21,10 +21,10 @@ #define OPM_WELLMULTISEGMENT_HEADER_INCLUDED -#include +#include #include #include -#include +#include #include #include @@ -54,16 +54,16 @@ namespace Opm WellMultiSegment(WellConstPtr well, size_t time_step, const Wells* wells); const std::string& name() const; - const bool isMultiSegmented() const; - const int numberOfPerforations() const; - const int numberOfSegments() const; + bool isMultiSegmented() const; + int numberOfPerforations() const; + int numberOfSegments() const; - const struct WellControls* wellControls() const; + const WellControls* wellControls() const; const std::vector& compFrac() const; - const int numberOfPhases() const; + int numberOfPhases() const; - const enum WellType wellType() const; + WellType wellType() const; const std::vector& wellIndex() const; const std::vector& perfDepth() const; const std::vector& wellCells() const; diff --git a/opm/autodiff/WellStateMultiSegment.hpp b/opm/autodiff/WellStateMultiSegment.hpp index abab5c032..9c3108fd2 100644 --- a/opm/autodiff/WellStateMultiSegment.hpp +++ b/opm/autodiff/WellStateMultiSegment.hpp @@ -363,75 +363,76 @@ namespace Opm } } - if (int debug = 0) { - std::cout << " output all the well state informations after initialization " << std::endl; - const int nperf_total = numberOfPerforations(); - const int nseg_total = numberOfSegments(); +#if 0 + // Debugging output. + std::cout << " output all the well state informations after initialization " << std::endl; + const int nperf_total = numberOfPerforations(); + const int nseg_total = numberOfSegments(); - std::cout << " number of wells : " << nw << " nubmer of segments : " << nseg_total << std::endl; - std::cout << " number of phase : " << np << " nubmer of perforations " << nperf_total << std::endl; + std::cout << " number of wells : " << nw << " nubmer of segments : " << nseg_total << std::endl; + std::cout << " number of phase : " << np << " nubmer of perforations " << nperf_total << std::endl; - std::cout << " bhps : " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << bhp()[i] << std::endl; - } - - std::cout << " thps : " << std::endl; - - for (int i = 0; i < nw; ++i) { - std::cout << thp()[i] << std::endl; - } - - std::cout << " well rates " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << i; - for (int p = 0; p < np; ++p) { - std::cout << " " << wellRates()[np * i + p]; - } - std::cout << std::endl; - } - - std::cout << " segment pressures and segment phase rates : " << std::endl; - for (int i = 0; i < nseg_total; ++i) { - std::cout << i << " " << segPress()[i]; - for (int p = 0; p < np; ++p) { - std::cout << " " << segPhaseRates()[np * i + p]; - } - std::cout << std::endl; - } - - std::cout << " perf pressures and pref phase rates : " << std::endl; - for (int i = 0; i < nperf_total; ++i) { - std::cout << i << " " << perfPress()[i]; - for (int p = 0; p < np; ++p) { - std::cout << " " << perfPhaseRates()[np * i + p]; - } - std::cout << std::endl; - } - - std::cout << " locations of the top segments : " << std::endl; - for (int i = 0; i < nw; ++i) { - std::cout << i << " " << top_segment_loc_[i] << std::endl; - } - - std::cout << " output all the information from the wellMap " << std::endl; - - for (WellMapType::const_iterator iter = wellMap().begin(); iter != wellMap().end(); ++iter) { - std::cout << " well name : " << iter->first << std::endl; - const MapentryType &wellmapInfo = iter->second; - std::cout << " well number : " << wellmapInfo.well_number << " start segment " << wellmapInfo.start_segment - << " number of segment : " << wellmapInfo.number_of_segments << std::endl; - std::cout << " start perforation : " << wellmapInfo.start_perforation << " number of perforations : " << wellmapInfo.number_of_perforations << std::endl; - const int nseg_well = wellmapInfo.number_of_segments; - std::cout << " start performation ofr each segment and number of perforation that each segment has" << std::endl; - for (int i = 0; i < nseg_well; ++i) { - std::cout << " segment " << i << " start perforation " << wellmapInfo.start_perforation_segment[i] - << " number of perforations " << wellmapInfo.number_of_perforations_segment[i] << std::endl; - } - } - std::cout << " output the well state right after intialization is DONE! " << std::endl; - std::cin.ignore(); + std::cout << " bhps : " << std::endl; + for (int i = 0; i < nw; ++i) { + std::cout << bhp()[i] << std::endl; } + + std::cout << " thps : " << std::endl; + + for (int i = 0; i < nw; ++i) { + std::cout << thp()[i] << std::endl; + } + + std::cout << " well rates " << std::endl; + for (int i = 0; i < nw; ++i) { + std::cout << i; + for (int p = 0; p < np; ++p) { + std::cout << " " << wellRates()[np * i + p]; + } + std::cout << std::endl; + } + + std::cout << " segment pressures and segment phase rates : " << std::endl; + for (int i = 0; i < nseg_total; ++i) { + std::cout << i << " " << segPress()[i]; + for (int p = 0; p < np; ++p) { + std::cout << " " << segPhaseRates()[np * i + p]; + } + std::cout << std::endl; + } + + std::cout << " perf pressures and pref phase rates : " << std::endl; + for (int i = 0; i < nperf_total; ++i) { + std::cout << i << " " << perfPress()[i]; + for (int p = 0; p < np; ++p) { + std::cout << " " << perfPhaseRates()[np * i + p]; + } + std::cout << std::endl; + } + + std::cout << " locations of the top segments : " << std::endl; + for (int i = 0; i < nw; ++i) { + std::cout << i << " " << top_segment_loc_[i] << std::endl; + } + + std::cout << " output all the information from the wellMap " << std::endl; + + for (WellMapType::const_iterator iter = wellMap().begin(); iter != wellMap().end(); ++iter) { + std::cout << " well name : " << iter->first << std::endl; + const MapentryType &wellmapInfo = iter->second; + std::cout << " well number : " << wellmapInfo.well_number << " start segment " << wellmapInfo.start_segment + << " number of segment : " << wellmapInfo.number_of_segments << std::endl; + std::cout << " start perforation : " << wellmapInfo.start_perforation << " number of perforations : " << wellmapInfo.number_of_perforations << std::endl; + const int nseg_well = wellmapInfo.number_of_segments; + std::cout << " start performation ofr each segment and number of perforation that each segment has" << std::endl; + for (int i = 0; i < nseg_well; ++i) { + std::cout << " segment " << i << " start perforation " << wellmapInfo.start_perforation_segment[i] + << " number of perforations " << wellmapInfo.number_of_perforations_segment[i] << std::endl; + } + } + std::cout << " output the well state right after intialization is DONE! " << std::endl; + std::cin.ignore(); +#endif } std::vector& segPhaseRates() { return segphaserates_; } @@ -471,10 +472,11 @@ namespace Opm const WellMapType& wellMap() const { return wellMap_; } WellMapType& wellMap() { return wellMap_; } - const int numberOfPhases() const { return np_; } - const int numberOfSegments() const { return nseg_; } - const int numberOfPerforations() const { return nperf_; } - const int numberOfWells() const { return nwells_; } + int numberOfPhases() const { return np_; } + int numberOfSegments() const { return nseg_; } + int numberOfPerforations() const { return nperf_; } + int numberOfWells() const { return nwells_; } + private: std::vector bhp_; std::vector thp_;