Converted to fmt formatting

This commit is contained in:
Alf Birger Rustad
2020-10-02 12:46:45 +02:00
parent 845eb17d28
commit e68db6dbda
2 changed files with 68 additions and 57 deletions

View File

@@ -107,10 +107,10 @@ public:
if (!EWOMS_GET_PARAM(TypeTag, bool, EnableTracerModel)) {
if (simulator_.gridView().comm().rank() == 0) {
OpmLog::warning("Warning: Keyword TRACERS has only experimental support, and is hence ignored.\n"
+ std::string("The experimental tracer model can still be used, but must be set explicitely.\n")
+ std::string("To use tracers, set the command line option: --enable-tracer-model=true\n")
+ "\n");
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

@@ -26,6 +26,7 @@
#include <iomanip>
#include <ostream>
#include <sstream>
#include <fmt/format.h>
namespace Opm
{
@@ -74,101 +75,111 @@ namespace Opm
void SimulatorReportSingle::reportStep(std::ostringstream& ss) const
{
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(1) << std::setw(2) << assemble_time << "sec), "
<< "linear its=" << std::setw(3) << total_linear_iterations
<< " (" << std::fixed << std::setprecision(1) << std::setw(2) << linear_solve_time << "sec)";
ss << fmt::format(" Newton its={:2}, lineraizations={: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): " << std::fixed << std::setprecision(1) << t;
os << std::endl;
os << fmt::format("Total time (seconds): {:2.1f} \n", total_time);
t = solver_time + (failureReport ? failureReport->solver_time : 0.0);
os << "Solver time (seconds): " << std::fixed << std::setprecision(1) << t;
os << std::endl;
os << fmt::format("Solver time (seconds): {:2.1f} \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): " << std::fixed << std::setprecision(1) << t;
double t = assemble_time + (failureReport ? failureReport->assemble_time : 0.0);
os << fmt::format(" Assembly time (seconds): {:2.1f}", 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): " << std::fixed << std::setprecision(1) << t;
os << fmt::format(" Well assembly (seconds): {:2.1f}", 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): " << std::fixed << std::setprecision(1) << t;
os << fmt::format(" Linear solve time (seconds): {:2.1f}", 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): " << std::fixed << std::setprecision(1) << t;
os << fmt::format(" Linear setup (seconds): {:2.1f}", 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): " << std::fixed << std::setprecision(1) << t;
os << fmt::format(" Update time (seconds): {:2.1f}", 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): " << std::fixed << std::setprecision(1) << t;
os << fmt::format(" Output write time (seconds): {:2.1f}",
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: {:2}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_well_iterations << "; "
<< 100.0*failureReport->total_well_iterations/n << "%)";
os << fmt::format(" (Failed: {:2}; {: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: {:2}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_linearizations << "; "
<< 100.0*failureReport->total_linearizations/n << "%)";
os << fmt::format(" (Failed: {:2}; {: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: {:2}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_newton_iterations << "; "
<< 100.0*failureReport->total_newton_iterations/n << "%)";
os << fmt::format(" (Failed: {:2}; {: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: {:2}", n);
if (failureReport) {
os << " (Failed: " << failureReport->total_linear_iterations << "; "
<< 100.0*failureReport->total_linear_iterations/n << "%)";
os << fmt::format(" (Failed: {:2}; {:2.1f}%",
failureReport->total_linear_iterations,
100.0*failureReport->total_linear_iterations/n);
}
os << std::endl;
}