From 8ff32b594a8cad43bd2d1ff373f04fb6175bd857 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 30 Apr 2021 08:38:45 +0200 Subject: [PATCH 1/5] TargetCalculator: remove unused wellstate member --- opm/simulators/wells/TargetCalculator.hpp | 3 --- opm/simulators/wells/WellGroupHelpers.cpp | 2 +- opm/simulators/wells/WellInterface_impl.hpp | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/TargetCalculator.hpp b/opm/simulators/wells/TargetCalculator.hpp index 2eabbc7c2..5c3a262c2 100644 --- a/opm/simulators/wells/TargetCalculator.hpp +++ b/opm/simulators/wells/TargetCalculator.hpp @@ -174,7 +174,6 @@ namespace WellGroupHelpers const std::vector& resv_coeff, const std::string& group_name, const double sales_target, - const WellStateFullyImplicitBlackoil& well_state, const GroupState& group_state, const Phase& injection_phase, DeferredLogger& deferred_logger) @@ -183,7 +182,6 @@ namespace WellGroupHelpers , resv_coeff_(resv_coeff) , group_name_(group_name) , sales_target_(sales_target) - , well_state_(well_state) , group_state_(group_state) { // initialize to avoid warning @@ -282,7 +280,6 @@ namespace WellGroupHelpers const std::vector& resv_coeff_; const std::string& group_name_; double sales_target_; - const WellStateFullyImplicitBlackoil& well_state_; const GroupState& group_state_; int pos_; GuideRateModel::Target target_; diff --git a/opm/simulators/wells/WellGroupHelpers.cpp b/opm/simulators/wells/WellGroupHelpers.cpp index 12cba2d6e..56d5e45cb 100644 --- a/opm/simulators/wells/WellGroupHelpers.cpp +++ b/opm/simulators/wells/WellGroupHelpers.cpp @@ -1151,7 +1151,7 @@ namespace WellGroupHelpers const auto& gconsale = schedule[reportStepIdx].gconsale().get(group.name(), summaryState); sales_target = gconsale.sales_target; } - InjectionTargetCalculator tcalc(currentGroupControl, pu, resv_coeff, group.name(), sales_target, wellState, group_state, injectionPhase, deferred_logger); + InjectionTargetCalculator tcalc(currentGroupControl, pu, resv_coeff, group.name(), sales_target, group_state, injectionPhase, deferred_logger); FractionCalculator fcalc(schedule, summaryState, wellState, group_state, reportStepIdx, guideRate, tcalc.guideTargetMode(), pu, false, injectionPhase); auto localFraction = [&](const std::string& child) { return fcalc.localFraction(child, name); }; diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 4d66dbdc5..f7f59d808 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -2242,7 +2242,7 @@ namespace Opm const auto& gconsale = schedule[current_step_].gconsale().get(group.name(), summaryState); sales_target = gconsale.sales_target; } - WellGroupHelpers::InjectionTargetCalculator tcalc(currentGroupControl, pu, resv_coeff, group.name(), sales_target, well_state, group_state, injectionPhase, deferred_logger); + WellGroupHelpers::InjectionTargetCalculator tcalc(currentGroupControl, pu, resv_coeff, group.name(), sales_target, group_state, injectionPhase, deferred_logger); WellGroupHelpers::FractionCalculator fcalc(schedule, summaryState, well_state, group_state, current_step_, guide_rate_, tcalc.guideTargetMode(), pu, false, injectionPhase); auto localFraction = [&](const std::string& child) { From 5dd5f5a8f44925a8a1f5f5fa1da0f2eca735cd23 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 30 Apr 2021 11:01:52 +0200 Subject: [PATCH 2/5] FractionCalculator: remove unused summary_state member --- opm/simulators/wells/WellGroupHelpers.cpp | 6 ++---- opm/simulators/wells/WellGroupHelpers.hpp | 2 -- opm/simulators/wells/WellInterface_impl.hpp | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/opm/simulators/wells/WellGroupHelpers.cpp b/opm/simulators/wells/WellGroupHelpers.cpp index 56d5e45cb..b3ceb2d4e 100644 --- a/opm/simulators/wells/WellGroupHelpers.cpp +++ b/opm/simulators/wells/WellGroupHelpers.cpp @@ -819,7 +819,6 @@ namespace WellGroupHelpers } FractionCalculator::FractionCalculator(const Schedule& schedule, - const SummaryState& summary_state, const WellStateFullyImplicitBlackoil& well_state, const GroupState& group_state, const int report_step, @@ -829,7 +828,6 @@ namespace WellGroupHelpers const bool is_producer, const Phase injection_phase) : schedule_(schedule) - , summary_state_(summary_state) , well_state_(well_state) , group_state_(group_state) , report_step_(report_step) @@ -1028,7 +1026,7 @@ namespace WellGroupHelpers gratTargetFromSales = group_state.grat_sales_target(group.name()); TargetCalculator tcalc(currentGroupControl, pu, resv_coeff, gratTargetFromSales); - FractionCalculator fcalc(schedule, summaryState, wellState, group_state, reportStepIdx, guideRate, tcalc.guideTargetMode(), pu, true, Phase::OIL); + FractionCalculator fcalc(schedule, wellState, group_state, reportStepIdx, guideRate, tcalc.guideTargetMode(), pu, true, Phase::OIL); auto localFraction = [&](const std::string& child) { return fcalc.localFraction(child, name); }; @@ -1152,7 +1150,7 @@ namespace WellGroupHelpers sales_target = gconsale.sales_target; } InjectionTargetCalculator tcalc(currentGroupControl, pu, resv_coeff, group.name(), sales_target, group_state, injectionPhase, deferred_logger); - FractionCalculator fcalc(schedule, summaryState, wellState, group_state, reportStepIdx, guideRate, tcalc.guideTargetMode(), pu, false, injectionPhase); + FractionCalculator fcalc(schedule, wellState, group_state, reportStepIdx, guideRate, tcalc.guideTargetMode(), pu, false, injectionPhase); auto localFraction = [&](const std::string& child) { return fcalc.localFraction(child, name); }; diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index b10e04334..fe27054bd 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -314,7 +314,6 @@ namespace WellGroupHelpers { public: FractionCalculator(const Schedule& schedule, - const SummaryState& summary_state, const WellStateFullyImplicitBlackoil& well_state, const GroupState& group_state, const int report_step, @@ -333,7 +332,6 @@ namespace WellGroupHelpers int groupControlledWells(const std::string& group_name, const std::string& always_included_child); GuideRate::RateVector getGroupRateVector(const std::string& group_name); const Schedule& schedule_; - const SummaryState& summary_state_; const WellStateFullyImplicitBlackoil& well_state_; const GroupState& group_state_; int report_step_; diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index f7f59d808..6ad0059fe 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -2243,7 +2243,7 @@ namespace Opm sales_target = gconsale.sales_target; } WellGroupHelpers::InjectionTargetCalculator tcalc(currentGroupControl, pu, resv_coeff, group.name(), sales_target, group_state, injectionPhase, deferred_logger); - WellGroupHelpers::FractionCalculator fcalc(schedule, summaryState, well_state, group_state, current_step_, guide_rate_, tcalc.guideTargetMode(), pu, false, injectionPhase); + WellGroupHelpers::FractionCalculator fcalc(schedule, well_state, group_state, current_step_, guide_rate_, tcalc.guideTargetMode(), pu, false, injectionPhase); auto localFraction = [&](const std::string& child) { return fcalc.localFraction(child, ""); @@ -2338,7 +2338,7 @@ namespace Opm gratTargetFromSales = group_state.grat_sales_target(group.name()); WellGroupHelpers::TargetCalculator tcalc(currentGroupControl, pu, resv_coeff, gratTargetFromSales); - WellGroupHelpers::FractionCalculator fcalc(schedule, summaryState, well_state, group_state, current_step_, guide_rate_, tcalc.guideTargetMode(), pu, true, Phase::OIL); + WellGroupHelpers::FractionCalculator fcalc(schedule, well_state, group_state, current_step_, guide_rate_, tcalc.guideTargetMode(), pu, true, Phase::OIL); auto localFraction = [&](const std::string& child) { return fcalc.localFraction(child, ""); From 3c77b97cae528bcc389aa71e8e6002d489daf9c3 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 30 Apr 2021 12:23:46 +0200 Subject: [PATCH 3/5] MultisegmentWellContribution: remove unused members --- .../linalg/bda/MultisegmentWellContribution.cpp | 7 ++----- .../linalg/bda/MultisegmentWellContribution.hpp | 9 ++------- opm/simulators/linalg/bda/WellContributions.cpp | 8 +++----- opm/simulators/linalg/bda/WellContributions.hpp | 7 ++----- opm/simulators/wells/MultisegmentWell_impl.hpp | 3 +-- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp b/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp index 0e6cb2e47..42f763ef2 100644 --- a/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp +++ b/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp @@ -30,19 +30,16 @@ namespace Opm { MultisegmentWellContribution::MultisegmentWellContribution(unsigned int dim_, unsigned int dim_wells_, - unsigned int Nb_, unsigned int Mb_, - unsigned int BnumBlocks_, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, + unsigned int Mb_, + std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, unsigned int DnumBlocks_, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues) : dim(dim_), // size of blockvectors in vectors x and y, equal to MultisegmentWell::numEq dim_wells(dim_wells_), // size of blocks in C, B and D, equal to MultisegmentWell::numWellEq - N(Nb_ * dim), // number of rows in vectors x and y, N == dim*Nb - Nb(Nb_), // number of blockrows in x and y M(Mb_ * dim_wells), // number of rows, M == dim_wells*Mb Mb(Mb_), // number of blockrows in C, D and B DnumBlocks(DnumBlocks_), // number of blocks in D - BnumBlocks(BnumBlocks_), // number of blocks in C and B // copy data for matrix D into vectors to prevent it going out of scope Dvals(Dvalues, Dvalues + DnumBlocks * dim_wells * dim_wells), Dcols(DcolPointers, DcolPointers + M + 1), diff --git a/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp b/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp index 3862b3840..a96f1106f 100644 --- a/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp +++ b/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp @@ -47,8 +47,6 @@ class MultisegmentWellContribution private: unsigned int dim; // size of blockvectors in vectors x and y, equal to MultisegmentWell::numEq unsigned int dim_wells; // size of blocks in C, B and D, equal to MultisegmentWell::numWellEq - unsigned int N; // number of rows in vectors x and y, N == dim*Nb - unsigned int Nb; // number of blockrows in x and y unsigned int M; // number of rows, M == dim_wells*Mb unsigned int Mb; // number of blockrows in C, D and B @@ -59,7 +57,6 @@ private: // C and B are stored in BCRS format, D is stored in CSC format (Dune::UMFPack) // Sparsity pattern for C is not stored, since it is the same as B unsigned int DnumBlocks; // number of blocks in D - unsigned int BnumBlocks; // number of blocks in C and B std::vector Cvals; std::vector Dvals; std::vector Bvals; @@ -97,9 +94,7 @@ public: /// The variables representing C, B and D will go out of scope when MultisegmentWell::addWellContribution() ends /// \param[in] dim size of blocks in blockvectors x and y, equal to MultisegmentWell::numEq /// \param[in] dim_wells size of blocks of C, B and D, equal to MultisegmentWell::numWellEq - /// \param[in] Nb number of blocks in vectors x and y /// \param[in] Mb number of blockrows in C, B and D - /// \param[in] BnumBlocks number of blocks in C and B /// \param[in] Bvalues nonzero values of matrix B /// \param[in] BcolIndices columnindices of blocks of matrix B /// \param[in] BrowPointers rowpointers of matrix B @@ -109,8 +104,8 @@ public: /// \param[in] DrowIndices rowindices of matrix D /// \param[in] Cvalues nonzero values of matrix C MultisegmentWellContribution(unsigned int dim, unsigned int dim_wells, - unsigned int Nb, unsigned int Mb, - unsigned int BnumBlocks, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, + unsigned int Mb, + std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues); diff --git a/opm/simulators/linalg/bda/WellContributions.cpp b/opm/simulators/linalg/bda/WellContributions.cpp index b6dc2b075..19fe818ac 100644 --- a/opm/simulators/linalg/bda/WellContributions.cpp +++ b/opm/simulators/linalg/bda/WellContributions.cpp @@ -253,15 +253,13 @@ void WellContributions::alloc() } void WellContributions::addMultisegmentWellContribution(unsigned int dim_, unsigned int dim_wells_, - unsigned int Nb_, unsigned int Mb, - unsigned int BnumBlocks, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, + unsigned int Mb, + std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues) { assert(dim==dim_); - this->Nb = Nb_; - this->N = Nb * dim_; - MultisegmentWellContribution *well = new MultisegmentWellContribution(dim_, dim_wells_, Nb, Mb, BnumBlocks, Bvalues, BcolIndices, BrowPointers, DnumBlocks, Dvalues, DcolPointers, DrowIndices, Cvalues); + MultisegmentWellContribution *well = new MultisegmentWellContribution(dim_, dim_wells_, Mb, Bvalues, BcolIndices, BrowPointers, DnumBlocks, Dvalues, DcolPointers, DrowIndices, Cvalues); multisegments.emplace_back(well); ++num_ms_wells; } diff --git a/opm/simulators/linalg/bda/WellContributions.hpp b/opm/simulators/linalg/bda/WellContributions.hpp index 5c93748c7..08607d6bc 100644 --- a/opm/simulators/linalg/bda/WellContributions.hpp +++ b/opm/simulators/linalg/bda/WellContributions.hpp @@ -81,7 +81,6 @@ private: bool allocated = false; unsigned int N; // number of rows (not blockrows) in vectors x and y - unsigned int Nb; // number of blockrows in vectors x and y unsigned int dim; // number of columns in blocks in B and C, equal to StandardWell::numEq unsigned int dim_wells; // number of rows in blocks in B and C, equal to StandardWell::numStaticWellEq unsigned int num_blocks = 0; // total number of blocks in all wells @@ -197,9 +196,7 @@ public: /// Matrices C and B are passed in Blocked CSR, matrix D in CSC /// \param[in] dim size of blocks in vectors x and y, equal to MultisegmentWell::numEq /// \param[in] dim_wells size of blocks of C, B and D, equal to MultisegmentWell::numWellEq - /// \param[in] Nb number of blocks in vectors x and y /// \param[in] Mb number of blockrows in C, B and D - /// \param[in] BnumBlocks number of blocks in C and B /// \param[in] Bvalues nonzero values of matrix B /// \param[in] BcolIndices columnindices of blocks of matrix B /// \param[in] BrowPointers rowpointers of matrix B @@ -209,8 +206,8 @@ public: /// \param[in] DrowIndices rowindices of matrix D /// \param[in] Cvalues nonzero values of matrix C void addMultisegmentWellContribution(unsigned int dim, unsigned int dim_wells, - unsigned int Nb, unsigned int Mb, - unsigned int BnumBlocks, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, + unsigned int Mb, + std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues); diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index c2a198a0a..68c9e1cd8 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -701,7 +701,6 @@ namespace Opm MultisegmentWell:: addWellContribution(WellContributions& wellContribs) const { - unsigned int Nb = duneB_.M(); // number of blockrows in matrix A unsigned int Mb = duneB_.N(); // number of blockrows in duneB_, duneC_ and duneD_ unsigned int BnumBlocks = duneB_.nonzeroes(); unsigned int DnumBlocks = duneD_.nonzeroes(); @@ -752,7 +751,7 @@ namespace Opm Brows.emplace_back(sumBlocks); } - wellContribs.addMultisegmentWellContribution(numEq, numWellEq, Nb, Mb, BnumBlocks, Bvals, Bcols, Brows, DnumBlocks, Dvals, Dcols, Drows, Cvals); + wellContribs.addMultisegmentWellContribution(numEq, numWellEq, Mb, Bvals, Bcols, Brows, DnumBlocks, Dvals, Dcols, Drows, Cvals); } #endif From e74b3249e92c5c32ae1f7054c0f2ba6222830298 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 30 Apr 2021 13:08:05 +0200 Subject: [PATCH 4/5] WGState: forward struct as struct --- opm/simulators/wells/WGState.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/wells/WGState.hpp b/opm/simulators/wells/WGState.hpp index d0cd41412..555b513b6 100644 --- a/opm/simulators/wells/WGState.hpp +++ b/opm/simulators/wells/WGState.hpp @@ -29,7 +29,7 @@ namespace Opm { Microscopic class to handle a pair of well and group state. */ -class PhaseUsage; +struct PhaseUsage; struct WGState { WGState(const PhaseUsage& pu); From a20085314807aa41cacb7354ad43752551acbb99 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 30 Apr 2021 13:08:48 +0200 Subject: [PATCH 5/5] anonymize unused parameters to quell warnings --- ebos/eclbasevanguard.hh | 2 +- ebos/eclpeacemanwell.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ebos/eclbasevanguard.hh b/ebos/eclbasevanguard.hh index 55bbb454f..0f225e502 100644 --- a/ebos/eclbasevanguard.hh +++ b/ebos/eclbasevanguard.hh @@ -850,7 +850,7 @@ protected: cellThickness_[elemIdx] = asImp_().computeCellThickness(element); } } - Scalar computeCellThickness(const Element& element) const { + Scalar computeCellThickness(const Element&) const { OPM_THROW(std::runtime_error, "cellThickness not implemented for this grid!"); } diff --git a/ebos/eclpeacemanwell.hh b/ebos/eclpeacemanwell.hh index d4356f1e2..f1a9abbac 100644 --- a/ebos/eclpeacemanwell.hh +++ b/ebos/eclpeacemanwell.hh @@ -1428,7 +1428,7 @@ protected: throw std::logic_error("commitWellState() method not implemented for class eclpeacemanwell"); } - void commitWGState(WGState wgstate) + void commitWGState(WGState) { throw std::logic_error("commitWellState() method not implemented for class eclpeacemanwell"); }