VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
MetaData.cpp
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
33//=======================================================================================
34#include "MetaData.h"
35
36#include <ctime>
37#include <iomanip>
38#include <sstream>
39#include <string>
40#include <vector>
41
42#include <logger/Logger.h>
43
44#include "buildInfo.h"
45
46namespace vf::basics
47{
48
50{
52
53 buildInfo.git_commit_hash = buildInfo::gitCommitHash();
54 buildInfo.git_branch = buildInfo::gitBranch();
55 buildInfo.build_type = buildInfo::buildType();
56 buildInfo.compiler_flags = buildInfo::compilerFlags();
58 buildInfo.precision = buildInfo::precision();
59 buildInfo.compiler_definitions = buildInfo::compilerDefinitions();
60 buildInfo.compiler = buildInfo::compiler();
61 buildInfo.compiler_version = buildInfo::compiler_version();
62#ifdef VF_MPI
63 buildInfo.mpi_library = buildInfo::mpi_library();
64 buildInfo.mpi_version = buildInfo::mpi_version();
65#endif
66#ifdef VF_OPENMP
67 buildInfo.openmp_library = buildInfo::openmp_library();
68 buildInfo.openmp_version = buildInfo::openmp_version();
69#endif
70}
71
72std::string getCurrentTime()
73{
74 auto t = std::time(nullptr);
75 auto tm = *std::localtime(&t);
76
77 std::ostringstream oss;
78 oss << std::put_time(&tm, "%d-%m-%Y %H-%M-%S");
79 return oss.str();
80}
81
83{
84 printf("\n");
85 VF_LOG_INFO("Start Running {} simulation...", meta_data.name);
86 VF_LOG_INFO("Simulation Start Time: {}", meta_data.simulation.startDateTime);
87 printf("\n");
88 VF_LOG_INFO("world parameter:");
89 VF_LOG_INFO("--------------");
90 VF_LOG_INFO("dt [s] = {}", meta_data.discretization.dt);
91 VF_LOG_INFO("world_length [m] = {}", meta_data.world.length);
92 VF_LOG_INFO("world_velocity [m/s] = {}", meta_data.world.velocity);
93 VF_LOG_INFO("dx [m] = {}", meta_data.discretization.dx);
94 printf("\n");
95 VF_LOG_INFO("LB parameter:");
96 VF_LOG_INFO("--------------");
97 VF_LOG_INFO("Re = {}", meta_data.simulation.reynoldsNumber);
98 VF_LOG_INFO("lb_velocity [dx/dt] = {}", meta_data.simulation.lb_velocity);
99 VF_LOG_INFO("lb_viscosity [dx^2/dt] = {}", meta_data.simulation.lb_viscosity);
100 printf("\n");
101 VF_LOG_INFO("simulation parameter:");
102 VF_LOG_INFO("--------------");
103 VF_LOG_INFO("number of nodes = {}", meta_data.discretization.totalNumberOfNodes);
104 VF_LOG_INFO("number of level = {}", meta_data.discretization.numberOfLevels);
105 for (uint i = 0; i < meta_data.discretization.numberOfLevels; ++i)
106 VF_LOG_INFO("number of nodes on level {} = {}", i, meta_data.discretization.numberOfNodesPerLevel[i]);
107 VF_LOG_INFO("total number of time steps = {}", meta_data.simulation.numberOfTimeSteps);
108 VF_LOG_INFO("collision kernel = {}", meta_data.simulation.collisionKernel);
109 VF_LOG_INFO("quadric limiter = {}, {}, {}", meta_data.simulation.quadricLimiters[0],
110 meta_data.simulation.quadricLimiters[1], meta_data.simulation.quadricLimiters[2]);
111 printf("\n");
112 VF_LOG_INFO("Build Info:");
113 VF_LOG_INFO("--------------");
114 VF_LOG_INFO("git commit hash: {}", meta_data.buildInfo.git_commit_hash);
115 VF_LOG_INFO("git branch: {}", meta_data.buildInfo.git_branch);
116 VF_LOG_INFO("build type: {}", meta_data.buildInfo.build_type);
117 VF_LOG_INFO("remote: {}", meta_data.buildInfo.remote);
118 VF_LOG_INFO("Precision: {}", meta_data.buildInfo.precision);
119 VF_LOG_INFO("compiler: {}", meta_data.buildInfo.compiler);
120 VF_LOG_INFO("compiler version: {}", meta_data.buildInfo.compiler_version);
121 VF_LOG_INFO("compiler flags: {}", meta_data.buildInfo.compiler_flags);
122 VF_LOG_INFO("compiler definitions: {}", meta_data.buildInfo.compiler_definitions);
123 printf("\n");
124 VF_LOG_INFO("Hardware Info:");
125 VF_LOG_INFO("--------------");
126 VF_LOG_INFO("Number of Processes: {}", meta_data.numberOfProcesses);
127 VF_LOG_INFO("Number of Threads: {}", meta_data.numberOfThreads);
128 VF_LOG_INFO("hardware used: {}", meta_data.vf_hardware);
129 printf("\n");
130 if (meta_data.vf_hardware == "GPU") {
131 VF_LOG_INFO("GPU Info:");
132 VF_LOG_INFO("--------------");
133 for (const auto& gpu : meta_data.gpus) {
134 VF_LOG_INFO("name: {}, compute capability: {}", gpu.name, gpu.compute_capability);
135 }
136 }
137 printf("\n");
138}
139
141{
142 printf("\n");
143 VF_LOG_INFO("... finish Running simulation...");
144 VF_LOG_INFO("Total runtime: {:.0f} ms", meta_data.simulation.runtimeSeconds * 1000);
145 VF_LOG_INFO("NUPS: {:.0f} ({:04.1f}e6 NUPS)", meta_data.simulation.nups, meta_data.simulation.nups * 1e-6);
146 printf("\n");
147}
148
149} // namespace vf::basics
150
#define VF_LOG_INFO(...)
Definition Logger.h:50
std::shared_ptr< T > SPtr
unsigned int uint
Definition DataTypes.h:47
const char * mpi_version()
const char * mpi_library()
const char * buildType()
const char * gitBranch()
const char * compilerFlags()
const char * buildMachine()
const char * gitCommitHash()
const char * precision()
const char * compiler_version()
const char * compiler()
const char * compilerDefinitions()
Simple configuration file.
void logPostSimulation(const MetaData &meta_data)
Definition MetaData.cpp:140
std::string getCurrentTime()
Definition MetaData.cpp:72
void logPreSimulation(const MetaData &meta_data)
Definition MetaData.cpp:82
Simulation simulation
Definition MetaData.h:119