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 * ### Usage in json configuration file
54 *
55 * "boundary_conditions": [
56 * {
57 * "bc_name": "INFLOW",
58 * "bc_type": "FLOW",
59 * "bc_values": {
60 * "Q": [
61 * 5.0,
62 * 5.0
63 * ],
64 * "t": [
65 * 0.0,
66 * 1.0
67 * ]
68 * }
69 * }
70 * ]
71 *
72 * ### Internal variables
73 *
74 * This block has no internal variables.
75 *
76 */
77class FlowReferenceBC : public Block {
78 public:
79 /**
80 * @brief Construct a new FlowReferenceBC object
81 *
82 * @param id Global ID of the block
83 * @param model The model to which the block belongs
84 */
86 : Block(id, model, BlockType::flow_bc, BlockClass::boundary_condition,
87 {{"t", InputParameter(false, true)},
88 {"Q", InputParameter(false, true)}}) {}
89
90 /**
91 * @brief Set up the degrees of freedom (DOF) of the block
92 *
93 * Set \ref global_var_ids and \ref global_eqn_ids of the element based on the
94 * number of equations and the number of internal variables of the
95 * element.
96 *
97 * @param dofhandler Degree-of-freedom handler to register variables and
98 * equations at
99 */
100 void setup_dofs(DOFHandler& dofhandler);
101
102 /**
103 * @brief Update the constant contributions of the element in a sparse system
104 *
105 * @param system System to update contributions at
106 * @param parameters Parameters of the model
107 */
108 void update_constant(SparseSystem& system, std::vector<double>& parameters);
109
110 /**
111 * @brief Update the time-dependent contributions of the element in a sparse
112 * system
113 *
114 * @param system System to update contributions at
115 * @param parameters Parameters of the model
116 */
117 void update_time(SparseSystem& system, std::vector<double>& parameters);
118
119 /**
120 * @brief Number of triplets of element
121 *
122 * Number of triplets that the element contributes to the global system
123 * (relevant for sparse memory reservation)
124 */
126};
127
128#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:38
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:85
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:125
Model of 0D elements.
Definition Model.h:49
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