svZeroDSolver
Loading...
Searching...
No Matches
ChamberElastanceInductor Class Reference

Cardiac chamber with linear elastance and inductor. More...

#include <ChamberElastanceInductor.h>

Inheritance diagram for ChamberElastanceInductor:
[legend]

Public Types

enum  ParamId {
  IMPEDANCE = 0 ,
  EMAX = 1 ,
  EMIN = 2 ,
  VRD = 3 ,
  VRS = 4
}
 Local IDs of the parameters (shared indices first). More...

Public Member Functions

 ChamberElastanceInductor (int id, Model *model)
 Construct a new ChamberElastanceInductor object.
void setup_dofs (DOFHandler &dofhandler) override
 Set up the degrees of freedom (DOF) of the block.
void update_constant (SparseSystem &system, std::vector< double > &parameters) override
 Update the constant contributions of the element in a sparse system.
void update_time (SparseSystem &system, std::vector< double > &parameters) override
 Update the time-dependent contributions of the element in a sparse system.
void set_activation_function (std::unique_ptr< ActivationFunction > af) override
 Set activation function (for chamber blocks that use one).
Public Member Functions inherited from Block
 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.
 ~Block ()
 Destroy the Block object.
 Block (const Block &)=delete
 Copy the Block object.
std::string get_name ()
 Get the name of the block.
void update_vessel_type (VesselType type)
 Update vessel type of the block.
void setup_params_ (const std::vector< int > &param_ids)
 Setup parameter IDs for the block.
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.
virtual void setup_model_dependent_params ()
 Setup parameters that depend on the model.
virtual void setup_initial_state_dependent_params (State initial_state, std::vector< double > &parameters)
 Setup parameters that depend on the initial state.
virtual void update_solution (SparseSystem &system, std::vector< double > &parameters, 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.
virtual void post_solve (Eigen::Matrix< double, Eigen::Dynamic, 1 > &y)
 Modify the solution after solving it.
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.
virtual TripletsContributions get_num_triplets ()
 Get number of triplets of element.

Public Attributes

TripletsContributions num_triplets {6, 2, 0}
 Number of triplets of element.
Public Attributes inherited from Block
const int id
 Global ID of the block.
const Modelmodel
 The model to which the block belongs.
const BlockType block_type
 Type of this block.
const BlockClass block_class
 Class of this block.
VesselType vessel_type = VesselType::neither
 Vessel type of this block.
const std::vector< std::pair< std::string, InputParameter > > input_params
 Map from name to input parameter.
std::vector< Node * > inlet_nodes
 Inlet nodes.
std::vector< Node * > outlet_nodes
 Outlet nodes.
bool steady = false
 Toggle steady behavior.
bool input_params_list = false
 Are input parameters given as a list?
std::vector< int > global_param_ids
 Global IDs for the block parameters.
std::vector< int > global_var_ids
 Global variable indices of the local element contributions.
std::vector< int > global_eqn_ids
 Global equation indices of the local element contributions.
TripletsContributions num_triplets
 Number of triplets of element.

Protected Member Functions

 ChamberElastanceInductor (int id, Model *model, BlockType block_type, std::vector< std::pair< std::string, InputParameter > > params)
 Construct a ChamberElastanceInductor with custom block type and parameters. Used by derived classes.
virtual void get_elastance_values (std::vector< double > &parameters)
 Compute elastance and rest volume from activation and parameters.

Protected Attributes

double Elas = 0.0
 Current chamber elastance.
double Vrest = 0.0
 Current rest volume.
double act_ = 0.0
std::unique_ptr< ActivationFunctionactivation_func_
 Activation function.

Detailed Description

Cardiac chamber with linear elastance and inductor.

Models a cardiac chamber as a time-varying capacitor (elastance with specified resting volumes) and an inductor. See [3] (equations 1 and 2). The addition of the inductor is similar to the models in [9] and [5].

This chamber block can be connected to other blocks using junctions.

\‍[\begin{circuitikz} \draw
node[left] {$Q_{in}$} [-latex] (0,0) -- (0.8,0);
\draw (1,0) node[anchor=south]{$P_{in}$}
to (1,0)
node[anchor=south]{}
to [L, l=$L$, *-*] (3,0)
node[anchor=south]{$P_{out}$}
(1,0) to [vC, l=$E$, *-] (1,-1.5)
node[ground]{};
\draw [-latex] (3.2,0) -- (4.0,0) node[right] {$Q_{out}$} ;
\end{circuitikz}
\‍]

Governing equations

\‍[P_{in}-E(t)(V_c-V_{rest})=0
\‍]

\‍[P_{in}-P_{out}-L\dot{Q}_{out}=0
\‍]

\‍[Q_{in}-Q_{out}-\dot{V}_c=0
\‍]

Local contributions

\‍[\mathbf{y}^{e}=\left[\begin{array}{lllll}P_{in} & Q_{in} &
P_{out} & Q_{out} & V_c\end{array}\right]^{T} \‍]

\‍[\mathbf{E}^{e}=\left[\begin{array}{ccccc}
0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & -L & 0\\
0 & 0 & 0 & 0 & -1
\end{array}\right]
\‍]

\‍[\mathbf{F}^{e}=\left[\begin{array}{ccccc}
1 & 0 &  0 & 0  & -E(t) \\
1 & 0 & -1 & 0  & 0 \\
0 & 1 &  0 & -1 & 0
\end{array}\right]
\‍]

\‍[\mathbf{c}^{e}=\left[\begin{array}{c}
E(t) V_{rest} \\
0 \\
0
\end{array}\right]
\‍]

where

\‍[V_{rest}(t)= \{1-A(t)\}(V_{rd}-V_{rs})+V_{rs}
\‍]

\‍[E(t)=(E_{max}-E_{min})A(t) + E_{min}
\‍]

The activation function $A(t)$ is provided as a separate object (e.g. half_cosine, fourier, wrapping_cosine).

Parameters

  • 0 Impedance: Outflow inductance $L$
  • 1 Emax: Maximum elastance
  • 2 Emin: Minimum elastance
  • 3 Vrd: Rest diastolic volume
  • 4 Vrs: Rest systolic volume

Internal variables

  • Vc: Chamber volume

Member Enumeration Documentation

◆ ParamId

Local IDs of the parameters (shared indices first).

Constructor & Destructor Documentation

◆ ChamberElastanceInductor() [1/2]

ChamberElastanceInductor::ChamberElastanceInductor ( int id,
Model * model )
inline

Construct a new ChamberElastanceInductor object.

Parameters
idGlobal ID of the block
modelThe model to which the block belongs

◆ ChamberElastanceInductor() [2/2]

ChamberElastanceInductor::ChamberElastanceInductor ( int id,
Model * model,
BlockType block_type,
std::vector< std::pair< std::string, InputParameter > > params )
inlineprotected

Construct a ChamberElastanceInductor with custom block type and parameters. Used by derived classes.

Parameters
idGlobal ID of the block
modelThe model to which the block belongs
block_typeThe specific block type for the derived class
paramsParameter list for the derived class

Member Function Documentation

◆ get_elastance_values()

void ChamberElastanceInductor::get_elastance_values ( std::vector< double > & parameters)
protectedvirtual

Compute elastance and rest volume from activation and parameters.

Parameters
parametersParameters of the model

Reimplemented in ChamberElastanceInductorExponential.

◆ set_activation_function()

void ChamberElastanceInductor::set_activation_function ( std::unique_ptr< ActivationFunction > af)
overridevirtual

Set activation function (for chamber blocks that use one).

Default no-op. Overridden by ChamberElastanceInductor and LinearElastanceChamber to take ownership of the activation function.

Parameters
afUnique pointer to the activation function (caller transfers ownership)

Reimplemented from Block.

◆ setup_dofs()

void ChamberElastanceInductor::setup_dofs ( DOFHandler & dofhandler)
overridevirtual

Set up the degrees of freedom (DOF) of the block.

Set global_var_ids and global_eqn_ids of the element based on the number of equations and the number of internal variables of the element.

Parameters
dofhandlerDegree-of-freedom handler to register variables and equations at

Reimplemented from Block.

◆ update_constant()

void ChamberElastanceInductor::update_constant ( SparseSystem & system,
std::vector< double > & parameters )
overridevirtual

Update the constant contributions of the element in a sparse system.

Parameters
systemSystem to update contributions at
parametersParameters of the model

Reimplemented from Block.

◆ update_time()

void ChamberElastanceInductor::update_time ( SparseSystem & system,
std::vector< double > & parameters )
overridevirtual

Update the time-dependent contributions of the element in a sparse system.

Parameters
systemSystem to update contributions at
parametersParameters of the model

Reimplemented from Block.

Reimplemented in ChamberElastanceInductorExponential.

Member Data Documentation

◆ act_

double ChamberElastanceInductor::act_ = 0.0
protected

Last computed activation

◆ activation_func_

std::unique_ptr<ActivationFunction> ChamberElastanceInductor::activation_func_
protected

Activation function.

◆ Elas

double ChamberElastanceInductor::Elas = 0.0
protected

Current chamber elastance.

◆ num_triplets

TripletsContributions ChamberElastanceInductor::num_triplets {6, 2, 0}

Number of triplets of element.

◆ Vrest

double ChamberElastanceInductor::Vrest = 0.0
protected

Current rest volume.


The documentation for this class was generated from the following files: