8#ifndef SVZERODSOLVER_MODEL_BLOCK_HPP_
9#define SVZERODSOLVER_MODEL_BLOCK_HPP_
28struct TripletsContributions {
29 TripletsContributions(){};
45 TripletsContributions
operator+=(
const TripletsContributions& other) {
84 const std::vector<std::pair<std::string, InputParameter>>
103 std::vector<std::pair<std::string, InputParameter>>
input_params)
187 const std::list<std::string>& internal_var_names);
214 State initial_state, std::vector<double>& parameters);
223 std::vector<double>& parameters);
232 std::vector<double>& parameters);
245 const Eigen::Matrix<double, Eigen::Dynamic, 1>& y,
246 const Eigen::Matrix<double, Eigen::Dynamic, 1>& dy);
253 virtual void post_solve(Eigen::Matrix<double, Eigen::Dynamic, 1>& y);
266 Eigen::SparseMatrix<double>& jacobian,
267 Eigen::Matrix<double, Eigen::Dynamic, 1>& residual,
268 Eigen::Matrix<double, Eigen::Dynamic, 1>& alpha, std::vector<double>& y,
269 std::vector<double>& dy);
Activation function classes for cardiac chamber models.
Specifies the types of blocks and their parameters.
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:44
VesselType
The types of vessel blocks supported.
Definition BlockType.h:57
model::DOFHandler source file
model::Parameter source file
SparseSystem source file.
Material models for the ChamberSphere block.
bool input_params_list
Are input parameters given as a list?
Definition Block.h:91
void setup_params_(const std::vector< int > ¶m_ids)
Setup parameter IDs for the block.
Definition Block.cpp:14
Block(const Block &)=delete
Copy the Block object.
std::vector< int > global_param_ids
Global IDs for the block parameters.
Definition Block.h:125
~Block()
Destroy the Block object.
Definition Block.cpp:12
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:102
const std::vector< std::pair< std::string, InputParameter > > input_params
Map from name to input parameter.
Definition Block.h:85
std::string get_name()
Get the name of the block.
Definition Block.cpp:8
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:48
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:57
const BlockClass block_class
Class of this block.
Definition Block.h:82
virtual void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition Block.cpp:44
const int id
Global ID of the block.
Definition Block.h:79
const Model * model
The model to which the block belongs.
Definition Block.h:80
TripletsContributions num_triplets
Number of triplets of element.
Definition Block.h:277
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:54
std::vector< int > global_eqn_ids
Global equation indices of the local element contributions.
Definition Block.h:151
std::vector< Node * > outlet_nodes
Outlet nodes.
Definition Block.h:88
virtual TripletsContributions get_num_triplets()
Get number of triplets of element.
Definition Block.cpp:72
virtual void update_constant(SparseSystem &system, std::vector< double > ¶meters)
Update the constant contributions of the element in a sparse system.
Definition Block.cpp:51
virtual void set_material(std::unique_ptr< SphereMaterial > m)
Set wall material (for ChamberSphere blocks).
Definition Block.h:310
std::vector< Node * > inlet_nodes
Inlet nodes.
Definition Block.h:87
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:64
virtual void setup_model_dependent_params()
Setup parameters that depend on the model.
Definition Block.cpp:46
VesselType vessel_type
Vessel type of this block.
Definition Block.h:83
void update_vessel_type(VesselType type)
Update vessel type of the block.
Definition Block.cpp:10
std::vector< int > global_var_ids
Global variable indices of the local element contributions.
Definition Block.h:144
virtual void set_activation_function(std::unique_ptr< ActivationFunction > af)
Set activation function (for chamber blocks that use one).
Definition Block.h:298
virtual void post_solve(Eigen::Matrix< double, Eigen::Dynamic, 1 > &y)
Modify the solution after solving it.
Definition Block.cpp:62
bool steady
Toggle steady behavior.
Definition Block.h:90
const BlockType block_type
Type of this block.
Definition Block.h:81
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:18
Degree-of-freedom handler.
Definition DOFHandler.h:21
Model of 0D elements.
Definition Model.h:55
Node.
Definition Node.h:26
Sparse system.
Definition SparseSystem.h:30
State of the system.
Definition State.h:19
The number of triplets that the element contributes to the global system.
Definition Block.h:28
int E
Contributions to E matrix.
Definition Block.h:59
TripletsContributions(int F, int E, int D)
Set the number of triplets that the element contributes to the global system.
Definition Block.h:37
int F
Contributions to F matrix.
Definition Block.h:55
TripletsContributions operator+=(const TripletsContributions &other)
Set the number of triplets that the element contributes to the global system.
Definition Block.h:45
int D
Contributions to dC/dy matrix.
Definition Block.h:63