Merge pull request #2832 from alfbr/improve-output

Improve output
This commit is contained in:
Atgeirr Flø Rasmussen 2020-10-05 08:49:09 +02:00 committed by GitHub
commit f6569b6a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 53 deletions

View File

@ -31,6 +31,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/TracerVdTable.hpp>
#include <opm/models/blackoil/blackoilmodel.hh>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <dune/istl/operators.hh>
#include <dune/istl/solvers.hh>
@ -106,9 +107,10 @@ public:
if (!EWOMS_GET_PARAM(TypeTag, bool, EnableTracerModel)) {
if (simulator_.gridView().comm().rank() == 0) {
std::cout << "Warning: Tracer model is disabled but the deck contains the TRACERS keyword\n"
<< "The tracer model must be explictly activated using --enable-tracer-model=true\n"
<< std::flush;
OpmLog::warning("Keyword TRACERS has only experimental support, and is hence ignored.\n"
"The experimental tracer model can still be used, but must be set explicitely.\n"
"To use tracers, set the command line option: --enable-tracer-model=true"
"\n");
}
return; // Tracer transport must be enabled by the user
}

View File

@ -42,6 +42,8 @@
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/common/utility/String.hpp>
#include <fmt/format.h>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
@ -590,13 +592,13 @@ namespace Opm
if (this->output_cout_) {
std::ostringstream ss;
ss << "\n\n================ End of simulation ===============\n\n";
ss << "Number of MPI processes: " << std::setw(6) << mpi_size_ << "\n";
ss << fmt::format("Number of MPI processes: {:9}\n", mpi_size_ );
#if _OPENMP
int threads = omp_get_max_threads();
#else
int threads = 1;
#endif
ss << "Threads per MPI process: " << std::setw(5) << threads << "\n";
ss << fmt::format("Threads per MPI process: {:9}\n", threads);
report.reportFullyImplicit(ss);
OpmLog::info(ss.str());
const std::string dir = eclState().getIOConfig().getOutputDir();

View File

@ -441,10 +441,6 @@ namespace Opm
summaryConfig_, nullptr, python, std::move(parseContext),
init_from_restart_file, outputCout_);
if (outputCout_) {
OpmLog::info("Done reading deck file.");
}
setupTime_ = externalSetupTimer.elapsed();
outputFiles_ = (outputMode != FileOutputMode::OUTPUT_NONE);
}

View File

@ -26,6 +26,7 @@
#include <iomanip>
#include <ostream>
#include <sstream>
#include <fmt/format.h>
namespace Opm
{
@ -73,103 +74,112 @@ namespace Opm
void SimulatorReportSingle::reportStep(std::ostringstream& ss) const
{
ss << "Time step summary: ";
if (total_well_iterations != 0) {
ss << "well its = " << std::setw(2) << total_well_iterations << ", ";
ss << fmt::format("Well its={:2}", total_well_iterations);
}
ss << "newton its = " << std::setw(2) << total_newton_iterations << ", "
<< "linearizations = " << std::setw(2) << total_linearizations
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << assemble_time << " sec), "
<< "linear its = " << std::setw(3) << total_linear_iterations
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << linear_solve_time << " sec)";
ss << fmt::format(" Newton its={:2}, linearaizations={:2} ({:2.1f}sec), linear its={:3} ({:2.1f}sec)",
total_newton_iterations,
total_linearizations,
assemble_time,
total_linear_iterations,
linear_solve_time);
}
void SimulatorReportSingle::reportFullyImplicit(std::ostream& os, const SimulatorReportSingle* failureReport) const
{
double t = total_time;
os << "Total time (seconds): " << t;
os << std::endl;
os << fmt::format("Total time (seconds): {:9.2f} \n", total_time);
t = solver_time + (failureReport ? failureReport->solver_time : 0.0);
os << "Solver time (seconds): " << t;
os << std::endl;
os << fmt::format("Solver time (seconds): {:9.2f} \n",
solver_time + (failureReport ? failureReport->solver_time : 0.0));
if (assemble_time > 0.0 || linear_solve_time > 0.0) {
t = assemble_time + (failureReport ? failureReport->assemble_time : 0.0);
os << " Assembly time (seconds): " << t;
double t = assemble_time + (failureReport ? failureReport->assemble_time : 0.0);
os << fmt::format(" Assembly time (seconds): {:9.2f}", t);
if (failureReport) {
os << " (Failed: " << failureReport->assemble_time << "; "
<< 100*failureReport->assemble_time/t << "%)";
}
os << fmt::format(" (Failed: {:2.1f}; {:2.1f}%)",
failureReport->assemble_time,
100*failureReport->assemble_time/t);
}
os << std::endl;
t = assemble_time_well + (failureReport ? failureReport->assemble_time_well : 0.0);
os << " Well assembly time (seconds): " << t;
os << fmt::format(" Well assembly (seconds): {:7.2f}", t);
if (failureReport) {
os << " (Failed: " << failureReport->assemble_time_well << "; "
<< 100*failureReport->assemble_time_well/t << "%)";
os << fmt::format(" (Failed: {:2.1f}; {:2.1f}%)",
failureReport->assemble_time_well,
100*failureReport->assemble_time_well/t);
}
os << std::endl;
t = linear_solve_time + (failureReport ? failureReport->linear_solve_time : 0.0);
os << " Linear solve time (seconds): " << t;
os << fmt::format(" Linear solve time (seconds):{:8.2f}", t);
if (failureReport) {
os << " (Failed: " << failureReport->linear_solve_time << "; "
<< 100*failureReport->linear_solve_time/t << "%)";
os << fmt::format(" (Failed: {:2.1f}; {:2.1f}%)",
failureReport->linear_solve_time,
100*failureReport->linear_solve_time/t);
}
os << std::endl;
t = linear_solve_setup_time + (failureReport ? failureReport->linear_solve_setup_time : 0.0);
os << " Linear solve setup time (seconds): " << t;
os << fmt::format(" Linear setup (seconds): {:7.2f}", t);
if (failureReport) {
os << " (Failed: " << failureReport->linear_solve_setup_time << "; "
<< 100*failureReport->linear_solve_setup_time/t << "%)";
os << fmt::format(" (Failed: {:2.1f}; {:2.1f}%)",
failureReport->linear_solve_setup_time,
100*failureReport->linear_solve_setup_time/t);
}
os << std::endl;
t = update_time + (failureReport ? failureReport->update_time : 0.0);
os << " Update time (seconds): " << t;
os << fmt::format(" Update time (seconds): {:7.2f}", t);
if (failureReport) {
os << " (Failed: " << failureReport->update_time << "; "
<< 100*failureReport->update_time/t << "%)";
os << fmt::format(" (Failed: {:2.1f}; {:2.1f}%)",
failureReport->update_time,
100*failureReport->update_time/t);
}
os << std::endl;
t = output_write_time + (failureReport ? failureReport->output_write_time : 0.0);
os << " Output write time (seconds): " << t;
os << fmt::format(" Output write time (seconds): {:7.2f}",
output_write_time + (failureReport ? failureReport->output_write_time : 0.0));
os << std::endl;
}
int n = total_well_iterations + (failureReport ? failureReport->total_well_iterations : 0);
os << "Overall Well Iterations: " << n;
os << fmt::format("Overall Well Iterations: {:7}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_well_iterations << "; "
<< 100.0*failureReport->total_well_iterations/n << "%)";
os << fmt::format(" (Failed: {:3}; {:2.1f}%)",
failureReport->total_well_iterations,
100.0*failureReport->total_well_iterations/n);
}
os << std::endl;
n = total_linearizations + (failureReport ? failureReport->total_linearizations : 0);
os << "Overall Linearizations: " << n;
os << fmt::format("Overall Linearizations: {:7}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_linearizations << "; "
<< 100.0*failureReport->total_linearizations/n << "%)";
os << fmt::format(" (Failed: {:3}; {:2.1f}%)",
failureReport->total_linearizations,
100.0*failureReport->total_linearizations/n);
}
os << std::endl;
n = total_newton_iterations + (failureReport ? failureReport->total_newton_iterations : 0);
os << "Overall Newton Iterations: " << n;
os << fmt::format("Overall Newton Iterations: {:7}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_newton_iterations << "; "
<< 100.0*failureReport->total_newton_iterations/n << "%)";
os << fmt::format(" (Failed: {:3}; {:2.1f}%)",
failureReport->total_newton_iterations,
100.0*failureReport->total_newton_iterations/n);
}
os << std::endl;
n = total_linear_iterations + (failureReport ? failureReport->total_linear_iterations : 0);
os << "Overall Linear Iterations: " << n;
os << fmt::format("Overall Linear Iterations: {:7}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_linear_iterations << "; "
<< 100.0*failureReport->total_linear_iterations/n << "%)";
os << fmt::format(" (Failed: {:3}; {:2.1f}%)",
failureReport->total_linear_iterations,
100.0*failureReport->total_linear_iterations/n);
}
os << std::endl;
}