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 * ### Usage in json configuration file
80 *
81 * "boundary_conditions": [
82 * {
83 * "bc_name": "OUT",
84 * "bc_type": "RCR",
85 * "bc_values": {
86 * "C": 0.0001,
87 * "Pd": 0.0,
88 * "Rd": 1000.0,
89 * "Rp": 1000.0
90 * }
91 * }
92 * ]
93 *
94 * ### Internal variables
95 *
96 * Names of internal variables in this block's output:
97 *
98 * * `pressure_c`: Pressure at the capacitor
99 *
100 */
101class WindkesselBC : public Block {
102 public:
103 /**
104 * @brief Construct a new WindkesselBC object
105 *
106 * @param id Global ID of the block
107 * @param model The model to which the block belongs
108 */
110 : Block(id, model, BlockType::windkessel_bc,
111 BlockClass::boundary_condition,
112 {{"Rp", InputParameter()},
113 {"C", InputParameter()},
114 {"Rd", InputParameter()},
115 {"Pd", InputParameter(true)}}) {}
116
117 /**
118 * @brief Set up the degrees of freedom (DOF) of the block
119 *
120 * Set \ref global_var_ids and \ref global_eqn_ids of the element based on the
121 * number of equations and the number of internal variables of the
122 * element.
123 *
124 * @param dofhandler Degree-of-freedom handler to register variables and
125 * equations at
126 */
127 void setup_dofs(DOFHandler& dofhandler);
128
129 /**
130 * @brief Update the constant contributions of the element in a sparse
131 system
132 *
133 * @param system System to update contributions at
134 * @param parameters Parameters of the model
135 */
136 void update_constant(SparseSystem& system, std::vector<double>& parameters);
137
138 /**
139 * @brief Update the time-dependent contributions of the element in a sparse
140 * system
141 *
142 * @param system System to update contributions at
143 * @param parameters Parameters of the model
144 */
145 void update_time(SparseSystem& system, std::vector<double>& parameters);
146
147 /**
148 * @brief Number of triplets of element
149 *
150 * Number of triplets that the element contributes to the global system
151 * (relevant for sparse memory reservation)
152 */
154};
155
156#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:38
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:49
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:153
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:109
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