diff --git a/opm/autodiff/BlackoilModelBase.hpp b/opm/autodiff/BlackoilModelBase.hpp index 970f0f8f3..3d61bc135 100644 --- a/opm/autodiff/BlackoilModelBase.hpp +++ b/opm/autodiff/BlackoilModelBase.hpp @@ -493,12 +493,12 @@ namespace Opm { /// \param[in] nw The number of wells on the local grid. /// \return The total pore volume over all cells. double - convergenceReduction(const Eigen::Array& B, - const Eigen::Array& tempV, - const Eigen::Array& R, - std::array& R_sum, - std::array& maxCoeff, - std::array& B_avg, + convergenceReduction(const Eigen::Array& B, + const Eigen::Array& tempV, + const Eigen::Array& R, + std::vector& R_sum, + std::vector& maxCoeff, + std::vector& B_avg, std::vector& maxNormWell, int nc, int nw) const; diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index 41a5e7424..53d09d059 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -2275,16 +2275,18 @@ namespace detail { template double - BlackoilModelBase::convergenceReduction(const Eigen::Array& B, - const Eigen::Array& tempV, - const Eigen::Array& R, - std::array& R_sum, - std::array& maxCoeff, - std::array& B_avg, - std::vector& maxNormWell, - int nc, - int nw) const + BlackoilModelBase::convergenceReduction(const Eigen::Array& B, + const Eigen::Array& tempV, + const Eigen::Array& R, + std::vector& R_sum, + std::vector& maxCoeff, + std::vector& B_avg, + std::vector& maxNormWell, + int nc, + int nw) const { + const int num_elems = B.cols(); + // Do the global reductions #if HAVE_MPI if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) @@ -2332,21 +2334,20 @@ namespace detail { else #endif { - for ( int idx=0; idx cond = phaseCondition(); - std::array CNV = {{0., 0., 0.}}; - std::array R_sum = {{0., 0., 0.}}; - std::array B_avg = {{0., 0., 0.}}; - std::array maxCoeff = {{0., 0., 0.}}; - std::array mass_balance_residual = {{0., 0., 0.}}; - std::array well_flux_residual = {{0., 0., 0.}}; - std::size_t cols = MaxNumPhases; // needed to pass the correct type to Eigen - Eigen::Array B(nc, cols); - Eigen::Array R(nc, cols); - Eigen::Array tempV(nc, cols); - std::vector maxNormWell(MaxNumPhases); + std::vector R_sum(np); + std::vector B_avg(np); + std::vector maxCoeff(np); + std::vector maxNormWell(np); + Eigen::Array B(nc, np); + Eigen::Array R(nc, np); + Eigen::Array tempV(nc, np); - for ( int idx=0; idx CNV(np); + std::vector mass_balance_residual(np); + std::vector well_flux_residual(np); bool converged_MB = true; bool converged_CNV = true; bool converged_Well = true; // Finish computation - for ( int idx=0; idx R_sum = {{0., 0., 0.}}; - std::array B_avg = {{0., 0., 0.}}; - std::array maxCoeff = {{0., 0., 0.}}; - std::array well_flux_residual = {{0., 0., 0.}}; + std::vector R_sum(np); + std::vector B_avg(np); + std::vector maxCoeff(np); std::size_t cols = MaxNumPhases; // needed to pass the correct type to Eigen Eigen::Array B(nc, cols); Eigen::Array R(nc, cols); Eigen::Array tempV(nc, cols); std::vector maxNormWell(MaxNumPhases); - for ( int idx=0; idx well_flux_residual(np); bool converged_Well = true; // Finish computation - for ( int idx=0; idx