diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 4e96454bb..ae3926bad 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -273,33 +273,8 @@ namespace Opm { void addWellContributions(SparseMatrixAdapter& jacobian) const; - void addReseroirSourceTerms(GlobalEqVector& residual, - SparseMatrixAdapter& jacobian) const - { - // NB this loop may write to same element if a cell has more than one perforation -#ifdef _OPENMP -#pragma omp parallel for -#endif - for(size_t i = 0; i < well_container_.size(); i++){// to be sure open understand - const auto& well = well_container_[i]; - if(!well->isOperableAndSolvable() && !well->wellIsStopped()) - continue; - - const auto& cells = well->cells(); - const auto& rates = well->connectionRates(); - for (unsigned perfIdx = 0; perfIdx < rates.size(); ++perfIdx) { - unsigned cellIdx = cells[perfIdx]; - auto rate = rates[perfIdx]; - // Scalar volume = ebosSimulator_.problem().volume(cellIdx,0); - rate *= -1.0; - VectorBlockType res(0.0); - MatrixBlockType bMat(0.0); - ebosSimulator_.model().linearizer().setResAndJacobi(res,bMat,rate); - residual[cellIdx] += res; - jacobian.addToBlock(cellIdx,cellIdx,bMat); - } - } - } + void addReservoirSourceTerms(GlobalEqVector& residual, + SparseMatrixAdapter& jacobian) const; // called at the beginning of a report step void beginReportStep(const int time_step); diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index b28fa609e..da53e4782 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1202,6 +1202,36 @@ namespace Opm { } } + template + void + BlackoilWellModel:: + addReservoirSourceTerms(GlobalEqVector& residual, + SparseMatrixAdapter& jacobian) const + { + // NB this loop may write to same element if a cell has more than one perforation +#ifdef _OPENMP +#pragma omp parallel for +#endif + for (size_t i = 0; i < well_container_.size(); i++) { + const auto& well = well_container_[i]; + if (!well->isOperableAndSolvable() && !well->wellIsStopped()) + continue; + const auto& cells = well->cells(); + const auto& rates = well->connectionRates(); + for (unsigned perfIdx = 0; perfIdx < rates.size(); ++perfIdx) { + unsigned cellIdx = cells[perfIdx]; + auto rate = rates[perfIdx]; + // Scalar volume = ebosSimulator_.model().dofTotalVolume(cellIdx); + rate *= -1.0; + VectorBlockType res(0.0); + MatrixBlockType bMat(0.0); + ebosSimulator_.model().linearizer().setResAndJacobi(res, bMat, rate); + residual[cellIdx] += res; + jacobian.addToBlock(cellIdx, cellIdx, bMat); + } + } + } + template void BlackoilWellModel::