svZeroDSolver
Toggle main menu visibility
Loading...
Searching...
No Matches
algebra
Integrator.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the
2
// University of California, and others. SPDX-License-Identifier: BSD-3-Clause
3
/**
4
* @file Integrator.h
5
* @brief Integrator source file
6
*/
7
#ifndef SVZERODSOLVER_ALGEBRA_INTEGRATOR_HPP_
8
#define SVZERODSOLVER_ALGEBRA_INTEGRATOR_HPP_
9
10
#include <Eigen/Dense>
11
12
#include "
Model.h
"
13
#include "
State.h
"
14
15
/**
16
* @brief Generalized-alpha integrator
17
*
18
* This class handles the time integration scheme for solving 0D blood
19
* flow system using the generalized-\f$\alpha\f$ method \cite JANSEN2000305.
20
*
21
* Mathematical details are available on the <a
22
* href="https://simvascular.github.io/documentation/rom_simulation.html#0d-solver-theory">SimVascular
23
* documentation</a>.
24
*/
25
26
class
Integrator
{
27
private
:
28
double
alpha_m{0.0};
29
double
alpha_f{0.0};
30
double
gamma{0.0};
31
double
time_step_size{0.0};
32
double
ydot_init_coeff{0.0};
33
double
y_coeff{0.0};
34
double
y_coeff_jacobian{0.0};
35
double
atol{0.0};
36
int
max_iter{0};
37
int
size{0};
38
int
n_iter{0};
39
int
n_nonlin_iter{0};
40
Eigen::Matrix<double, Eigen::Dynamic, 1> y_af;
41
Eigen::Matrix<double, Eigen::Dynamic, 1> ydot_am;
42
SparseSystem
system;
43
Model
* model{
nullptr
};
44
45
public
:
46
/**
47
* @brief Construct a new Integrator object
48
*
49
* @param model The model to simulate
50
* @param time_step_size Time step size for generalized-alpha step
51
* @param rho Spectral radius for generalized-alpha step
52
* @param atol Absolut tolerance for non-linear iteration termination
53
* @param max_iter Maximum number of non-linear iterations
54
*/
55
Integrator
(
Model
* model,
double
time_step_size,
double
rho,
double
atol,
56
int
max_iter);
57
58
/**
59
* @brief Construct a new Integrator object
60
*
61
*/
62
Integrator
();
63
64
/**
65
* @brief Destroy the Integrator object
66
*
67
*/
68
~Integrator
();
69
70
/**
71
* @brief Delete dynamically allocated memory (in class member
72
* SparseSystem<double> system).
73
*/
74
void
clean
();
75
76
/**
77
* @brief Update integrator parameter and system matrices with model parameter
78
* updates.
79
*
80
* @param time_step_size Time step size for 0D model
81
*/
82
void
update_params
(
double
time_step_size);
83
84
/**
85
* @brief Perform a time step
86
*
87
* @param state Current state
88
* @param time Current time
89
* @return New state
90
*/
91
State
step
(
const
State
& state,
double
time);
92
93
/**
94
* @brief Get average number of nonlinear iterations in all step calls
95
*
96
* @return Average number of nonlinear iterations in all step calls
97
*
98
*/
99
double
avg_nonlin_iter
();
100
};
101
102
#endif
// SVZERODSOLVER_ALGEBRA_INTEGRATOR_HPP_
Model.h
model::Model source file
State.h
State source file.
Integrator::step
State step(const State &state, double time)
Perform a time step.
Definition
Integrator.cpp:49
Integrator::clean
void clean()
Delete dynamically allocated memory (in class member SparseSystem<double> system).
Definition
Integrator.cpp:35
Integrator::avg_nonlin_iter
double avg_nonlin_iter()
Get average number of nonlinear iterations in all step calls.
Definition
Integrator.cpp:110
Integrator::Integrator
Integrator()
Construct a new Integrator object.
Definition
Integrator.cpp:32
Integrator::~Integrator
~Integrator()
Destroy the Integrator object.
Definition
Integrator.cpp:33
Integrator::Integrator
Integrator(Model *model, double time_step_size, double rho, double atol, int max_iter)
Construct a new Integrator object.
Definition
Integrator.cpp:6
Integrator::update_params
void update_params(double time_step_size)
Update integrator parameter and system matrices with model parameter updates.
Definition
Integrator.cpp:41
Model
Model of 0D elements.
Definition
Model.h:55
SparseSystem
Sparse system.
Definition
SparseSystem.h:30
State
State of the system.
Definition
State.h:19
Generated by
1.17.0