From 8da01a317d8ebbd4d4f824dedfd8607fa2706b0d Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 26 Feb 2016 15:00:30 +0100 Subject: [PATCH] ebos: linearize the auxiliary equations for shut wells correctly before this, a zero matrix was produced on the main diagonal which (rightfully) caused the linear solver to bail out. Now, the linearized equation is still rubbish, but it is not singular anymore and the result for shut wells is not used anywhere in the first place... --- applications/ebos/eclpeacemanwell.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/applications/ebos/eclpeacemanwell.hh b/applications/ebos/eclpeacemanwell.hh index edafe7d5c..b1050cfaf 100644 --- a/applications/ebos/eclpeacemanwell.hh +++ b/applications/ebos/eclpeacemanwell.hh @@ -339,6 +339,20 @@ public: for (unsigned i = 0; i < numModelEq; ++ i) diagBlock[i][i] = 1.0; + if (wellStatus() == Shut) { + // if the well is shut, make the auxiliary DOFs a trivial equation in the + // matrix: the main diagonal is already set to the identity matrix, the + // off-diagonal matrix entries must be set to 0. + auto wellDofIt = dofVariables_.begin(); + const auto &wellDofEndIt = dofVariables_.end(); + for (; wellDofIt != wellDofEndIt; ++ wellDofIt) { + matrix[wellGlobalDofIdx][wellDofIt->first] = 0.0; + matrix[wellDofIt->first][wellGlobalDofIdx] = 0.0; + residual[wellGlobalDofIdx] = 0.0; + } + return; + } + // account for the effect of the grid DOFs which are influenced by the well on // the well equation and the effect of the well on the grid DOFs auto wellDofIt = dofVariables_.begin();