34#ifndef SVZERODSOLVER_MODEL_BLOCK_HPP_
35#define SVZERODSOLVER_MODEL_BLOCK_HPP_
108 const std::vector<std::pair<std::string, InputParameter>>
127 std::vector<std::pair<std::string, InputParameter>>
input_params)
211 const std::list<std::string> &internal_var_names);
238 State initial_state, std::vector<double> ¶meters);
247 std::vector<double> ¶meters);
256 std::vector<double> ¶meters);
269 const Eigen::Matrix<double, Eigen::Dynamic, 1> &y,
270 const Eigen::Matrix<double, Eigen::Dynamic, 1> &dy);
277 virtual void post_solve(Eigen::Matrix<double, Eigen::Dynamic, 1> &y);
290 Eigen::SparseMatrix<double> &jacobian,
291 Eigen::Matrix<double, Eigen::Dynamic, 1> &residual,
292 Eigen::Matrix<double, Eigen::Dynamic, 1> &alpha, std::vector<double> &y,
293 std::vector<double> &dy);
Specifies the types of blocks and their parameters.
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
VesselType
The types of vessel blocks supported.
Definition BlockType.h:77
model::DOFHandler source file
model::Parameter source file
SparseSystem source file.
Base class for 0D model components.
Definition Block.h:101
bool input_params_list
Are input parameters given as a list?
Definition Block.h:115
void setup_params_(const std::vector< int > ¶m_ids)
Setup parameter IDs for the block.
Definition Block.cpp:41
Block(const Block &)=delete
Copy the Block object.
std::vector< int > global_param_ids
Global IDs for the block parameters.
Definition Block.h:149
~Block()
Destroy the Block object.
Definition Block.cpp:39
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:126
const std::vector< std::pair< std::string, InputParameter > > input_params
Map from name to input parameter.
Definition Block.h:109
std::string get_name()
Get the name of the block.
Definition Block.cpp:35
virtual void setup_initial_state_dependent_params(State initial_state, std::vector< double > ¶meters)
Setup parameters that depend on the initial state.
Definition Block.cpp:75
virtual void update_solution(SparseSystem &system, std::vector< double > ¶meters, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &y, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &dy)
Update the solution-dependent contributions of the element in a sparse system.
Definition Block.cpp:84
const BlockClass block_class
Class of this block.
Definition Block.h:106
virtual void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition Block.cpp:71
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
TripletsContributions num_triplets
Number of triplets of element.
Definition Block.h:301
virtual void update_time(SparseSystem &system, std::vector< double > ¶meters)
Update the time-dependent contributions of the element in a sparse system.
Definition Block.cpp:81
std::vector< int > global_eqn_ids
Global equation indices of the local element contributions.
Definition Block.h:175
virtual TripletsContributions get_num_triplets()
Get number of triplets of element.
Definition Block.cpp:99
virtual void update_constant(SparseSystem &system, std::vector< double > ¶meters)
Update the constant contributions of the element in a sparse system.
Definition Block.cpp:78
virtual void update_gradient(Eigen::SparseMatrix< double > &jacobian, Eigen::Matrix< double, Eigen::Dynamic, 1 > &residual, Eigen::Matrix< double, Eigen::Dynamic, 1 > &alpha, std::vector< double > &y, std::vector< double > &dy)
Set the gradient of the block contributions with respect to the parameters.
Definition Block.cpp:91
virtual void setup_model_dependent_params()
Setup parameters that depend on the model.
Definition Block.cpp:73
VesselType vessel_type
Vessel type of this block.
Definition Block.h:107
void update_vessel_type(VesselType type)
Update vessel type of the block.
Definition Block.cpp:37
std::vector< int > global_var_ids
Global variable indices of the local element contributions.
Definition Block.h:168
virtual void post_solve(Eigen::Matrix< double, Eigen::Dynamic, 1 > &y)
Modify the solution after solving it.
Definition Block.cpp:89
std::vector< Node * > outlet_nodes
Outlet nodes.
Definition Block.h:112
bool steady
Toggle steady behavior.
Definition Block.h:114
std::vector< Node * > inlet_nodes
Inlet nodes.
Definition Block.h:111
const BlockType block_type
Type of this block.
Definition Block.h:105
void setup_dofs_(DOFHandler &dofhandler, int num_equations, const std::list< std::string > &internal_var_names)
Set up the degrees of freedom (DOF) of the block.
Definition Block.cpp:45
Degree-of-freedom handler.
Definition DOFHandler.h:48
Model of 0D elements.
Definition Model.h:75
Node.
Definition Node.h:53
Sparse system.
Definition SparseSystem.h:57
State of the system.
Definition State.h:46
The number of triplets that the element contributes to the global system.
Definition Block.h:52
int E
Contributions to E matrix.
Definition Block.h:83
TripletsContributions(int F, int E, int D)
Set the number of triplets that the element contributes to the global system.
Definition Block.h:61
int F
Contributions to F matrix.
Definition Block.h:79
TripletsContributions operator+=(const TripletsContributions &other)
Set the number of triplets that the element contributes to the global system.
Definition Block.h:69
int D
Contributions to dC/dy matrix.
Definition Block.h:87