Do the schur complement after calling the getConvergence method

This commit is contained in:
Tor Harald Sandve committed 2018-11-08 10:41:41 +01:00
1 parent 5edd63c554
commit 7ccce99e1c
3 files changed
+39

No files matched your search

+12
View File
@@ -358,6 +358,16 @@ namespace Opm {
ebosSimulator_.model().linearizer().linearize(); ebosSimulator_.model().linearizer().linearize();
ebosSimulator_.problem().endIteration(); 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(); return wellModel().lastReport();
} }
@@ -487,6 +497,8 @@ namespace Opm {
auto& ebosJac = ebosSimulator_.model().linearizer().matrix(); auto& ebosJac = ebosSimulator_.model().linearizer().matrix();
auto& ebosResid = ebosSimulator_.model().linearizer().residual(); auto& ebosResid = ebosSimulator_.model().linearizer().residual();
wellModel().apply(ebosResid);
// set initial guess // set initial guess
x = 0.0; x = 0.0;
+10
View File
@@ -202,6 +202,9 @@ namespace Opm {
Opm::data::Wells wellData() const Opm::data::Wells wellData() const
{ return well_state_.report(phase_usage_, Opm::UgGridHelpers::globalCell(grid())); } { 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 // subtract B*inv(D)*C * x from A*x
void apply(const BVector& x, BVector& Ax) const; void apply(const BVector& x, BVector& Ax) const;
@@ -225,6 +228,13 @@ namespace Opm {
const SimulatorReport& lastReport() const; 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 // called at the beginning of a report step
void beginReportStep(const int time_step); void beginReportStep(const int time_step);
+17
View File
@@ -99,6 +99,9 @@ namespace Opm {
if (!localWellsActive()) if (!localWellsActive())
return; return;
// we don't what to add the schur complement
// here since it affects the getConvergence method
/*
for (const auto& well: well_container_) { for (const auto& well: well_container_) {
if (param_.matrix_add_well_contributions_) if (param_.matrix_add_well_contributions_)
well->addWellContributions(mat); well->addWellContributions(mat);
@@ -107,6 +110,7 @@ namespace Opm {
// r = r - duneC_^T * invDuneD_ * resWell_ // r = r - duneC_^T * invDuneD_ * resWell_
well->apply(res); 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 // Ax = A x - C D^-1 B x