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