svZeroDSolver
Loading...
Searching...
No Matches
WindkesselBC.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 WindkesselBC.h
5 * @brief model::WindkesselBC source file
6 */
7#ifndef SVZERODSOLVER_MODEL_WINDKESSELBC_HPP_
8#define SVZERODSOLVER_MODEL_WINDKESSELBC_HPP_
9
10#include "Block.h"
11#include "SparseSystem.h"
12
13/**
14 * @brief Windkessel RCR boundary condition.
15 *
16 * Models the mechanical behavior of a Windkessel boundary condition.
17 *
18 * \f[
19 * \begin{circuitikz} \draw
20 * node[left] {$Q_{in}$} [-latex] (0,0) -- (0.8,0);
21 * \draw (1,0) node[anchor=south]{$P_{in}$}
22 * to [R, l=$R_p$, *-] (3,0)
23 * node[anchor=south]{$P_{c}$}
24 * to [R, l=$R_d$, *-*] (5,0)
25 * node[anchor=south]{$P_{ref}$}
26 * (3,0) to [C, l=$C$, *-] (3,-1.5)
27 * node[ground]{};
28 * \end{circuitikz}
29 * \f]
30 *
31 * ### Governing equations
32 *
33 * \f[
34 * R_{d} Q_{in}-P_{c}+P_{r e f}-R_{d} C \frac{d P_{c}}{d t}=0
35 * \f]
36 *
37 * \f[
38 * P_{in}-P_{c}-R_{p} Q_{in}=0
39 * \f]
40 *
41 * ### Local contributions
42 *
43 * \f[
44 * \mathbf{y}^{e}=\left[\begin{array}{lll}P^{e} & Q^{e} &
45 * P_{c}^{e}\end{array}\right]^{T} \f]
46 *
47 * \f[
48 * \mathbf{E}^{e}=\left[\begin{array}{ccc}
49 * 0 & 0 & -R_{d} C \\
50 * 0 & 0 & 0
51 * \end{array}\right]
52 * \f]
53 *
54 * \f[
55 * \mathbf{F}^{e}=\left[\begin{array}{ccc}
56 * 0 & R_{d} & -1 \\
57 * 1 & -R_{p} & -1
58 * \end{array}\right]
59 * \f]
60 *
61 * \f[
62 * \mathbf{c}^{e}=\left[\begin{array}{c}
63 * P_{r e f} \\
64 * 0
65 * \end{array}\right]
66 * \f]
67 *
68 * See \cite vignon04.
69 *
70 * ### Parameters
71 *
72 * Parameter sequence for constructing this block
73 *
74 * * `0` Proximal resistance
75 * * `1` Capacitance
76 * * `2` Distal resistance
77 * * `3` Distal pressure
78 *
79 * ### Internal variables
80 *
81 * Names of internal variables in this block's output:
82 *
83 * * `pressure_c`: Pressure at the capacitor
84 *
85 */
86class WindkesselBC : public Block {
87 public:
88 /**
89 * @brief Construct a new WindkesselBC object
90 *
91 * @param id Global ID of the block
92 * @param model The model to which the block belongs
93 */
95 : Block(id, model, BlockType::windkessel_bc,
96 BlockClass::boundary_condition,
97 {{"Rp", InputParameter()},
98 {"C", InputParameter()},
99 {"Rd", InputParameter()},
100 {"Pd", InputParameter(true)}}) {}
101
102 /**
103 * @brief Set up the degrees of freedom (DOF) of the block
104 *
105 * Set \ref global_var_ids and \ref global_eqn_ids of the element based on the
106 * number of equations and the number of internal variables of the
107 * element.
108 *
109 * @param dofhandler Degree-of-freedom handler to register variables and
110 * equations at
111 */
112 void setup_dofs(DOFHandler &dofhandler);
113
114 /**
115 * @brief Update the constant contributions of the element in a sparse
116 system
117 *
118 * @param system System to update contributions at
119 * @param parameters Parameters of the model
120 */
121 void update_constant(SparseSystem &system, std::vector<double> &parameters);
122
123 /**
124 * @brief Update the time-dependent contributions of the element in a sparse
125 * system
126 *
127 * @param system System to update contributions at
128 * @param parameters Parameters of the model
129 */
130 void update_time(SparseSystem &system, std::vector<double> &parameters);
131
132 /**
133 * @brief Number of triplets of element
134 *
135 * Number of triplets that the element contributes to the global system
136 * (relevant for sparse memory reservation)
137 */
139};
140
141#endif // SVZERODSOLVER_MODEL_WINDKESSELBC_HPP_
model::Block source file
BlockType
The types of blocks supported by the solver.
Definition BlockType.h:15
BlockClass
The classes/categories of blocks supported. Some classes require special handling (e....
Definition BlockType.h:37
SparseSystem source file.
Block(int id, Model *model, BlockType block_type, BlockClass block_class, std::vector< std::pair< std::string, InputParameter > > input_params)
Construct a new Block object.
Definition Block.h:100
const int id
Global ID of the block.
Definition Block.h:77
const Model * model
The model to which the block belongs.
Definition Block.h:78
Model of 0D elements.
Definition Model.h:48
void update_constant(SparseSystem &system, std::vector< double > &parameters)
Update the constant contributions of the element in a sparse system.
Definition WindkesselBC.cpp:9
TripletsContributions num_triplets
Number of triplets of element.
Definition WindkesselBC.h:138
void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition WindkesselBC.cpp:5
void update_time(SparseSystem &system, std::vector< double > &parameters)
Update the time-dependent contributions of the element in a sparse system.
Definition WindkesselBC.cpp:17
WindkesselBC(int id, Model *model)
Construct a new WindkesselBC object.
Definition WindkesselBC.h:94
Handles the properties of input parameters.
Definition Parameter.h:100
The number of triplets that the element contributes to the global system.
Definition Block.h:26