svZeroDSolver
Loading...
Searching...
No Matches
WindkesselBC.h
Go to the documentation of this file.
1// Copyright (c) Stanford University, The Regents of the University of
2// California, and others.
3//
4// All Rights Reserved.
5//
6// See Copyright-SimVascular.txt for additional details.
7//
8// Permission is hereby granted, free of charge, to any person obtaining
9// a copy of this software and associated documentation files (the
10// "Software"), to deal in the Software without restriction, including
11// without limitation the rights to use, copy, modify, merge, publish,
12// distribute, sublicense, and/or sell copies of the Software, and to
13// permit persons to whom the Software is furnished to do so, subject
14// to the following conditions:
15//
16// The above copyright notice and this permission notice shall be included
17// in all copies or substantial portions of the Software.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30/**
31 * @file WindkesselBC.h
32 * @brief model::WindkesselBC source file
33 */
34#ifndef SVZERODSOLVER_MODEL_WINDKESSELBC_HPP_
35#define SVZERODSOLVER_MODEL_WINDKESSELBC_HPP_
36
37#include "Block.h"
38#include "SparseSystem.h"
39
40/**
41 * @brief Windkessel RCR boundary condition.
42 *
43 * Models the mechanical behavior of a Windkessel boundary condition.
44 *
45 * \f[
46 * \begin{circuitikz} \draw
47 * node[left] {$Q_{in}$} [-latex] (0,0) -- (0.8,0);
48 * \draw (1,0) node[anchor=south]{$P_{in}$}
49 * to [R, l=$R_p$, *-] (3,0)
50 * node[anchor=south]{$P_{c}$}
51 * to [R, l=$R_d$, *-*] (5,0)
52 * node[anchor=south]{$P_{ref}$}
53 * (3,0) to [C, l=$C$, *-] (3,-1.5)
54 * node[ground]{};
55 * \end{circuitikz}
56 * \f]
57 *
58 * ### Governing equations
59 *
60 * \f[
61 * R_{d} Q_{in}-P_{c}+P_{r e f}-R_{d} C \frac{d P_{c}}{d t}=0
62 * \f]
63 *
64 * \f[
65 * P_{in}-P_{c}-R_{p} Q_{in}=0
66 * \f]
67 *
68 * ### Local contributions
69 *
70 * \f[
71 * \mathbf{y}^{e}=\left[\begin{array}{lll}P^{e} & Q^{e} &
72 * P_{c}^{e}\end{array}\right]^{T} \f]
73 *
74 * \f[
75 * \mathbf{E}^{e}=\left[\begin{array}{ccc}
76 * 0 & 0 & -R_{d} C \\
77 * 0 & 0 & 0
78 * \end{array}\right]
79 * \f]
80 *
81 * \f[
82 * \mathbf{F}^{e}=\left[\begin{array}{ccc}
83 * 0 & R_{d} & -1 \\
84 * 1 & -R_{p} & -1
85 * \end{array}\right]
86 * \f]
87 *
88 * \f[
89 * \mathbf{c}^{e}=\left[\begin{array}{c}
90 * P_{r e f} \\
91 * 0
92 * \end{array}\right]
93 * \f]
94 *
95 * See \cite vignon04.
96 *
97 * ### Parameters
98 *
99 * Parameter sequence for constructing this block
100 *
101 * * `0` Proximal resistance
102 * * `1` Capacitance
103 * * `2` Distal resistance
104 * * `3` Distal pressure
105 *
106 * ### Internal variables
107 *
108 * Names of internal variables in this block's output:
109 *
110 * * `pressure_c`: Pressure at the capacitor
111 *
112 */
113class WindkesselBC : public Block {
114 public:
115 /**
116 * @brief Construct a new WindkesselBC object
117 *
118 * @param id Global ID of the block
119 * @param model The model to which the block belongs
120 */
122 : Block(id, model, BlockType::windkessel_bc,
123 BlockClass::boundary_condition,
124 {{"Rp", InputParameter()},
125 {"C", InputParameter()},
126 {"Rd", InputParameter()},
127 {"Pd", InputParameter(true)}}) {}
128
129 /**
130 * @brief Set up the degrees of freedom (DOF) of the block
131 *
132 * Set \ref global_var_ids and \ref global_eqn_ids of the element based on the
133 * number of equations and the number of internal variables of the
134 * element.
135 *
136 * @param dofhandler Degree-of-freedom handler to register variables and
137 * equations at
138 */
139 void setup_dofs(DOFHandler &dofhandler);
140
141 /**
142 * @brief Update the constant contributions of the element in a sparse
143 system
144 *
145 * @param system System to update contributions at
146 * @param parameters Parameters of the model
147 */
148 void update_constant(SparseSystem &system, std::vector<double> &parameters);
149
150 /**
151 * @brief Update the time-dependent contributions of the element in a sparse
152 * system
153 *
154 * @param system System to update contributions at
155 * @param parameters Parameters of the model
156 */
157 void update_time(SparseSystem &system, std::vector<double> &parameters);
158
159 /**
160 * @brief Number of triplets of element
161 *
162 * Number of triplets that the element contributes to the global system
163 * (relevant for sparse memory reservation)
164 */
166};
167
168#endif // SVZERODSOLVER_MODEL_WINDKESSELBC_HPP_
model::Block source file
BlockType
The types of blocks supported by the solver.
Definition BlockType.h:42
BlockClass
The classes/categories of blocks supported. Some classes require special handling (e....
Definition BlockType.h:64
SparseSystem source file.
Base class for 0D model components.
Definition Block.h:101
const int id
Global ID of the block.
Definition Block.h:103
const Model * model
The model to which the block belongs.
Definition Block.h:104
Degree-of-freedom handler.
Definition DOFHandler.h:48
Model of 0D elements.
Definition Model.h:75
Sparse system.
Definition SparseSystem.h:88
Windkessel RCR boundary condition.
Definition WindkesselBC.h:113
void update_constant(SparseSystem &system, std::vector< double > &parameters)
Update the constant contributions of the element in a sparse system.
Definition WindkesselBC.cpp:37
TripletsContributions num_triplets
Number of triplets of element.
Definition WindkesselBC.h:165
void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition WindkesselBC.cpp:33
void update_time(SparseSystem &system, std::vector< double > &parameters)
Update the time-dependent contributions of the element in a sparse system.
Definition WindkesselBC.cpp:45
WindkesselBC(int id, Model *model)
Construct a new WindkesselBC object.
Definition WindkesselBC.h:121
Handles the properties of input parameters.
Definition Parameter.h:127
The number of triplets that the element contributes to the global system.
Definition Block.h:52