Merge pull request #3801 from totto82/add_performa

Add more performance summary output
This commit is contained in:
Bård Skaflestad 2022-02-03 17:15:05 +01:00 committed by GitHub
commit e6ad6ec496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 58 additions and 1 deletions

View File

@ -32,6 +32,7 @@
#include <ebos/ecltransmissibility.hh>
#include <opm/models/parallel/tasklets.hh>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <cstddef>
#include <map>
@ -81,6 +82,16 @@ public:
globalTrans_ = globalTrans;
}
void setSubStepReport(const SimulatorReportSingle& report)
{
sub_step_report_ = report;
}
void setSimulationReport(const SimulatorReport& report)
{
simulation_report_ = report;
}
protected:
const TransmissibilityType& globalTrans() const;
@ -127,6 +138,8 @@ protected:
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper_;
const EquilGrid* equilGrid_;
std::vector<std::size_t> wbp_index_list_;
SimulatorReportSingle sub_step_report_;
SimulatorReport simulation_report_;
private:
data::Solution computeTrans_(const std::unordered_map<int,int>& cartesianToActive) const;

View File

@ -70,6 +70,7 @@
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/models/utils/pffgridvector.hh>
#include <opm/models/blackoil/blackoilmodel.hh>
@ -1970,6 +1971,12 @@ public:
const EclipseIO& eclIO() const
{ return eclWriter_->eclIO(); }
void setSubStepReport(const SimulatorReportSingle& report)
{ return eclWriter_->setSubStepReport(report); }
void setSimulationReport(const SimulatorReport& report)
{ return eclWriter_->setSimulationReport(report); }
bool nonTrivialBoundaryConditions() const
{ return nonTrivialBoundaryConditions_; }

View File

@ -39,6 +39,7 @@
#include <ebos/eclgenericwriter.hh>
#include <string>
#include <limits>
namespace Opm::Properties {
@ -208,6 +209,27 @@ public:
if (totalCpuTime != 0.0) {
miscSummaryData["TCPU"] = totalCpuTime;
}
if (this->sub_step_report_.total_newton_iterations != 0) {
miscSummaryData["NEWTON"] = this->sub_step_report_.total_newton_iterations;
}
if (this->sub_step_report_.total_linear_iterations != 0) {
miscSummaryData["MLINEARS"] = this->sub_step_report_.total_linear_iterations;
}
if (this->sub_step_report_.total_newton_iterations != 0) {
miscSummaryData["NLINEARS"] = static_cast<float>(this->sub_step_report_.total_linear_iterations) / this->sub_step_report_.total_newton_iterations;
}
if (this->sub_step_report_.min_linear_iterations != std::numeric_limits<unsigned int>::max()) {
miscSummaryData["NLINSMIN"] = this->sub_step_report_.min_linear_iterations;
}
if (this->sub_step_report_.max_linear_iterations != 0) {
miscSummaryData["NLINSMAX"] = this->sub_step_report_.max_linear_iterations;
}
if (this->simulation_report_.success.total_newton_iterations != 0) {
miscSummaryData["MSUMLINS"] = this->simulation_report_.success.total_linear_iterations;
}
if (this->simulation_report_.success.total_newton_iterations != 0) {
miscSummaryData["MSUMNEWT"] = this->simulation_report_.success.total_newton_iterations;
}
this->evalSummary(reportStepNum, curTime,
this->collectToIORank_.isParallel() ?

View File

@ -259,6 +259,8 @@ public:
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE);
auto stepReport = adaptiveTimeStepping_->step(timer, *solver, event, nullptr);
report_ += stepReport;
//Pass simulation report to eclwriter for summary output
ebosSimulator_.problem().setSimulationReport(report_);
} else {
// solve for complete report step
auto stepReport = solver->step(timer);

View File

@ -456,6 +456,9 @@ namespace Opm {
// this can be thrown by ISTL's ILU0 in block mode, yet is not an ISTLError
}
//Pass substep to eclwriter for summary output
ebosSimulator.problem().setSubStepReport(substepReport);
report += substepReport;
bool continue_on_uncoverged_solution = ignoreConvergenceFailure_ && !substepReport.converged && dt <= minTimeStep_;

View File

@ -27,6 +27,7 @@
#include <ostream>
#include <sstream>
#include <fmt/format.h>
#include <limits>
namespace Opm
{
@ -46,6 +47,8 @@ namespace Opm
total_linearizations( 0 ),
total_newton_iterations( 0 ),
total_linear_iterations( 0 ),
min_linear_iterations ( std::numeric_limits<unsigned int>::max() ),
max_linear_iterations ( 0 ),
converged(false),
exit_status(EXIT_SUCCESS),
global_time(0),
@ -70,6 +73,11 @@ namespace Opm
total_linearizations += sr.total_linearizations;
total_newton_iterations += sr.total_newton_iterations;
total_linear_iterations += sr.total_linear_iterations;
if (sr.total_linear_iterations > 0) {
min_linear_iterations = std::min(min_linear_iterations, sr.total_linear_iterations);
}
max_linear_iterations = std::max(max_linear_iterations, sr.total_linear_iterations);
// It makes no sense adding time points. Therefore, do not
// overwrite the value of global_time which gets set in
// NonlinearSolverEbos.hpp by the line:

View File

@ -45,6 +45,9 @@ namespace Opm
unsigned int total_linearizations;
unsigned int total_newton_iterations;
unsigned int total_linear_iterations;
unsigned int min_linear_iterations;
unsigned int max_linear_iterations;
bool converged;
int exit_status;

View File

@ -416,7 +416,6 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords()
{"NOCASC", {false, std::nullopt}},
{"NOGGF", {false, std::nullopt}},
{"NOINSPEC", {false, std::nullopt}},
{"NLINEARS", {false, std::nullopt}},
{"NOMONITO", {false, std::nullopt}},
{"NONNC", {false, std::nullopt}},
{"NORSSPEC", {false, std::nullopt}},