Do the schur complement after calling the getConvergence method

This commit is contained in:
Tor Harald Sandve 2018-11-05 15:54:48 +01:00
parent 5edd63c554
commit 7ccce99e1c
3 changed files with 39 additions and 0 deletions

View File

@ -358,6 +358,16 @@ namespace Opm {
ebosSimulator_.model().linearizer().linearize();
ebosSimulator_.problem().endIteration();
auto& ebosJac = ebosSimulator_.model().linearizer().matrix();
if (param_.matrix_add_well_contributions_) {
wellModel().addWellContributions(ebosJac);
}
if ( param_.preconditioner_add_well_contributions_ &&
! param_.matrix_add_well_contributions_ ) {
matrix_for_preconditioner_ .reset(new Mat(ebosJac));
wellModel().addWellContributions(*matrix_for_preconditioner_);
}
return wellModel().lastReport();
}
@ -487,6 +497,8 @@ namespace Opm {
auto& ebosJac = ebosSimulator_.model().linearizer().matrix();
auto& ebosResid = ebosSimulator_.model().linearizer().residual();
wellModel().apply(ebosResid);
// set initial guess
x = 0.0;

View File

@ -202,6 +202,9 @@ namespace Opm {
Opm::data::Wells wellData() const
{ return well_state_.report(phase_usage_, Opm::UgGridHelpers::globalCell(grid())); }
// substract Binv(D)rw from r;
void apply( BVector& r) const;
// subtract B*inv(D)*C * x from A*x
void apply(const BVector& x, BVector& Ax) const;
@ -225,6 +228,13 @@ namespace Opm {
const SimulatorReport& lastReport() const;
void addWellContributions(Mat& mat)
{
for ( const auto& well: well_container_ ) {
well->addWellContributions(mat);
}
}
// called at the beginning of a report step
void beginReportStep(const int time_step);

View File

@ -99,6 +99,9 @@ namespace Opm {
if (!localWellsActive())
return;
// we don't what to add the schur complement
// here since it affects the getConvergence method
/*
for (const auto& well: well_container_) {
if (param_.matrix_add_well_contributions_)
well->addWellContributions(mat);
@ -107,6 +110,7 @@ namespace Opm {
// r = r - duneC_^T * invDuneD_ * resWell_
well->apply(res);
}
*/
}
@ -549,6 +553,19 @@ namespace Opm {
}
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
apply( BVector& r) const
{
if ( ! localWellsActive() ) {
return;
}
for (auto& well : well_container_) {
well->apply(r);
}
}
// Ax = A x - C D^-1 B x