8#ifndef SVZERODSOLVER_MODEL_BLOCK_HPP_
9#define SVZERODSOLVER_MODEL_BLOCK_HPP_
29struct TripletsContributions {
30 TripletsContributions() {};
46 TripletsContributions
operator+=(
const TripletsContributions& other) {
85 const std::vector<std::pair<std::string, InputParameter>>
104 std::vector<std::pair<std::string, InputParameter>>
input_params)
188 const std::list<std::string>& internal_var_names);
215 State initial_state, std::vector<double>& parameters);
224 std::vector<double>& parameters);
233 std::vector<double>& parameters);
246 const Eigen::Matrix<double, Eigen::Dynamic, 1>& y,
247 const Eigen::Matrix<double, Eigen::Dynamic, 1>& dy);
254 virtual void post_solve(Eigen::Matrix<double, Eigen::Dynamic, 1>& y);
265 const Eigen::Matrix<double, Eigen::Dynamic, 1>& y);
299 Eigen::Matrix<double, Eigen::Dynamic, 1>& alpha,
300 std::vector<double>& y, std::vector<double>& dy);
Activation function classes for cardiac chamber models.
Active stress models for chamber blocks.
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:45
VesselType
The types of vessel blocks supported.
Definition BlockType.h:58
model::DOFHandler source file
model::Parameter source file
SparseSystem source file.
Material models for the ChamberSphere block.
Base class for 0D model components.
Definition Block.h:78
virtual std::vector< double > get_persistent_state() const
Get persistent internal state of the block.
Definition Block.cpp:69
bool input_params_list
Are input parameters given as a list?
Definition Block.h:92
void setup_params_(const std::vector< int > ¶m_ids)
Setup parameter IDs for the block.
Definition Block.cpp:16
Block(const Block &)=delete
Copy the Block object.
std::vector< int > global_param_ids
Global IDs for the block parameters.
Definition Block.h:126
virtual void accept_timestep(const Eigen::Matrix< double, Eigen::Dynamic, 1 > &y)
Accept a converged time-step.
Definition Block.cpp:66
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:103
const std::vector< std::pair< std::string, InputParameter > > input_params
Map from name to input parameter.
Definition Block.h:86
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:50
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:59
const BlockClass block_class
Class of this block.
Definition Block.h:83
virtual void setup_dofs(DOFHandler &dofhandler)
Set up the degrees of freedom (DOF) of the block.
Definition Block.cpp:46
const int id
Global ID of the block.
Definition Block.h:80
const Model * model
The model to which the block belongs.
Definition Block.h:81
TripletsContributions num_triplets
Number of triplets of element.
Definition Block.h:308
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:56
std::vector< int > global_eqn_ids
Global equation indices of the local element contributions.
Definition Block.h:152
std::vector< Node * > outlet_nodes
Outlet nodes.
Definition Block.h:89
virtual TripletsContributions get_num_triplets()
Get number of triplets of element.
Definition Block.cpp:80
virtual void update_constant(SparseSystem &system, std::vector< double > ¶meters)
Update the constant contributions of the element in a sparse system.
Definition Block.cpp:53
virtual void set_material(std::unique_ptr< SphereMaterial > m)
Set wall material (for ChamberSphere blocks).
Definition Block.h:354
std::vector< Node * > inlet_nodes
Inlet nodes.
Definition Block.h:88
virtual void setup_model_dependent_params()
Setup parameters that depend on the model.
Definition Block.cpp:48
VesselType vessel_type
Vessel type of this block.
Definition Block.h:84
void update_vessel_type(VesselType type)
Update vessel type of the block.
Definition Block.cpp:12
std::vector< int > global_var_ids
Global variable indices of the local element contributions.
Definition Block.h:145
virtual void set_activation_function(std::unique_ptr< ActivationFunction > af)
Set activation function (for chamber blocks that use one).
Definition Block.h:329
virtual void set_persistent_state(const std::vector< double > &state)
Restore persistent internal state of the block.
Definition Block.cpp:71
virtual void post_solve(Eigen::Matrix< double, Eigen::Dynamic, 1 > &y)
Modify the solution after solving it.
Definition Block.cpp:64
bool steady
Toggle steady behavior.
Definition Block.h:91
const BlockType block_type
Type of this block.
Definition Block.h:82
virtual void set_active_stress(std::unique_ptr< ActiveStress > as)
Set active stress model (for chamber blocks that use one).
Definition Block.h:342
std::string get_name() const
Get the name of the block.
Definition Block.cpp:8
virtual void update_gradient(Eigen::SparseMatrix< double > &jacobian, Eigen::Matrix< double, Eigen::Dynamic, 1 > &alpha, std::vector< double > &y, std::vector< double > &dy)
Set the gradient of the block residual with respect to the parameters.
Definition Block.cpp:73
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:20
Degree-of-freedom handler.
Definition DOFHandler.h:21
Model of 0D elements.
Definition Model.h:56
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:29
int E
Contributions to E matrix.
Definition Block.h:60
TripletsContributions(int F, int E, int D)
Set the number of triplets that the element contributes to the global system.
Definition Block.h:38
int F
Contributions to F matrix.
Definition Block.h:56
TripletsContributions operator+=(const TripletsContributions &other)
Set the number of triplets that the element contributes to the global system.
Definition Block.h:46
int D
Contributions to dC/dy matrix.
Definition Block.h:64