14namespace fs = std::filesystem;
15namespace chrono = std::chrono;
34 auto timeStepStartTime = chrono::system_clock::now();
40 auto timeStepEndTime = chrono::system_clock::now();
52 cout <<
"*** START SIMULATION ***" << endl;
62 cout <<
"*** END SIMULATION ***" << endl;
66 const chrono::system_clock::time_point& timeStepStartTime,
const chrono::system_clock::time_point& timeStepEndTime
73 ave = (double) (chrono::duration_cast<chrono::nanoseconds>(elapsedTime).count()) / (
timeStep * 1e9);
76 std::string remain =
"remain=";
78 remain +=
"-h --m --s";
80 auto totalTime = chrono::nanoseconds((int64_t) (ave * (
endTime -
startTime) /
dt * 1e9));
83 double last = chrono::duration_cast<chrono::nanoseconds>(timeStepEndTime - timeStepStartTime).count() * 1e-9;
87 "%d: dt=%.gs t=%.3lfs fin=%.1lfs %s %s ave=%.3lfs/step "
88 "last=%.3lfs/step out=%dfiles Courant=%.2lf\n",
112 auto currentTime = chrono::system_clock::to_time_t(chrono::system_clock::now());
113 std::tm* timeInfo = std::localtime(¤tTime);
114 std::stringstream formattedTime;
115 formattedTime << std::put_time(timeInfo,
"%Y-%m-%d_%H-%M-%S");
116 std::string formattedTimeString = formattedTime.str();
118 return formattedTimeString;
Input load(const fs::path &settingPath, const fs::path &outputDirectory)
Load the setting file and the particle file.
static MPS create(const Input &input)
double courant
Maximum courant number among all particles.
int getFileNumber() const
void save(const MPS &mps, const double time)
std::chrono::system_clock::time_point realEndTime
std::string getCurrentTimeString()
std::string calHourMinuteSecond(std::chrono::duration< Rep, Period > d)
std::chrono::system_clock::time_point realStartTime
void timeStepReport(const std::chrono::system_clock::time_point &timeStepStartTime, const std::chrono::system_clock::time_point &timeStepEndTime)
Report time step information to the console.
Simulation(std::filesystem::path &settingPath, std::filesystem::path &outputDirectory)
double outputPeriod
Output period of the simulation.
bool outputVtkInBinary
Flag for saving VTK file in binary format.
double endTime
End time of the simulation.