Add well contribution to preconditioner matrix and always use old operator approach for wells.

It turned out that applying the well part of the full matrix has to be
done after the application of the non-well interactions. Otherwise we
screw up the ordering so much that convergence suffers a lot.

Kudos got Atgeirr for inspiration based on his testing.
This commit is contained in:
Markus Blatt 2018-03-02 20:47:04 +01:00
parent f07874cf42
commit 12d2114bd7
2 changed files with 6 additions and 9 deletions

View File

@ -375,9 +375,9 @@ namespace Opm {
}
auto& ebosJac = ebosSimulator_.model().linearizer().matrix();
matrix_for_preconditioner_ = ebosJac;
if (param_.matrix_add_well_contributions_) {
wellModel().addWellContributions(ebosJac);
matrix_for_preconditioner_ .reset(new Mat(ebosJac));
wellModel().addWellContributions(*matrix_for_preconditioner_);
}
return wellModel().lastReport();
@ -495,7 +495,7 @@ namespace Opm {
if( isParallel() )
{
typedef WellModelMatrixAdapter< Mat, BVector, BVector, BlackoilWellModel<TypeTag>, true > Operator;
Operator opA(ebosJac, matrix_for_preconditioner_, wellModel(),
Operator opA(ebosJac, actual_mat_for_prec, wellModel(),
istlSolver().parallelInformation() );
assert( opA.comm() );
istlSolver().solve( opA, x, ebosResid, *(opA.comm()) );
@ -503,7 +503,7 @@ namespace Opm {
else
{
typedef WellModelMatrixAdapter< Mat, BVector, BVector, BlackoilWellModel<TypeTag>, false > Operator;
Operator opA(ebosJac, matrix_for_preconditioner_, wellModel(),
Operator opA(ebosJac, actual_mat_for_prec, wellModel());
istlSolver().solve( opA, x, ebosResid );
}
}
@ -1062,7 +1062,7 @@ namespace Opm {
double current_relaxation_;
BVector dx_old_;
Mat matrix_for_preconditioner_;
std::unique_ptr<Mat> matrix_for_preconditioner_;
public:
/// return the StandardWells object

View File

@ -326,10 +326,7 @@ namespace Opm {
}
for (auto& well : well_container_) {
if ( ! well->jacobianContainsWellContributions() )
{
well->apply(x, Ax);
}
well->apply(x, Ax);
}
}