From 5b287e0ea85fbe2978a9fd293817c8b2c9dd5b3a Mon Sep 17 00:00:00 2001 From: babrodtk Date: Wed, 2 Sep 2015 13:02:27 +0200 Subject: [PATCH 1/3] Fixed warnings --- examples/sim_simple.cpp | 2 ++ opm/autodiff/BlackoilModel.hpp | 6 ++-- opm/autodiff/BlackoilModelBase_impl.hpp | 12 ++++++-- opm/autodiff/BlackoilPropsAdFromDeck.cpp | 30 +++++++++---------- opm/autodiff/BlackoilSolventModel_impl.hpp | 4 +-- .../ExtractParallelGridInformationToISTL.hpp | 4 +++ opm/autodiff/NewtonIterationBlackoilCPR.cpp | 6 ++-- opm/autodiff/NewtonIterationBlackoilCPR.hpp | 8 ++--- .../NewtonIterationBlackoilInterleaved.cpp | 6 ++-- .../NewtonIterationBlackoilInterleaved.hpp | 8 ++--- .../NewtonIterationBlackoilSimple.cpp | 4 +-- opm/autodiff/NewtonIterationUtilities.cpp | 2 ++ opm/autodiff/NewtonSolver_impl.hpp | 14 ++++----- opm/autodiff/RedistributeDataHandles.hpp | 10 +++---- opm/autodiff/VFPHelpers.hpp | 1 + opm/autodiff/VFPInjProperties.cpp | 28 ++++++++--------- opm/autodiff/VFPProdProperties.cpp | 28 ++++++++--------- 17 files changed, 97 insertions(+), 76 deletions(-) diff --git a/examples/sim_simple.cpp b/examples/sim_simple.cpp index caa824ee3..ca30f9674 100644 --- a/examples/sim_simple.cpp +++ b/examples/sim_simple.cpp @@ -28,11 +28,13 @@ #include #include +#include #if HAVE_SUITESPARSE_UMFPACK_H #include #else #include #endif +#include #include #include diff --git a/opm/autodiff/BlackoilModel.hpp b/opm/autodiff/BlackoilModel.hpp index bfcb2a81f..c5006b217 100644 --- a/opm/autodiff/BlackoilModel.hpp +++ b/opm/autodiff/BlackoilModel.hpp @@ -53,7 +53,7 @@ namespace Opm { /// \param[in] fluid fluid properties /// \param[in] geo rock properties /// \param[in] rock_comp_props if non-null, rock compressibility properties - /// \param[in] wells well structure + /// \param[in] wells_arg well structure /// \param[in] linsolver linear solver /// \param[in] eclState eclipse state /// \param[in] has_disgas turn on dissolved gas @@ -64,13 +64,13 @@ namespace Opm { const BlackoilPropsAdInterface& fluid, const DerivedGeology& geo, const RockCompressibility* rock_comp_props, - const Wells* wells, + const Wells* wells_arg, const NewtonIterationBlackoilInterface& linsolver, Opm::EclipseStateConstPtr eclState, const bool has_disgas, const bool has_vapoil, const bool terminal_output) - : Base(param, grid, fluid, geo, rock_comp_props, wells, linsolver, + : Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver, eclState, has_disgas, has_vapoil, terminal_output) { } diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index 0b7b1acf7..3dc0e138e 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -92,6 +92,7 @@ typedef Eigen::Array buildAllCells(const int nc) { @@ -146,7 +147,7 @@ namespace detail { const BlackoilPropsAdInterface& fluid, const DerivedGeology& geo , const RockCompressibility* rock_comp_props, - const Wells* wells, + const Wells* wells_arg, const NewtonIterationBlackoilInterface& linsolver, Opm::EclipseStateConstPtr eclState, const bool has_disgas, @@ -156,7 +157,7 @@ namespace detail { , fluid_ (fluid) , geo_ (geo) , rock_comp_props_(rock_comp_props) - , wells_ (wells) + , wells_ (wells_arg) , vfp_properties_(eclState->getTableManager()->getVFPInjTables(), eclState->getTableManager()->getVFPProdTables()) , linsolver_ (linsolver) , active_(detail::activePhases(fluid.phaseUsage())) @@ -657,6 +658,7 @@ namespace detail { } namespace detail { + inline double getGravity(const double* g, const int dim) { double grav = 0.0; if (g) { @@ -1103,6 +1105,7 @@ namespace detail { namespace detail { + inline double rateToCompare(const std::vector& well_phase_flow_rate, const int well, const int num_phases, @@ -1117,6 +1120,7 @@ namespace detail { return rate; } + inline bool constraintBroken(const std::vector& bhp, const std::vector& thp, const std::vector& well_phase_flow_rate, @@ -1194,6 +1198,7 @@ namespace detail { * @param well_perforation_densities Densities at well perforations * @param gravity Gravitational constant (e.g., 9.81...) */ + inline double computeHydrostaticCorrection(const Wells& wells, const int w, double vfp_ref_depth, const ADB::V& well_perforation_densities, const double gravity) { const double well_ref_depth = wells.depth_ref[w]; @@ -1205,6 +1210,7 @@ namespace detail { return dp; } + inline ADB::V computeHydrostaticCorrection(const Wells& wells, const ADB::V vfp_ref_depth, const ADB::V& well_perforation_densities, const double gravity) { const int nw = wells.number_of_wells; @@ -1646,6 +1652,7 @@ namespace detail { /// \param a The container to compute the infinity norm on. /// It has to have one entry for each cell. /// \param info In a parallel this holds the information about the data distribution. + inline double infinityNorm( const ADB& a, const boost::any& pinfo = boost::any() ) { static_cast(pinfo); // Suppress warning in non-MPI case. @@ -1673,6 +1680,7 @@ namespace detail { /// \brief Compute the L-infinity norm of a vector representing a well equation. /// \param a The container to compute the infinity norm on. /// \param info In a parallel this holds the information about the data distribution. + inline double infinityNormWell( const ADB& a, const boost::any& pinfo ) { static_cast(pinfo); // Suppress warning in non-MPI case. diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp index fed50e945..c0f74a745 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp @@ -698,29 +698,29 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& const ADB& sg, const Cells& cells) const { - const int numCells = cells.size(); - const int numActivePhases = numPhases(); - const int numBlocks = so.numBlocks(); + const int nCells = cells.size(); + const int nActivePhases = numPhases(); + const int nBlocks = so.numBlocks(); - Block activeSat(numCells, numActivePhases); + Block activeSat(nCells, nActivePhases); if (phase_usage_.phase_used[Water]) { - assert(sw.value().size() == numCells); + assert(sw.value().size() == nCells); activeSat.col(phase_usage_.phase_pos[Water]) = sw.value(); } if (phase_usage_.phase_used[Oil]) { - assert(so.value().size() == numCells); + assert(so.value().size() == nCells); activeSat.col(phase_usage_.phase_pos[Oil]) = so.value(); } else { OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::relperm() assumes oil phase is active."); } if (phase_usage_.phase_used[Gas]) { - assert(sg.value().size() == numCells); + assert(sg.value().size() == nCells); activeSat.col(phase_usage_.phase_pos[Gas]) = sg.value(); } - Block pc(numCells, numActivePhases); - Block dpc(numCells, numActivePhases*numActivePhases); - satprops_->capPress(numCells, activeSat.data(), cells.data(), pc.data(), dpc.data()); + Block pc(nCells, nActivePhases); + Block dpc(nCells, nActivePhases*nActivePhases); + satprops_->capPress(nCells, activeSat.data(), cells.data(), pc.data(), dpc.data()); std::vector adbCapPressures; adbCapPressures.reserve(3); @@ -728,18 +728,18 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& for (int phase1 = 0; phase1 < 3; ++phase1) { if (phase_usage_.phase_used[phase1]) { const int phase1_pos = phase_usage_.phase_pos[phase1]; - std::vector jacs(numBlocks); - for (int block = 0; block < numBlocks; ++block) { - jacs[block] = ADB::M(numCells, s[phase1]->derivative()[block].cols()); + std::vector jacs(nBlocks); + for (int block = 0; block < nBlocks; ++block) { + jacs[block] = ADB::M(nCells, s[phase1]->derivative()[block].cols()); } for (int phase2 = 0; phase2 < 3; ++phase2) { if (!phase_usage_.phase_used[phase2]) continue; const int phase2_pos = phase_usage_.phase_pos[phase2]; // Assemble dpc1/ds2. - const int column = phase1_pos + numActivePhases*phase2_pos; // Recall: Fortran ordering from props_.relperm() + const int column = phase1_pos + nActivePhases*phase2_pos; // Recall: Fortran ordering from props_.relperm() ADB::M dpc1_ds2_diag = spdiag(dpc.col(column)); - for (int block = 0; block < numBlocks; ++block) { + for (int block = 0; block < nBlocks; ++block) { ADB::M temp; fastSparseProduct(dpc1_ds2_diag, s[phase2]->derivative()[block], temp); jacs[block] += temp; diff --git a/opm/autodiff/BlackoilSolventModel_impl.hpp b/opm/autodiff/BlackoilSolventModel_impl.hpp index 9ac870cda..af1e1cdf0 100644 --- a/opm/autodiff/BlackoilSolventModel_impl.hpp +++ b/opm/autodiff/BlackoilSolventModel_impl.hpp @@ -76,14 +76,14 @@ namespace Opm { const DerivedGeology& geo, const RockCompressibility* rock_comp_props, const SolventPropsAdFromDeck& solvent_props, - const Wells* wells, + const Wells* wells_arg, const NewtonIterationBlackoilInterface& linsolver, const EclipseStateConstPtr eclState, const bool has_disgas, const bool has_vapoil, const bool terminal_output, const bool has_solvent) - : Base(param, grid, fluid, geo, rock_comp_props, wells, linsolver, + : Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver, eclState, has_disgas, has_vapoil, terminal_output), has_solvent_(has_solvent), solvent_pos_(detail::solventPos(fluid.phaseUsage())), diff --git a/opm/autodiff/ExtractParallelGridInformationToISTL.hpp b/opm/autodiff/ExtractParallelGridInformationToISTL.hpp index 71d2a3bb2..7a8c83693 100644 --- a/opm/autodiff/ExtractParallelGridInformationToISTL.hpp +++ b/opm/autodiff/ExtractParallelGridInformationToISTL.hpp @@ -21,9 +21,13 @@ #define OPM_EXTRACTPARALLELGRIDINFORMATIONTOISTL_HEADER_INCLUDED #ifdef HAVE_DUNE_CORNERPOINT +#include + #include #include +#include + namespace Opm { diff --git a/opm/autodiff/NewtonIterationBlackoilCPR.cpp b/opm/autodiff/NewtonIterationBlackoilCPR.cpp index 10664e107..27d1902dd 100644 --- a/opm/autodiff/NewtonIterationBlackoilCPR.cpp +++ b/opm/autodiff/NewtonIterationBlackoilCPR.cpp @@ -31,11 +31,13 @@ #include #include +#include #if HAVE_UMFPACK #include #else #include #endif +#include namespace Opm @@ -52,10 +54,10 @@ namespace Opm /// Construct a system solver. NewtonIterationBlackoilCPR::NewtonIterationBlackoilCPR(const parameter::ParameterGroup& param, - const boost::any& parallelInformation) + const boost::any& parallelInformation_arg) : cpr_param_( param ), iterations_( 0 ), - parallelInformation_(parallelInformation), + parallelInformation_(parallelInformation_arg), newton_use_gmres_( param.getDefault("newton_use_gmres", false ) ), linear_solver_reduction_( param.getDefault("linear_solver_reduction", 1e-2 ) ), linear_solver_maxiter_( param.getDefault("linear_solver_maxiter", 50 ) ), diff --git a/opm/autodiff/NewtonIterationBlackoilCPR.hpp b/opm/autodiff/NewtonIterationBlackoilCPR.hpp index 6a67ecd16..2b2d6bde5 100644 --- a/opm/autodiff/NewtonIterationBlackoilCPR.hpp +++ b/opm/autodiff/NewtonIterationBlackoilCPR.hpp @@ -87,18 +87,18 @@ namespace Opm template void constructPreconditionerAndSolve(O& opA, DuneMatrix& istlAe, Vector& x, Vector& istlb, - const P& parallelInformation, + const P& parallelInformation_arg, const P& parallelInformationAe, Dune::InverseOperatorResult& result) const { typedef Dune::ScalarProductChooser ScalarProductChooser; std::unique_ptr - sp(ScalarProductChooser::construct(parallelInformation)); + sp(ScalarProductChooser::construct(parallelInformation_arg)); // Construct preconditioner. // typedef Dune::SeqILU0 Preconditioner; typedef Opm::CPRPreconditioner Preconditioner; - parallelInformation.copyOwnerToAll(istlb, istlb); - Preconditioner precond(cpr_param_, opA.getmat(), istlAe, parallelInformation, + parallelInformation_arg.copyOwnerToAll(istlb, istlb); + Preconditioner precond(cpr_param_, opA.getmat(), istlAe, parallelInformation_arg, parallelInformationAe); // TODO: Revise when linear solvers interface opm-core is done diff --git a/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp b/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp index fc903374d..3fb8d80c3 100644 --- a/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp +++ b/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp @@ -30,11 +30,13 @@ #include #include +#include #if HAVE_UMFPACK #include #else #include #endif +#include namespace Opm @@ -51,9 +53,9 @@ namespace Opm /// Construct a system solver. NewtonIterationBlackoilInterleaved::NewtonIterationBlackoilInterleaved(const parameter::ParameterGroup& param, - const boost::any& parallelInformation) + const boost::any& parallelInformation_arg) : iterations_( 0 ), - parallelInformation_(parallelInformation), + parallelInformation_(parallelInformation_arg), newton_use_gmres_( param.getDefault("newton_use_gmres", false ) ), linear_solver_reduction_( param.getDefault("linear_solver_reduction", 1e-2 ) ), linear_solver_maxiter_( param.getDefault("linear_solver_maxiter", 50 ) ), diff --git a/opm/autodiff/NewtonIterationBlackoilInterleaved.hpp b/opm/autodiff/NewtonIterationBlackoilInterleaved.hpp index dd0731619..16282a320 100644 --- a/opm/autodiff/NewtonIterationBlackoilInterleaved.hpp +++ b/opm/autodiff/NewtonIterationBlackoilInterleaved.hpp @@ -92,19 +92,19 @@ namespace Opm template void constructPreconditionerAndSolve(O& opA, Vector& x, Vector& istlb, - const POrComm& parallelInformation, + const POrComm& parallelInformation_arg, Dune::InverseOperatorResult& result) const { // Construct scalar product. typedef Dune::ScalarProductChooser ScalarProductChooser; typedef std::unique_ptr SPPointer; - SPPointer sp(ScalarProductChooser::construct(parallelInformation)); + SPPointer sp(ScalarProductChooser::construct(parallelInformation_arg)); // Construct preconditioner. - auto precond = constructPrecond(opA, parallelInformation); + auto precond = constructPrecond(opA, parallelInformation_arg); // Communicate if parallel. - parallelInformation.copyOwnerToAll(istlb, istlb); + parallelInformation_arg.copyOwnerToAll(istlb, istlb); // Solve. solve(opA, x, istlb, *sp, precond, result); diff --git a/opm/autodiff/NewtonIterationBlackoilSimple.cpp b/opm/autodiff/NewtonIterationBlackoilSimple.cpp index bc15c5471..b7a0d89f4 100644 --- a/opm/autodiff/NewtonIterationBlackoilSimple.cpp +++ b/opm/autodiff/NewtonIterationBlackoilSimple.cpp @@ -33,8 +33,8 @@ namespace Opm /// \param[in] parallelInformation In the case of a parallel run /// with dune-istl the information about the parallelization. NewtonIterationBlackoilSimple::NewtonIterationBlackoilSimple(const parameter::ParameterGroup& param, - const boost::any& parallelInformation) - : iterations_( 0 ), parallelInformation_(parallelInformation) + const boost::any& parallelInformation_arg) + : iterations_( 0 ), parallelInformation_(parallelInformation_arg) { linsolver_.reset(new LinearSolverFactory(param)); } diff --git a/opm/autodiff/NewtonIterationUtilities.cpp b/opm/autodiff/NewtonIterationUtilities.cpp index aa78eaee6..71c389280 100644 --- a/opm/autodiff/NewtonIterationUtilities.cpp +++ b/opm/autodiff/NewtonIterationUtilities.cpp @@ -24,11 +24,13 @@ #include #include +#include #if HAVE_UMFPACK #include #else #include #endif +#include namespace Opm { diff --git a/opm/autodiff/NewtonSolver_impl.hpp b/opm/autodiff/NewtonSolver_impl.hpp index 1e931b6ef..2599f90f1 100644 --- a/opm/autodiff/NewtonSolver_impl.hpp +++ b/opm/autodiff/NewtonSolver_impl.hpp @@ -77,7 +77,7 @@ namespace Opm bool isOscillate = false; bool isStagnate = false; const enum RelaxType relaxtype = relaxType(); - int linearIterations = 0; + int linIters = 0; // ---------- Main Newton loop ---------- while ( (!converged && (iteration < maxIter())) || (minIter() > iteration)) { @@ -85,7 +85,7 @@ namespace Opm V dx = model_->solveJacobianSystem(); // Store number of linear iterations used. - linearIterations += model_->linearIterationsLastSolve(); + linIters += model_->linearIterationsLastSolve(); // Stabilize the Newton update. detectNewtonOscillations(residual_norms_history, iteration, relaxRelTol(), isOscillate, isStagnate); @@ -119,15 +119,15 @@ namespace Opm return -1; // -1 indicates that the solver has to be restarted } - linearIterations_ += linearIterations; + linearIterations_ += linIters; newtonIterations_ += iteration; - linearIterationsLast_ = linearIterations; + linearIterationsLast_ = linIters; newtonIterationsLast_ = iteration; // Do model-specific post-step actions. model_->afterStep(dt, reservoir_state, well_state); - return linearIterations; + return linIters; } @@ -178,7 +178,7 @@ namespace Opm template void NewtonSolver::detectNewtonOscillations(const std::vector>& residual_history, - const int it, const double relaxRelTol, + const int it, const double relaxRelTol_arg, bool& oscillate, bool& stagnate) const { // The detection of oscillation in two primary variable results in the report of the detection @@ -201,7 +201,7 @@ namespace Opm const double d1 = std::abs((F0[p] - F2[p]) / F0[p]); const double d2 = std::abs((F0[p] - F1[p]) / F0[p]); - oscillatePhase += (d1 < relaxRelTol) && (relaxRelTol < d2); + oscillatePhase += (d1 < relaxRelTol_arg) && (relaxRelTol_arg < d2); // Process is 'stagnate' unless at least one phase // exhibits significant residual change. diff --git a/opm/autodiff/RedistributeDataHandles.hpp b/opm/autodiff/RedistributeDataHandles.hpp index 2f6377b15..9bab1dcb6 100644 --- a/opm/autodiff/RedistributeDataHandles.hpp +++ b/opm/autodiff/RedistributeDataHandles.hpp @@ -180,11 +180,11 @@ public: } } template - void scatter(B& buffer, const T& e, std::size_t size) + void scatter(B& buffer, const T& e, std::size_t size_arg) { assert( T::codimension == 0); - assert( int(size) == 2 * recvState_.numPhases() +4+2*recvGrid_.numCellFaces(e.index())); - static_cast(size); + assert( int(size_arg) == 2 * recvState_.numPhases() +4+2*recvGrid_.numCellFaces(e.index())); + static_cast(size_arg); double val; for ( int i=0; i - void scatter(B& buffer, const T& e, std::size_t size) + void scatter(B& buffer, const T& e, std::size_t size_arg) { assert( T::codimension == 0); - assert( size==size_ ); (void) size; + assert( size_arg==size_ ); (void) size_arg; double val; buffer.read(val); recvProps_.cellPvtRegionIdx_[e.index()]=val; diff --git a/opm/autodiff/VFPHelpers.hpp b/opm/autodiff/VFPHelpers.hpp index 6a9d5fdd7..6220b71de 100644 --- a/opm/autodiff/VFPHelpers.hpp +++ b/opm/autodiff/VFPHelpers.hpp @@ -910,6 +910,7 @@ inline double findTHP( } //Canary in a coal mine: shouldn't really be required assert(found == true); + static_cast(found); //Silence compiler warning const double& x0 = thp_array[i ]; const double& x1 = thp_array[i+1]; diff --git a/opm/autodiff/VFPInjProperties.cpp b/opm/autodiff/VFPInjProperties.cpp index 814ba00e2..fb1345ce8 100644 --- a/opm/autodiff/VFPInjProperties.cpp +++ b/opm/autodiff/VFPInjProperties.cpp @@ -74,7 +74,7 @@ VFPInjProperties::VFPInjProperties(const std::map& tables) { VFPInjProperties::ADB VFPInjProperties::bhp(const std::vector& table_id, const Wells& wells, const ADB& qs, - const ADB& thp) const { + const ADB& thp_val) const { const int nw = wells.number_of_wells; //Short-hands for water / oil / gas phases @@ -84,7 +84,7 @@ VFPInjProperties::ADB VFPInjProperties::bhp(const std::vector& table_id, const ADB& o = subset(qs, Span(nw, 1, BlackoilPhases::Liquid*nw)); const ADB& g = subset(qs, Span(nw, 1, BlackoilPhases::Vapour*nw)); - return bhp(table_id, w, o, g, thp); + return bhp(table_id, w, o, g, thp_val); } @@ -97,16 +97,16 @@ VFPInjProperties::ADB VFPInjProperties::bhp(const std::vector& table_id, const ADB& aqua, const ADB& liquid, const ADB& vapour, - const ADB& thp) const { - const int nw = thp.size(); + const ADB& thp_arg) const { + const int nw = thp_arg.size(); - std::vector block_pattern = detail::commonBlockPattern(aqua, liquid, vapour, thp); + std::vector block_pattern = detail::commonBlockPattern(aqua, liquid, vapour, thp_arg); assert(static_cast(table_id.size()) == nw); assert(aqua.size() == nw); assert(liquid.size() == nw); assert(vapour.size() == nw); - assert(thp.size() == nw); + assert(thp_arg.size() == nw); //Allocate data for bhp's and partial derivatives ADB::V value = ADB::V::Zero(nw); @@ -130,7 +130,7 @@ VFPInjProperties::ADB VFPInjProperties::bhp(const std::vector& table_id, if (table != nullptr) { //First, find the values to interpolate between auto flo_i = detail::findInterpData(flo.value()[i], table->getFloAxis()); - auto thp_i = detail::findInterpData(thp.value()[i], table->getTHPAxis()); + auto thp_i = detail::findInterpData(thp_arg.value()[i], table->getTHPAxis()); detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i); @@ -155,8 +155,8 @@ VFPInjProperties::ADB VFPInjProperties::bhp(const std::vector& table_id, //but may not save too much on that. jacs[block] = ADB::M(nw, block_pattern[block]); - if (!thp.derivative().empty()) { - jacs[block] += dthp_diag * thp.derivative()[block]; + if (!thp_arg.derivative().empty()) { + jacs[block] += dthp_diag * thp_arg.derivative()[block]; } if (!flo.derivative().empty()) { jacs[block] += dflo_diag * flo.derivative()[block]; @@ -175,10 +175,10 @@ double VFPInjProperties::bhp(int table_id, const double& aqua, const double& liquid, const double& vapour, - const double& thp) const { + const double& thp_arg) const { const VFPInjTable* table = detail::getTable(m_tables, table_id); - detail::VFPEvaluation retval = detail::bhp(table, aqua, liquid, vapour, thp); + detail::VFPEvaluation retval = detail::bhp(table, aqua, liquid, vapour, thp_arg); return retval.value; } @@ -193,7 +193,7 @@ double VFPInjProperties::thp(int table_id, const double& aqua, const double& liquid, const double& vapour, - const double& bhp) const { + const double& bhp_arg) const { const VFPInjTable* table = detail::getTable(m_tables, table_id); const VFPInjTable::array_type& data = table->getTable(); @@ -215,8 +215,8 @@ double VFPInjProperties::thp(int table_id, bhp_array[i] = detail::interpolate(data, flo_i, thp_i).value; } - double thp = detail::findTHP(bhp_array, thp_array, bhp); - return thp; + double retval = detail::findTHP(bhp_array, thp_array, bhp_arg); + return retval; } diff --git a/opm/autodiff/VFPProdProperties.cpp b/opm/autodiff/VFPProdProperties.cpp index 84d4b2601..f69280b29 100644 --- a/opm/autodiff/VFPProdProperties.cpp +++ b/opm/autodiff/VFPProdProperties.cpp @@ -59,7 +59,7 @@ VFPProdProperties::VFPProdProperties(const std::map& tables) VFPProdProperties::ADB VFPProdProperties::bhp(const std::vector& table_id, const Wells& wells, const ADB& qs, - const ADB& thp, + const ADB& thp_arg, const ADB& alq) const { const int nw = wells.number_of_wells; @@ -70,7 +70,7 @@ VFPProdProperties::ADB VFPProdProperties::bhp(const std::vector& table_id, const ADB& o = subset(qs, Span(nw, 1, BlackoilPhases::Liquid*nw)); const ADB& g = subset(qs, Span(nw, 1, BlackoilPhases::Vapour*nw)); - return bhp(table_id, w, o, g, thp, alq); + return bhp(table_id, w, o, g, thp_arg, alq); } @@ -82,17 +82,17 @@ VFPProdProperties::ADB VFPProdProperties::bhp(const std::vector& table_id, const ADB& aqua, const ADB& liquid, const ADB& vapour, - const ADB& thp, + const ADB& thp_arg, const ADB& alq) const { - const int nw = thp.size(); + const int nw = thp_arg.size(); - std::vector block_pattern = detail::commonBlockPattern(aqua, liquid, vapour, thp, alq); + std::vector block_pattern = detail::commonBlockPattern(aqua, liquid, vapour, thp_arg, alq); assert(static_cast(table_id.size()) == nw); assert(aqua.size() == nw); assert(liquid.size() == nw); assert(vapour.size() == nw); - assert(thp.size() == nw); + assert(thp_arg.size() == nw); assert(alq.size() == nw); //Allocate data for bhp's and partial derivatives @@ -123,7 +123,7 @@ VFPProdProperties::ADB VFPProdProperties::bhp(const std::vector& table_id, //First, find the values to interpolate between //Value of FLO is negative in OPM for producers, but positive in VFP table auto flo_i = detail::findInterpData(-flo.value()[i], table->getFloAxis()); - auto thp_i = detail::findInterpData( thp.value()[i], table->getTHPAxis()); + auto thp_i = detail::findInterpData( thp_arg.value()[i], table->getTHPAxis()); auto wfr_i = detail::findInterpData( wfr.value()[i], table->getWFRAxis()); auto gfr_i = detail::findInterpData( gfr.value()[i], table->getGFRAxis()); auto alq_i = detail::findInterpData( alq.value()[i], table->getALQAxis()); @@ -157,8 +157,8 @@ VFPProdProperties::ADB VFPProdProperties::bhp(const std::vector& table_id, //but may not save too much on that. jacs[block] = ADB::M(nw, block_pattern[block]); - if (!thp.derivative().empty()) { - jacs[block] += dthp_diag * thp.derivative()[block]; + if (!thp_arg.derivative().empty()) { + jacs[block] += dthp_diag * thp_arg.derivative()[block]; } if (!wfr.derivative().empty()) { jacs[block] += dwfr_diag * wfr.derivative()[block]; @@ -184,11 +184,11 @@ double VFPProdProperties::bhp(int table_id, const double& aqua, const double& liquid, const double& vapour, - const double& thp, + const double& thp_arg, const double& alq) const { const VFPProdTable* table = detail::getTable(m_tables, table_id); - detail::VFPEvaluation retval = detail::bhp(table, aqua, liquid, vapour, thp, alq); + detail::VFPEvaluation retval = detail::bhp(table, aqua, liquid, vapour, thp_arg, alq); return retval.value; } @@ -198,7 +198,7 @@ double VFPProdProperties::thp(int table_id, const double& aqua, const double& liquid, const double& vapour, - const double& bhp, + const double& bhp_arg, const double& alq) const { const VFPProdTable* table = detail::getTable(m_tables, table_id); const VFPProdTable::array_type& data = table->getTable(); @@ -227,8 +227,8 @@ double VFPProdProperties::thp(int table_id, bhp_array[i] = detail::interpolate(data, flo_i, thp_i, wfr_i, gfr_i, alq_i).value; } - double thp = detail::findTHP(bhp_array, thp_array, bhp); - return thp; + double retval = detail::findTHP(bhp_array, thp_array, bhp_arg); + return retval; } From 91a6f4fc4a9daf9b573381fb46dc9a67bbb2c52f Mon Sep 17 00:00:00 2001 From: babrodtk Date: Wed, 2 Sep 2015 13:14:20 +0200 Subject: [PATCH 2/3] Fixed a few more warnings --- opm/autodiff/BlackoilPropsAdFromDeck.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp index c0f74a745..f27adcb05 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp @@ -40,6 +40,18 @@ #include #include + +namespace { + inline + void silenceCompilerWarnings() { + static_cast(Opm::unit::stb); + static_cast(Opm::unit::liter); + static_cast(Opm::unit::barsa); + static_cast(Opm::unit::psia); + static_cast(Opm::unit::darcy); + } +} + namespace Opm { // Making these typedef to make the code more readable. From 7ea047b9c7389f037ec799f043a5ebc70273446b Mon Sep 17 00:00:00 2001 From: babrodtk Date: Wed, 2 Sep 2015 14:16:56 +0200 Subject: [PATCH 3/3] Removed superfluous changes --- opm/autodiff/BlackoilPropsAdFromDeck.cpp | 12 ------------ .../ExtractParallelGridInformationToISTL.hpp | 4 ---- 2 files changed, 16 deletions(-) diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp index f27adcb05..c0f74a745 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp @@ -40,18 +40,6 @@ #include #include - -namespace { - inline - void silenceCompilerWarnings() { - static_cast(Opm::unit::stb); - static_cast(Opm::unit::liter); - static_cast(Opm::unit::barsa); - static_cast(Opm::unit::psia); - static_cast(Opm::unit::darcy); - } -} - namespace Opm { // Making these typedef to make the code more readable. diff --git a/opm/autodiff/ExtractParallelGridInformationToISTL.hpp b/opm/autodiff/ExtractParallelGridInformationToISTL.hpp index 7a8c83693..71d2a3bb2 100644 --- a/opm/autodiff/ExtractParallelGridInformationToISTL.hpp +++ b/opm/autodiff/ExtractParallelGridInformationToISTL.hpp @@ -21,13 +21,9 @@ #define OPM_EXTRACTPARALLELGRIDINFORMATIONTOISTL_HEADER_INCLUDED #ifdef HAVE_DUNE_CORNERPOINT -#include - #include #include -#include - namespace Opm {