-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiflow.cpp
More file actions
executable file
·62 lines (46 loc) · 1.77 KB
/
Copy pathminiflow.cpp
File metadata and controls
executable file
·62 lines (46 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <chrono>
#include <iostream>
#include "include/Problem.hpp"
#include "include/ext/toml.h"
#include "include/BoundaryConditions.hpp"
#include "include/Input.hpp"
#include "include/OutputSettings.hpp"
#include "include/Geometry.hpp"
#include "include/Types.hpp"
#include "include/Solver.hpp"
int main(int argc, char** argv){
using namespace std::chrono;
if (argc < 2){
std::cout << "Usage: miniflow <input-file>.toml" << std::endl;
return 1;
}
auto tstart = high_resolution_clock::now();
// Load the input TOML file
auto indat = Input<scalar_t>(argv[1]);
// Build the problem
auto geom = indat.build_geometry();
auto tstepper = indat.build_timestepper();
auto bcs = indat.build_boundary_conditions();
auto flow_params = indat.build_flow_params();
auto solver_settings = indat.build_solver_settings();
auto output_settings = indat.build_output_settings();
auto problem = Problem<scalar_t>(geom, tstepper, bcs, flow_params);
// Create the solver
auto solver = Solver<scalar_t>(problem, solver_settings, output_settings);
auto tsetup = high_resolution_clock::now();
// Solve the problem
solver.solve();
auto tsolve = high_resolution_clock::now();
auto setup_time = duration_cast<duration<scalar_t>>(tsetup-tstart);
auto solver_time = duration_cast<duration<scalar_t>>(tsolve-tsetup);
auto total_time = duration_cast<duration<scalar_t>>(tsolve-tstart);
std::cout << "\n Timing Statistics\n"
<< " -----------------\n"
<< " Setup: "
<< setup_time.count() << " sec\n"
<< " Solver: "
<< solver_time.count() << " sec\n"
<< " Total: "
<< total_time.count() << " sec\n";
return 0;
}