svZeroDSolver
Loading...
Searching...
No Matches
ResistanceBC.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 ResistanceBC.h
32 * @brief model::ResistanceBC source file
33 */
34#ifndef SVZERODSOLVER_MODEL_RESISTANCEBC_HPP_
35#define SVZERODSOLVER_MODEL_RESISTANCEBC_HPP_
36
37#include "Block.h"
38#include "Parameter.h"
39#include "SparseSystem.h"
40
41/**
42 * @brief Resistance boundary condition.
43 *
44 * \f[
45 * \begin{circuitikz} \draw
46 * node[left] {$Q_{in}$} [-latex] (0,0) -- (0.8,0);
47 * \draw (1.0,0) node[anchor=south]{$P_{in}$}
48 * to [R, l=$R$, *-*] (3,0)
49 * node[anchor=south]{$P_{d}$};
50 * \end{circuitikz}
51 * \f]
52 *
53 * ### Governing equations
54 *
55 * \f[
56 * P_{in}-P_d=R \cdot Q_{in}
57 * \f]
58 *
59 * ### Local contributions
60 *
61 * \f[
62 * \mathbf{y}^{e}=\left[\begin{array}{ll}P_{in} & Q_{in}\end{array}\right]^{T}
63 * \f]
64 *
65 * \f[
66 * \mathbf{F}^{e}=\left[\begin{array}{ll}1 & -R\end{array}\right]
67 * \f]
68 *
69 * \f[
70 * \mathbf{C}^{e}=\left[-P_d\right]
71 * \f]
72 *
73 * ### Parameters
74 *
75 * Parameter sequence for constructing this block
76 *
77 * * `0` Resistance
78 * * `1` Distal pressure
79 *
80 * ### Internal variables
81 *
82 * This block has no internal variables.
83 *
84 */
85class ResistanceBC : public Block {
86 public:
87 /**
88 * @brief Construct a new ResistanceBC object
89 *
90 * @param id Global ID of the block
91 * @param model The model to which the block belongs
92 */
94 : Block(id, model, BlockType::resistance_bc,
95 BlockClass::boundary_condition,
96 {{"R", InputParameter()}, {"Pd", InputParameter()}}) {}
97
98 /**
99 * @brief Set up the degrees of freedom (DOF) of the block
100 *
101 * Set \ref global_var_ids and \ref global_eqn_ids of the element based on the
102 * number of equations and the number of internal variables of the
103 * element.
104 *
105 * @param dofhandler Degree-of-freedom handler to register variables and
106 * equations at
107 */
108 void setup_dofs(DOFHandler &dofhandler);
109
110 /**
111 * @brief Update the constant contributions of the element in a sparse system
112 *
113 * @param system System to update contributions at
114 * @param parameters Parameters of the model
115 */
116 void update_constant(SparseSystem &system, std::vector<double> &parameters);
117
118 /**
119 * @brief Update the time-dependent contributions of the element in a sparse
120 * system
121 *
122 * @param system System to update contributions at
123 * @param parameters Parameters of the model
124 */
125 void update_time(SparseSystem &system, std::vector<double> &parameters);
126
127 /**
128 * @brief Number of triplets of element
129 *
130 * Number of triplets that the element contributes to the global system
131 * (relevant for sparse memory reservation)
132 */
134};
135
136#endif // SVZERODSOLVER_MODEL_RESISTANCEBC_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
model::Parameter source file
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
Resistance boundary condition.
Definition ResistanceBC.h:85
void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition ResistanceBC.cpp:33
ResistanceBC(int id, Model *model)
Construct a new ResistanceBC object.
Definition ResistanceBC.h:93
void update_constant(SparseSystem &system, std::vector< double > &parameters)
Update the constant contributions of the element in a sparse system.
Definition ResistanceBC.cpp:37
void update_time(SparseSystem &system, std::vector< double > &parameters)
Update the time-dependent contributions of the element in a sparse system.
Definition ResistanceBC.cpp:42
TripletsContributions num_triplets
Number of triplets of element.
Definition ResistanceBC.h:133
Sparse system.
Definition SparseSystem.h:57
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