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
46
namespace
vf::basics
47
{
48
49
MetaData::MetaData
()
50
{
51
simulation
.
startDateTime
=
vf::basics::getCurrentTime
();
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
();
57
buildInfo
.remote =
buildInfo::buildMachine
();
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
72
std::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
82
void
logPreSimulation
(
const
MetaData
&
meta_data
)
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
140
void
logPostSimulation
(
const
MetaData
&
meta_data
)
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
Logger.h
VF_LOG_INFO
#define VF_LOG_INFO(...)
Definition
Logger.h:50
MetaData.h
buildInfo.h
SPtr
std::shared_ptr< T > SPtr
Definition
PointerDefinitions.h:39
uint
unsigned int uint
Definition
DataTypes.h:47
buildInfo
Definition
buildInfo.h:38
buildInfo::mpi_version
const char * mpi_version()
Definition
buildInfo.in.cpp:104
buildInfo::mpi_library
const char * mpi_library()
Definition
buildInfo.in.cpp:99
buildInfo::buildType
const char * buildType()
Definition
buildInfo.in.cpp:48
buildInfo::gitBranch
const char * gitBranch()
Definition
buildInfo.in.cpp:43
buildInfo::compilerFlags
const char * compilerFlags()
Definition
buildInfo.in.cpp:53
buildInfo::buildMachine
const char * buildMachine()
Definition
buildInfo.in.cpp:68
buildInfo::gitCommitHash
const char * gitCommitHash()
Definition
buildInfo.in.cpp:38
buildInfo::precision
const char * precision()
Definition
buildInfo.in.cpp:83
buildInfo::compiler_version
const char * compiler_version()
Definition
buildInfo.in.cpp:93
buildInfo::compiler
const char * compiler()
Definition
buildInfo.in.cpp:88
buildInfo::compilerDefinitions
const char * compilerDefinitions()
Definition
buildInfo.in.cpp:63
vf::basics
Simple configuration file.
Definition
ConfigurationFile.cpp:47
vf::basics::logPostSimulation
void logPostSimulation(const MetaData &meta_data)
Definition
MetaData.cpp:140
vf::basics::getCurrentTime
std::string getCurrentTime()
Definition
MetaData.cpp:72
vf::basics::logPreSimulation
void logPreSimulation(const MetaData &meta_data)
Definition
MetaData.cpp:82
vf::basics::MetaData::Simulation::startDateTime
std::string startDateTime
Definition
MetaData.h:56
vf::basics::MetaData
Definition
MetaData.h:51
vf::basics::MetaData::MetaData
MetaData()
Definition
MetaData.cpp:49
vf::basics::MetaData::simulation
Simulation simulation
Definition
MetaData.h:119
src
basics
MetaData
MetaData.cpp
Generated on Tue Mar 10 2026 00:03:16 for VirtualFluids by
1.9.8