Merge pull request #761 from andlaus/print_linearizations

distinguish between the number of non linear iterations and the number of linearizations
This commit is contained in:
Atgeirr Flø Rasmussen 2016-08-02 15:01:25 +02:00 committed by GitHub
commit abddac2309
5 changed files with 26 additions and 1 deletions

View File

@ -103,7 +103,11 @@ namespace Opm {
ReservoirState& reservoir_state,
WellState& well_state);
/// Number of nonlinear solver iterations used in all calls to step().
/// Number of linearizations used in all calls to step().
int linearizations() const;
/// Number of full nonlinear solver iterations used in all calls to step().
int nonlinearIterations() const;
/// Number of linear solver iterations used in all calls to step().
@ -156,6 +160,7 @@ namespace Opm {
// --------- Data members ---------
SolverParameters param_;
std::unique_ptr<PhysicalModel> model_;
int linearizations_;
int nonlinearIterations_;
int linearIterations_;
int wellIterations_;

View File

@ -32,6 +32,7 @@ namespace Opm
std::unique_ptr<PhysicalModel> model_arg)
: param_(param),
model_(std::move(model_arg)),
linearizations_(0),
nonlinearIterations_(0),
linearIterations_(0),
wellIterations_(0),
@ -44,6 +45,12 @@ namespace Opm
}
}
template <class PhysicalModel>
int NonlinearSolver<PhysicalModel>::linearizations() const
{
return linearizations_;
}
template <class PhysicalModel>
int NonlinearSolver<PhysicalModel>::nonlinearIterations() const
{
@ -149,6 +156,7 @@ namespace Opm
linearIterations_ += linIters;
nonlinearIterations_ += iteration - 1; // Since the last one will always be trivial.
linearizations_ += iteration;
wellIterations_ += wellIters;
linearIterationsLast_ = linIters;
nonlinearIterationsLast_ = iteration;

View File

@ -128,6 +128,7 @@ namespace Opm
desiredRestoreStep );
}
unsigned int totalLinearizations = 0;
unsigned int totalNonlinearIterations = 0;
unsigned int totalLinearIterations = 0;
bool is_well_potentials_computed = param_.getDefault("compute_well_potentials", false );
@ -241,6 +242,7 @@ namespace Opm
solver_timer.stop();
// accumulate the number of nonlinear and linear Iterations
totalLinearizations += solver->linearizations();
totalNonlinearIterations += solver->nonlinearIterations();
totalLinearIterations += solver->linearIterations();
@ -287,6 +289,7 @@ namespace Opm
report.pressure_time = stime;
report.transport_time = 0.0;
report.total_time = total_timer.secsSinceStart();
report.total_linearizations = totalLinearizations;
report.total_newton_iterations = totalNonlinearIterations;
report.total_linear_iterations = totalLinearIterations;
return report;

View File

@ -191,6 +191,7 @@ namespace {
ADB::null(),
{ 1.1169, 1.0031, 0.0031, 1.0 },
false } ) // default scaling
, linearizations_(0)
{
}
@ -243,6 +244,7 @@ namespace {
resTooLarge = (r > atol) && (r > rtol*r0);
it += 1;
linearizations_ += 1;
newtonIterations_ += 1;
std::cout << std::setw(9) << it << std::setprecision(9)
<< std::setw(18) << r << std::setprecision(9)
@ -261,6 +263,11 @@ namespace {
return it;
}
int FullyImplicitCompressiblePolymerSolver::linearizations() const
{
return linearizations_;
}
int FullyImplicitCompressiblePolymerSolver::nonlinearIterations() const
{
return newtonIterations_;

View File

@ -87,6 +87,7 @@ namespace Opm {
PolymerBlackoilState& state ,
WellStateFullyImplicitBlackoilPolymer& wstate);
int linearizations() const;
int nonlinearIterations() const;
int linearIterations() const;
int wellIterations() const;
@ -159,6 +160,7 @@ namespace Opm {
// The well_eq has size equal to the number of wells.
LinearisedBlackoilResidual residual_;
unsigned int linearizations_;
unsigned int newtonIterations_;
unsigned int linearIterations_;
unsigned int wellIterations_;