From 8065903ac38b6eb3e1870d1f1d9e8a38560b4e72 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Mon, 2 Nov 2020 10:14:36 +0100 Subject: [PATCH] [io] Use 5 digits for simulation time output, 4 digits for residuals and 2 digits for cpu time --- dumux/common/timeloop.hh | 22 +++++++++++----------- dumux/io/vtkoutputmodule.hh | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh index af771fbd59..9086c67689 100644 --- a/dumux/common/timeloop.hh +++ b/dumux/common/timeloop.hh @@ -234,7 +234,7 @@ public: { endTime_ = t; if (verbose_) - std::cout << Fmt::format("Set new end time to t = {:.2g} seconds.\n", t); + std::cout << Fmt::format("Set new end time to t = {:.5g} seconds.\n", t); } /*! @@ -258,7 +258,7 @@ public: using std::min; timeStepSize_ = min(dt, maxTimeStepSize()); if (!finished() && Dune::FloatCmp::le(timeStepSize_, 0.0, 1e-14*endTime_)) - std::cerr << Fmt::format("You have set a very small timestep size (dt = {:.2g}).", timeStepSize_) + std::cerr << Fmt::format("You have set a very small timestep size (dt = {:.5g}).", timeStepSize_) << " This might lead to numerical problems!\n"; } @@ -350,8 +350,8 @@ public: const auto cpuTime = wallClockTime(); const auto percent = std::round( time_ / endTime_ * 100 ); std::cout << Fmt::format("[{:3.0f}%] ", percent) - << Fmt::format("Time step {} done in {:.5g} seconds. ", timeStepIdx_, timeStepWallClockTime_) - << Fmt::format("Wall clock time: {:.5g}, time: {:.5g}, time step size: {:.5g}\n", cpuTime, time_, previousTimeStepSize_); + << Fmt::format("Time step {} done in {:.2g} seconds. ", timeStepIdx_, timeStepWallClockTime_) + << Fmt::format("Wall clock time: {:.2g}, time: {:.5g}, time step size: {:.5g}\n", cpuTime, time_, previousTimeStepSize_); } } @@ -364,13 +364,13 @@ public: auto cpuTime = timer_.stop(); if (verbose_) - std::cout << Fmt::format("Simulation took {:.5g} seconds on {} processes.\n", cpuTime, comm.size()); + std::cout << Fmt::format("Simulation took {:.2g} seconds on {} processes.\n", cpuTime, comm.size()); if (comm.size() > 1) cpuTime = comm.sum(cpuTime); if (verbose_) - std::cout << Fmt::format("The cumulative CPU time was {:.5g} seconds.\n", cpuTime); + std::cout << Fmt::format("The cumulative CPU time was {:.2g} seconds.\n", cpuTime); } //! If the time loop has verbose output @@ -512,8 +512,8 @@ public: lastPeriodicCheckPoint_ += interval; if (this->verbose()) - std::cout << Fmt::format("Enabled periodic check points every {:.2g} seconds ", interval) - << Fmt::format("with the next check point at {:.2g} seconds.\n", lastPeriodicCheckPoint_ + interval); + std::cout << Fmt::format("Enabled periodic check points every {:.5g} seconds ", interval) + << Fmt::format("with the next check point at {:.5g} seconds.\n", lastPeriodicCheckPoint_ + interval); // check if the current time point is a check point if (Dune::FloatCmp::eq(this->time()-lastPeriodicCheckPoint_, 0.0, 1e-7)) @@ -591,8 +591,8 @@ private: if (Dune::FloatCmp::le(t - this->time(), 0.0, this->timeStepSize()*1e-7)) { if (this->verbose()) - std::cerr << Fmt::format("Couldn't insert checkpoint at t = {:.2g} ", t) - << Fmt::format("because that's in the past! (current simulation time is {:.2g})\n", this->time()); + std::cerr << Fmt::format("Couldn't insert checkpoint at t = {:.5g} ", t) + << Fmt::format("because that's in the past! (current simulation time is {:.5g})\n", this->time()); return; } @@ -609,7 +609,7 @@ private: checkPoints_.push(t); if (this->verbose()) - std::cout << Fmt::format("Set check point at t = {:.2g} seconds.\n", t); + std::cout << Fmt::format("Set check point at t = {:.5g} seconds.\n", t); } /*! diff --git a/dumux/io/vtkoutputmodule.hh b/dumux/io/vtkoutputmodule.hh index fc8a28523c..81d1068344 100644 --- a/dumux/io/vtkoutputmodule.hh +++ b/dumux/io/vtkoutputmodule.hh @@ -183,7 +183,7 @@ public: //! output timer.stop(); if (verbose_) - std::cout << Fmt::format("Writing output for problem \"{}\". Took {:.4g} seconds.\n", name_, timer.elapsed()); + std::cout << Fmt::format("Writing output for problem \"{}\". Took {:.2g} seconds.\n", name_, timer.elapsed()); } protected: -- GitLab