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