-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple_linearized_solver.cpp
45 lines (34 loc) · 1.42 KB
/
simple_linearized_solver.cpp
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
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2022 Andreas Wagner.
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////
#include <chrono>
#include <iostream>
#include <memory>
#include "macrocirculation/simple_linearized_solver.hpp"
#include "petsc.h"
namespace mc = macrocirculation;
int main(int argc, char *argv[]) {
CHKERRQ(PetscInitialize(&argc, &argv, nullptr, "solves linear flow problem"));
std::cout << std::ios::scientific;
{
mc::SimpleLinearizedSolver solver;
for (size_t i = 0; i < 10000; i += 1) {
solver.solve();
// output every 100
if (i % 10 == 0) {
// extract coupling data at aneurysm inflow
auto in = solver.get_result(mc::SimpleLinearizedSolver::Outlet::in);
std::cout << i << " in: p = " << in.p << ", a = " << in.a << ", q = " << in.q << std::endl;
// extract coupling data at aneurysm outflow
auto out = solver.get_result(mc::SimpleLinearizedSolver::Outlet::out);
std::cout << i << " out: p = " << out.p << ", a = " << out.a << ", q = " << out.q << std::endl;
// just for fun, to see something, we could disable this
solver.write();
}
}
}
CHKERRQ(PetscFinalize());
}