From e245f0ae50a41cb21ecdc7a1e908c3e248eceea5 Mon Sep 17 00:00:00 2001 From: hnil Date: Mon, 20 Jun 2022 14:45:55 +0200 Subject: [PATCH] added possibility for doing well contributions separately, still error --- .../discretization/common/linearizertpfa.hh | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/opm/models/discretization/common/linearizertpfa.hh b/opm/models/discretization/common/linearizertpfa.hh index b9ab8221f..48eb22845 100644 --- a/opm/models/discretization/common/linearizertpfa.hh +++ b/opm/models/discretization/common/linearizertpfa.hh @@ -432,8 +432,8 @@ private: } } - - void setResAndJacobi(VectorBlock& res,MatrixBlock& bMat,const ADVectorBlock& resid){ +public: + void setResAndJacobi(VectorBlock& res,MatrixBlock& bMat,const ADVectorBlock& resid) const{ for (unsigned eqIdx = 0; eqIdx < numEq; eqIdx++) res[eqIdx] = resid[eqIdx].value(); @@ -447,9 +447,10 @@ private: } } } +private: void linearizeGlobalTPFA_() { - + const bool well_local = true; resetSystem_(); unsigned numCells = model_().numTotalDof(); for(unsigned globI = 0; globI < numCells; globI++){ @@ -476,14 +477,16 @@ private: residual_[globI] += res; jacobian_->addToBlock(globI, globI, bMat); // wells sources for now (should be moved out) - res = 0.0; - bMat = 0.0; - adres = 0.0; - LocalResidual::computeSource(adres, problem_(), globI, 0); - adres *= -volume; - setResAndJacobi(res, bMat, adres); - residual_[globI] += res; - jacobian_->addToBlock(globI, globI, bMat); + if(well_local){ + res = 0.0; + bMat = 0.0; + adres = 0.0; + LocalResidual::computeSource(adres, problem_(), globI, 0); + adres *= -volume; + setResAndJacobi(res, bMat, adres); + residual_[globI] += res; + jacobian_->addToBlock(globI, globI, bMat); + } for(const auto& globJ: neighbours){ assert(globJ != globI); res = 0.0; @@ -508,6 +511,9 @@ private: bMat *= -1.0; jacobian_->addToBlock(globJ, globI, bMat); } + if(not(well_local)){ + problem_().wellModel().addReseroirSourceTerms(residual_,*jacobian_); + } } // before the first iteration of each time step, we need to update the