svZeroDSolver
Loading...
Searching...
No Matches
FlowReferenceBC.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 FlowReferenceBC.h
5 * @brief model::FlowReferenceBC source file
6 */
7#ifndef SVZERODSOLVER_MODEL_FLOWREFERENCEBC_HPP_
8#define SVZERODSOLVER_MODEL_FLOWREFERENCEBC_HPP_
9
10#include "Block.h"
11#include "Parameter.h"
12#include "SparseSystem.h"
13
14/**
15 * @brief Flow reference boundary condition.
16 *
17 * Applies a prescribed flow to a boundary.
18 *
19 * \f[
20 * \begin{circuitikz} \draw
21 * node[left] {$\hat{Q}$} [-latex] (0,0) -- (0.8,0);
22 * \draw (1,0) node[anchor=south]{$P$} to [short, *-] (1.2,0) ;
23 * \draw [-latex] (1.4,0) -- (2.2,0) node[right] {$Q$};
24 * \end{circuitikz}
25 * \f]
26 *
27 * ### Governing equations
28 *
29 * \f[
30 * Q=\hat{Q}
31 * \f]
32 *
33 * ### Local contributions
34 *
35 * \f[
36 * \mathbf{y}^{e}=\left[\begin{array}{ll}P^{e} & Q^{e}\end{array}\right]^{T}
37 * \f]
38 *
39 * \f[
40 * \mathbf{F}^{e}=\left[\begin{array}{ll}0 & 1\end{array}\right]
41 * \f]
42 *
43 * \f[
44 * \mathbf{C}^{e}=\left[\hat{Q}\right]
45 * \f]
46 *
47 * ### Parameters
48 *
49 * Parameter sequence for constructing this block
50 *
51 * * `0` Flow
52 *
53 * ### Internal variables
54 *
55 * This block has no internal variables.
56 *
57 */
58class FlowReferenceBC : public Block {
59 public:
60 /**
61 * @brief Construct a new FlowReferenceBC 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::flow_bc, BlockClass::boundary_condition,
68 {{"t", InputParameter(false, true)},
69 {"Q", InputParameter(false, true)}}) {}
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_FLOWREFERENCEBC_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
FlowReferenceBC(int id, Model *model)
Construct a new FlowReferenceBC object.
Definition FlowReferenceBC.h:66
void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition FlowReferenceBC.cpp:5
void update_constant(SparseSystem &system, std::vector< double > &parameters)
Update the constant contributions of the element in a sparse system.
Definition FlowReferenceBC.cpp:9
void update_time(SparseSystem &system, std::vector< double > &parameters)
Update the time-dependent contributions of the element in a sparse system.
Definition FlowReferenceBC.cpp:14
TripletsContributions num_triplets
Number of triplets of element.
Definition FlowReferenceBC.h:106
Model of 0D elements.
Definition Model.h:48
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