diff --git a/opm/autodiff/StandardWellsDense.hpp b/opm/autodiff/StandardWellsDense.hpp index 1e43c0f86..fcd4d5bcd 100644 --- a/opm/autodiff/StandardWellsDense.hpp +++ b/opm/autodiff/StandardWellsDense.hpp @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include @@ -37,8 +35,6 @@ #include #include -#include -#include #include #include #include @@ -66,29 +62,16 @@ namespace Opm { public: // --------- Types --------- - using ADB = AutoDiffBlock; - typedef DenseAd::Evaluation EvalWell; typedef WellStateFullyImplicitBlackoilDense WellState; typedef BlackoilModelParameters ModelParameters; - //typedef AutoDiffBlock ADB; - using Vector = ADB::V; - using V = ADB::V; - typedef ADB::M M; typedef double Scalar; - typedef Dune::FieldVector VectorBlockType; - typedef Dune::FieldMatrix MatrixBlockType; - typedef Dune::BCRSMatrix Mat; - typedef Dune::BlockVector BVector; + typedef Dune::FieldVector VectorBlockType; + typedef Dune::FieldMatrix MatrixBlockType; + typedef Dune::BCRSMatrix Mat; + typedef Dune::BlockVector BVector; - - // copied from BlackoilModelBase - // should put to somewhere better - using DataBlock = Eigen::Array; // --------- Public methods --------- StandardWellsDense(const Wells* wells_arg, const ModelParameters& param, @@ -697,36 +680,41 @@ namespace Opm { bool getWellConvergence(Simulator& ebosSimulator, const int iteration) { + typedef std::vector< double > Vector; const int np = numPhases(); const int nc = numCells(); const double tol_wells = param_.tolerance_wells_; const double maxResidualAllowed = param_.max_residual_allowed_; - 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); + Vector R_sum(np); + Vector B_avg(np); + Vector maxCoeff(np); + Vector maxNormWell(np); + + std::vector< Vector > B( np, Vector( nc ) ); + std::vector< Vector > R2( np, Vector( nc ) ); + std::vector< Vector > tempV( np, Vector( nc ) ); for ( int idx = 0; idx < np; ++idx ) { - V b(nc); + Vector& B_idx = B[ idx ]; + const int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx); + for (int cell_idx = 0; cell_idx < nc; ++cell_idx) { const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0)); const auto& fs = intQuants.fluidState(); - int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx); - - b[cell_idx] = 1 / fs.invB(ebosPhaseIdx).value(); + B_idx [cell_idx] = 1 / fs.invB(ebosPhaseIdx).value(); } - B.col(idx) = b; } - detail::convergenceReduction(B, tempV, R, R_sum, maxCoeff, B_avg, maxNormWell, nc, np, pv_, residual()); + detail::convergenceReduction(B, tempV, R2, + R_sum, maxCoeff, B_avg, maxNormWell, + nc, np, pv_, residual() ); + + + Vector well_flux_residual(np); - std::vector well_flux_residual(np); bool converged_Well = true; // Finish computation for ( int idx = 0; idx < np; ++idx )