svZeroDSolver
Loading...
Searching...
No Matches
FlowReferenceBC.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 FlowReferenceBC.h
32 * @brief model::FlowReferenceBC source file
33 */
34#ifndef SVZERODSOLVER_MODEL_FLOWREFERENCEBC_HPP_
35#define SVZERODSOLVER_MODEL_FLOWREFERENCEBC_HPP_
36
37#include "Block.h"
38#include "Parameter.h"
39#include "SparseSystem.h"
40
41/**
42 * @brief Flow reference boundary condition.
43 *
44 * Applies a prescribed flow to a boundary.
45 *
46 * \f[
47 * \begin{circuitikz} \draw
48 * node[left] {$\hat{Q}$} [-latex] (0,0) -- (0.8,0);
49 * \draw (1,0) node[anchor=south]{$P$} to [short, *-] (1.2,0) ;
50 * \draw [-latex] (1.4,0) -- (2.2,0) node[right] {$Q$};
51 * \end{circuitikz}
52 * \f]
53 *
54 * ### Governing equations
55 *
56 * \f[
57 * Q=\hat{Q}
58 * \f]
59 *
60 * ### Local contributions
61 *
62 * \f[
63 * \mathbf{y}^{e}=\left[\begin{array}{ll}P^{e} & Q^{e}\end{array}\right]^{T}
64 * \f]
65 *
66 * \f[
67 * \mathbf{F}^{e}=\left[\begin{array}{ll}0 & 1\end{array}\right]
68 * \f]
69 *
70 * \f[
71 * \mathbf{C}^{e}=\left[\hat{Q}\right]
72 * \f]
73 *
74 * ### Parameters
75 *
76 * Parameter sequence for constructing this block
77 *
78 * * `0` Flow
79 *
80 * ### Internal variables
81 *
82 * This block has no internal variables.
83 *
84 */
85class FlowReferenceBC : public Block {
86 public:
87 /**
88 * @brief Construct a new FlowReferenceBC 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::flow_bc, BlockClass::boundary_condition,
95 {{"t", InputParameter(false, true)},
96 {"Q", InputParameter(false, true)}}) {}
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_FLOWREFERENCEBC_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
Flow reference boundary condition.
Definition FlowReferenceBC.h:85
FlowReferenceBC(int id, Model *model)
Construct a new FlowReferenceBC object.
Definition FlowReferenceBC.h:93
void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition FlowReferenceBC.cpp:33
void update_constant(SparseSystem &system, std::vector< double > &parameters)
Update the constant contributions of the element in a sparse system.
Definition FlowReferenceBC.cpp:37
void update_time(SparseSystem &system, std::vector< double > &parameters)
Update the time-dependent contributions of the element in a sparse system.
Definition FlowReferenceBC.cpp:42
TripletsContributions num_triplets
Number of triplets of element.
Definition FlowReferenceBC.h:133
Model of 0D elements.
Definition Model.h:75
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