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