mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -103,7 +103,11 @@ namespace Opm {
|
|||||||
ReservoirState& reservoir_state,
|
ReservoirState& reservoir_state,
|
||||||
WellState& well_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;
|
int nonlinearIterations() const;
|
||||||
|
|
||||||
/// Number of linear solver iterations used in all calls to step().
|
/// Number of linear solver iterations used in all calls to step().
|
||||||
@@ -156,6 +160,7 @@ namespace Opm {
|
|||||||
// --------- Data members ---------
|
// --------- Data members ---------
|
||||||
SolverParameters param_;
|
SolverParameters param_;
|
||||||
std::unique_ptr<PhysicalModel> model_;
|
std::unique_ptr<PhysicalModel> model_;
|
||||||
|
int linearizations_;
|
||||||
int nonlinearIterations_;
|
int nonlinearIterations_;
|
||||||
int linearIterations_;
|
int linearIterations_;
|
||||||
int wellIterations_;
|
int wellIterations_;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace Opm
|
|||||||
std::unique_ptr<PhysicalModel> model_arg)
|
std::unique_ptr<PhysicalModel> model_arg)
|
||||||
: param_(param),
|
: param_(param),
|
||||||
model_(std::move(model_arg)),
|
model_(std::move(model_arg)),
|
||||||
|
linearizations_(0),
|
||||||
nonlinearIterations_(0),
|
nonlinearIterations_(0),
|
||||||
linearIterations_(0),
|
linearIterations_(0),
|
||||||
wellIterations_(0),
|
wellIterations_(0),
|
||||||
@@ -44,6 +45,12 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class PhysicalModel>
|
||||||
|
int NonlinearSolver<PhysicalModel>::linearizations() const
|
||||||
|
{
|
||||||
|
return linearizations_;
|
||||||
|
}
|
||||||
|
|
||||||
template <class PhysicalModel>
|
template <class PhysicalModel>
|
||||||
int NonlinearSolver<PhysicalModel>::nonlinearIterations() const
|
int NonlinearSolver<PhysicalModel>::nonlinearIterations() const
|
||||||
{
|
{
|
||||||
@@ -149,6 +156,7 @@ namespace Opm
|
|||||||
|
|
||||||
linearIterations_ += linIters;
|
linearIterations_ += linIters;
|
||||||
nonlinearIterations_ += iteration - 1; // Since the last one will always be trivial.
|
nonlinearIterations_ += iteration - 1; // Since the last one will always be trivial.
|
||||||
|
linearizations_ += iteration;
|
||||||
wellIterations_ += wellIters;
|
wellIterations_ += wellIters;
|
||||||
linearIterationsLast_ = linIters;
|
linearIterationsLast_ = linIters;
|
||||||
nonlinearIterationsLast_ = iteration;
|
nonlinearIterationsLast_ = iteration;
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ namespace Opm
|
|||||||
desiredRestoreStep );
|
desiredRestoreStep );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int totalLinearizations = 0;
|
||||||
unsigned int totalNonlinearIterations = 0;
|
unsigned int totalNonlinearIterations = 0;
|
||||||
unsigned int totalLinearIterations = 0;
|
unsigned int totalLinearIterations = 0;
|
||||||
bool is_well_potentials_computed = param_.getDefault("compute_well_potentials", false );
|
bool is_well_potentials_computed = param_.getDefault("compute_well_potentials", false );
|
||||||
@@ -241,6 +242,7 @@ namespace Opm
|
|||||||
solver_timer.stop();
|
solver_timer.stop();
|
||||||
|
|
||||||
// accumulate the number of nonlinear and linear Iterations
|
// accumulate the number of nonlinear and linear Iterations
|
||||||
|
totalLinearizations += solver->linearizations();
|
||||||
totalNonlinearIterations += solver->nonlinearIterations();
|
totalNonlinearIterations += solver->nonlinearIterations();
|
||||||
totalLinearIterations += solver->linearIterations();
|
totalLinearIterations += solver->linearIterations();
|
||||||
|
|
||||||
@@ -287,6 +289,7 @@ namespace Opm
|
|||||||
report.pressure_time = stime;
|
report.pressure_time = stime;
|
||||||
report.transport_time = 0.0;
|
report.transport_time = 0.0;
|
||||||
report.total_time = total_timer.secsSinceStart();
|
report.total_time = total_timer.secsSinceStart();
|
||||||
|
report.total_linearizations = totalLinearizations;
|
||||||
report.total_newton_iterations = totalNonlinearIterations;
|
report.total_newton_iterations = totalNonlinearIterations;
|
||||||
report.total_linear_iterations = totalLinearIterations;
|
report.total_linear_iterations = totalLinearIterations;
|
||||||
return report;
|
return report;
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ namespace {
|
|||||||
ADB::null(),
|
ADB::null(),
|
||||||
{ 1.1169, 1.0031, 0.0031, 1.0 },
|
{ 1.1169, 1.0031, 0.0031, 1.0 },
|
||||||
false } ) // default scaling
|
false } ) // default scaling
|
||||||
|
, linearizations_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,6 +244,7 @@ namespace {
|
|||||||
resTooLarge = (r > atol) && (r > rtol*r0);
|
resTooLarge = (r > atol) && (r > rtol*r0);
|
||||||
|
|
||||||
it += 1;
|
it += 1;
|
||||||
|
linearizations_ += 1;
|
||||||
newtonIterations_ += 1;
|
newtonIterations_ += 1;
|
||||||
std::cout << std::setw(9) << it << std::setprecision(9)
|
std::cout << std::setw(9) << it << std::setprecision(9)
|
||||||
<< std::setw(18) << r << std::setprecision(9)
|
<< std::setw(18) << r << std::setprecision(9)
|
||||||
@@ -261,6 +263,11 @@ namespace {
|
|||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FullyImplicitCompressiblePolymerSolver::linearizations() const
|
||||||
|
{
|
||||||
|
return linearizations_;
|
||||||
|
}
|
||||||
|
|
||||||
int FullyImplicitCompressiblePolymerSolver::nonlinearIterations() const
|
int FullyImplicitCompressiblePolymerSolver::nonlinearIterations() const
|
||||||
{
|
{
|
||||||
return newtonIterations_;
|
return newtonIterations_;
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ namespace Opm {
|
|||||||
PolymerBlackoilState& state ,
|
PolymerBlackoilState& state ,
|
||||||
WellStateFullyImplicitBlackoilPolymer& wstate);
|
WellStateFullyImplicitBlackoilPolymer& wstate);
|
||||||
|
|
||||||
|
int linearizations() const;
|
||||||
int nonlinearIterations() const;
|
int nonlinearIterations() const;
|
||||||
int linearIterations() const;
|
int linearIterations() const;
|
||||||
int wellIterations() const;
|
int wellIterations() const;
|
||||||
@@ -159,6 +160,7 @@ namespace Opm {
|
|||||||
// The well_eq has size equal to the number of wells.
|
// The well_eq has size equal to the number of wells.
|
||||||
LinearisedBlackoilResidual residual_;
|
LinearisedBlackoilResidual residual_;
|
||||||
|
|
||||||
|
unsigned int linearizations_;
|
||||||
unsigned int newtonIterations_;
|
unsigned int newtonIterations_;
|
||||||
unsigned int linearIterations_;
|
unsigned int linearIterations_;
|
||||||
unsigned int wellIterations_;
|
unsigned int wellIterations_;
|
||||||
|
|||||||
Reference in New Issue
Block a user