From 9458fcc4981f33032b19b2612edce7624466c753 Mon Sep 17 00:00:00 2001 From: babrodtk Date: Mon, 17 Aug 2015 08:47:33 +0200 Subject: [PATCH] Fixed several compiler warnings --- opm/core/pressure/tpfa/cfs_tpfa_residual.c | 1 + opm/core/pressure/tpfa/ifs_tpfa.c | 1 + opm/core/simulator/WellState.hpp | 2 +- opm/core/wells/WellsGroup.cpp | 12 ++++-- opm/core/wells/WellsManager.cpp | 49 ++++++++++++---------- tests/test_wells.cpp | 14 +++++-- 6 files changed, 49 insertions(+), 30 deletions(-) diff --git a/opm/core/pressure/tpfa/cfs_tpfa_residual.c b/opm/core/pressure/tpfa/cfs_tpfa_residual.c index c3c6040b7..f8ab9aede 100644 --- a/opm/core/pressure/tpfa/cfs_tpfa_residual.c +++ b/opm/core/pressure/tpfa/cfs_tpfa_residual.c @@ -876,6 +876,7 @@ assemble_completion_to_well(int i, int w, int c, int nc, int np, else { switch (well_controls_get_current_type(ctrl)) { case BHP : + case THP : // THP is implemented as a BHP target welleq_coeff_bhp(np, pw - well_controls_get_current_target( ctrl ), h, &res, &w2c, &w2w); break; diff --git a/opm/core/pressure/tpfa/ifs_tpfa.c b/opm/core/pressure/tpfa/ifs_tpfa.c index 84f4ac0a6..673e772e0 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.c +++ b/opm/core/pressure/tpfa/ifs_tpfa.c @@ -374,6 +374,7 @@ assemble_well_contrib(int nc , switch (well_controls_get_current_type(ctrls)) { case BHP: + case THP : // THP is implemented as a BHP target *all_rate = 0; assemble_bhp_well (nc, w, W, mt, wdp, h); break; diff --git a/opm/core/simulator/WellState.hpp b/opm/core/simulator/WellState.hpp index a3ee2e02c..faba9ec0e 100644 --- a/opm/core/simulator/WellState.hpp +++ b/opm/core/simulator/WellState.hpp @@ -124,9 +124,9 @@ namespace Opm // pressure in first perforation cell. switch (well_controls_get_current_type(ctrl)) { case BHP: + //Already taken care of above in 2. break; case THP: - //bhp_[w] = thp_[w]; //< TODO: ARB Adding this produces identical results as without THP control for artificial test case //Already taken care of above in 2. break; diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 8dd9a4ed3..bf80e4640 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -26,6 +26,12 @@ #include #include +namespace +{ + static double invalid_alq = -1e100; + static double invalid_vfp = -2147483647; +} //Namespace + namespace Opm { @@ -762,7 +768,7 @@ namespace Opm if (group_control_index_ < 0) { // The well only had its own controls, no group controls. append_well_controls(SURFACE_RATE, target, - -std::numeric_limits::max(), -std::numeric_limits::max(), + invalid_alq, invalid_vfp, distr, self_index_, wells_); group_control_index_ = well_controls_get_num(wells_->ctrls[self_index_]) - 1; } else { @@ -819,7 +825,7 @@ namespace Opm if (group_control_index_ < 0) { // The well only had its own controls, no group controls. - append_well_controls(wct, target, -1e100, -1e100, distr, self_index_, wells_); + append_well_controls(wct, target, invalid_alq, invalid_vfp, distr, self_index_, wells_); group_control_index_ = well_controls_get_num(wells_->ctrls[self_index_]) - 1; } else { // We will now modify the last control, that @@ -931,7 +937,7 @@ namespace Opm if (group_control_index_ < 0) { // The well only had its own controls, no group controls. - append_well_controls(wct, ntarget, -1e100, -1e100, distr, self_index_, wells_); + append_well_controls(wct, ntarget, invalid_alq, invalid_vfp, distr, self_index_, wells_); group_control_index_ = well_controls_get_num(wells_->ctrls[self_index_]) - 1; } else { // We will now modify the last control, that diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 6b7544501..444d9f40b 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -39,6 +39,11 @@ #include #include +namespace +{ + static double invalid_alq = -1e100; + static double invalid_vfp = -2147483647; +} //Namespace // Helper structs and functions for the implementation. namespace WellsManagerDetail @@ -452,8 +457,8 @@ namespace Opm ok = append_well_controls(SURFACE_RATE, injectionProperties.surfaceInjectionRate, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, distr, well_index, w_); @@ -474,8 +479,8 @@ namespace Opm ok = append_well_controls(RESERVOIR_RATE, injectionProperties.reservoirInjectionRate, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, distr, well_index, w_); @@ -485,8 +490,8 @@ namespace Opm control_pos[WellsManagerDetail::InjectionControl::BHP] = well_controls_get_num(w_->ctrls[well_index]); ok = append_well_controls(BHP, injectionProperties.BHPLimit, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, NULL, well_index, w_); @@ -498,7 +503,7 @@ namespace Opm const int vfp_number = injectionProperties.VFPTableNumber; ok = append_well_controls(THP, thp_limit, - -std::numeric_limits::max(), + invalid_alq, vfp_number, NULL, well_index, @@ -563,10 +568,10 @@ namespace Opm distr[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0; ok = append_well_controls(SURFACE_RATE, -productionProperties.OilRate, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, distr, - well_index, + well_index, w_); } @@ -579,8 +584,8 @@ namespace Opm distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0; ok = append_well_controls(SURFACE_RATE, -productionProperties.WaterRate, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, distr, well_index, w_); @@ -595,8 +600,8 @@ namespace Opm distr[phaseUsage.phase_pos[BlackoilPhases::Vapour]] = 1.0; ok = append_well_controls(SURFACE_RATE, -productionProperties.GasRate, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, distr, well_index, w_); @@ -614,9 +619,9 @@ namespace Opm distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0; distr[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0; ok = append_well_controls(SURFACE_RATE, - -productionProperties.LiquidRate , - -std::numeric_limits::max(), - -std::numeric_limits::max(), + -productionProperties.LiquidRate, + invalid_alq, + invalid_vfp, distr, well_index, w_); @@ -626,9 +631,9 @@ namespace Opm control_pos[WellsManagerDetail::ProductionControl::RESV] = well_controls_get_num(w_->ctrls[well_index]); double distr[3] = { 1.0, 1.0, 1.0 }; ok = append_well_controls(RESERVOIR_RATE, - -productionProperties.ResVRate , - -std::numeric_limits::max(), - -std::numeric_limits::max(), + -productionProperties.ResVRate, + invalid_alq, + invalid_vfp, distr, well_index, w_); @@ -656,8 +661,8 @@ namespace Opm control_pos[WellsManagerDetail::ProductionControl::BHP] = well_controls_get_num(w_->ctrls[well_index]); ok = append_well_controls(BHP, bhp_limit, - -std::numeric_limits::max(), - -std::numeric_limits::max(), + invalid_alq, + invalid_vfp, NULL, well_index, w_); diff --git a/tests/test_wells.cpp b/tests/test_wells.cpp index 57d8d297c..366fb3912 100644 --- a/tests/test_wells.cpp +++ b/tests/test_wells.cpp @@ -35,6 +35,12 @@ #include #include +namespace +{ + static double invalid_alq = -1e100; + static double invalid_vfp = -2147483647; +} //Namespace + BOOST_AUTO_TEST_CASE(Construction) { const int nphases = 2; @@ -98,11 +104,11 @@ BOOST_AUTO_TEST_CASE(Controls) if (ok) { const double distr[] = { 1.0, 0.0 }; const bool ok1 = append_well_controls(BHP, 1, - -1e100, -1e100, + invalid_alq, invalid_vfp, &distr[0], 0, W.get()); const bool ok2 = append_well_controls(SURFACE_RATE, 1, - -1e100, -1e100, + invalid_alq, invalid_vfp, &distr[0], 0, W.get()); @@ -155,11 +161,11 @@ BOOST_AUTO_TEST_CASE(Copy) for (int w = 0; ok && (w < W1->number_of_wells); ++w) { const double distr[] = { 1.0, 0.0 }; const bool okc1 = append_well_controls(BHP, 1, - -1e100, -1e100, + invalid_alq, invalid_vfp, &distr[0], w, W1.get()); const bool okc2 = append_well_controls(SURFACE_RATE, 1, - -1e100, -1e100, + invalid_alq, invalid_vfp, &distr[0], w, W1.get());