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

Open loop coronary boundary condition based on [4]. More...

#include <OpenLoopCoronaryBC.h>

Inheritance diagram for OpenLoopCoronaryBC:
[legend]

Public Member Functions

 OpenLoopCoronaryBC (int id, Model *model)
 Construct a new OpenLoopCoronaryBC object.
void setup_dofs (DOFHandler &dofhandler)
 Set up the degrees of freedom (DOF) of the block.
void setup_initial_state_dependent_params (State initial_state, std::vector< double > &parameters)
 Setup parameters that depend on the initial state.
void update_constant (SparseSystem &system, std::vector< double > &parameters)
 Update the constant contributions of the element in a sparse system.
void update_time (SparseSystem &system, std::vector< double > &parameters)
 Update the time-dependent contributions of the element in a sparse system.
virtual ~OpenLoopCoronaryBC ()=default
 Virtual destructor for proper cleanup in derived classes.
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 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.
virtual void set_activation_function (std::unique_ptr< ActivationFunction > af)
 Set activation function (for chamber blocks that use one).

Public Attributes

TripletsContributions num_triplets {5, 4, 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

 OpenLoopCoronaryBC (int id, Model *model, BlockType block_type, const std::vector< std::pair< std::string, InputParameter > > &input_params)
 Protected constructor for derived classes.
virtual double get_Ram (std::vector< double > &parameters, double time) const
 Get microvascular resistance value.

Protected Attributes

double P_Cim_0 = 0
 Pressure proximal to Cim/Vim at initial state.
double Pim_0 = 0
 Pim at initial state.

Detailed Description

Open loop coronary boundary condition based on [4].

\‍[\begin{circuitikz} \draw
node[left] {$Q_{in}$} [-latex] (0,0) -- (0.8,0);
\draw (1,0) node[anchor=south]{$P_{in}$}
to [R, l=$R_a$, *-*] (3,0)
to [R, l=$R_{am}$, -] (5,0)
node[anchor=south]{$P_{cim}$}
to [R, l=$R_v$, *-*] (7,0)
node[anchor=south]{$P_{v}$}
(5,0) to [C, l=$C_{im} \;V_{im}$, -*] (5,-1.5)
node[left]{$P_{im}$}
(3,0) to [C, l=$C_a$, -*] (3,-1.5)
node[left]{$P_a$};
\end{circuitikz}
\‍]

Governing equations

\begin{eqnarray*}&C_{i m} R_{v} Q_{in}-V_{i m}+C_{i m} \left(-P_{c i m}(0)+P_{i m}(0)-P_{i
m}+P_{v}\right)-C_{i m} R_{v} \frac{d V_{i m}}{d t}-C_{a} C_{i m} R_{v}
\frac{d P_{in}}{d t}+R_{a} C_{a} C_{i m} R_{v} \frac{d Q_{in}}{d t}\\ &+C_{a}
C_{i m} R_{v} \frac{d P_{a}}{d t}=0
\end{eqnarray*}

\begin{eqnarray*}&C_{i m} R_v P_{in}-C_{i m} R_{v} R_{a} Q_{in}-R_{v} V_{i m}-C_{i
m}\left(R_{v}+R_{a m}\right) \left(P_{c i m}(0)-P_{i m}(0)+P_{i
m}\right)-C_{i m} R_{v} R_{a m} \frac{d V_{i m}}{d t} \\ &-R_{a m} V_{i
m}+R_{a m} C_{i m} P_{v}=0 \end{eqnarray*}

Local contributions

\‍[\mathbf{y}^{e}=\left[\begin{array}{lll}P_{in} & Q_{in} & V_{i
m}\end{array}\right]^{T}, \‍]

\‍[\mathbf{E}^{e}=\left[\begin{array}{ccc}-C_{a} C_{i m} R_{v} & R_{a} C_{a}
C_{i m} R_{v} & -C_{i m} R_{v} \\ 0 & 0 & -C_{i m} R_{v} R_{a
m}\end{array}\right] \‍]

\‍[\mathbf{F}^{e}=\left[\begin{array}{ccc}0 & C_{i m} R_{v} & -1 \\C_{i m} R_{v}
& -C_{i m} R_{v} R_{a} & -\left(R_{v}+R_{a m}\right)\end{array}\right] \‍]

\‍[\mathbf{c}^{e}=\left[\begin{array}{c}C_{i m}\left(-P_{i m}+P_{i m}(0)-P_{c i
m}(0)+P_{v}\right)+C_{a} C_{i m} R_{v} \frac{d P_{a}}{d t} \\-C_{i
m}\left(R_{v} + R_{a m}\right)\left(P_{cim}(0)-P_{i m}(0)+P_{i m}\right)+R_{a
m} C_{i m} P_{v}\end{array}\right] \‍]

Assume $P_a=0$.

Parameters

Parameter sequence for constructing this block

  • 0 Ra: Small artery resistance
  • 1 Rv: Venous resistance
  • 2 Ca: Small artery capacitance
  • 3 Cim: Intramyocardial capacitance
  • 4 Pim: Intramyocardial pressure
  • 5 Pv: Venous pressure
  • 6 Ram: Microvascular resistance

Usage in json configuration file

"boundary_conditions": [
    {
        "bc_name": "OUT",
        "bc_type": "CORONARY",
        "bc_values": {
            "Ca": 0.0001,
            "Cc": 0.0001,
            "Pim": [
                1000.0,
                1000.0
            ],
            "P_v": 0.0,
            "Ra1": 100.0,
            "Ra2": 100.0,
            "Rv1": 100.0,
            "t": [
                0.0,
                1.0
            ]
        }
    }
]

Internal variables

Names of internal variables in this block's output:

  • volume_im: Intramyocardial volume

Constructor & Destructor Documentation

◆ OpenLoopCoronaryBC() [1/2]

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

Construct a new OpenLoopCoronaryBC object.

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

◆ ~OpenLoopCoronaryBC()

virtual OpenLoopCoronaryBC::~OpenLoopCoronaryBC ( )
virtualdefault

Virtual destructor for proper cleanup in derived classes.

◆ OpenLoopCoronaryBC() [2/2]

OpenLoopCoronaryBC::OpenLoopCoronaryBC ( int id,
Model * model,
BlockType block_type,
const std::vector< std::pair< std::string, InputParameter > > & input_params )
inlineprotected

Protected constructor for derived classes.

Allows derived classes to specify their own block type and parameters

Parameters
idGlobal ID of the block
modelThe model to which the block belongs
block_typeType of the block
input_paramsInput parameters for the block

Member Function Documentation

◆ get_Ram()

double OpenLoopCoronaryBC::get_Ram ( std::vector< double > & parameters,
double time ) const
protectedvirtual

Get microvascular resistance value.

For the base class, returns constant Ram. Derived classes may override to provide time-varying resistance.

Parameters
parametersParameters of the model
timeCurrent simulation time (unused in base class)
Returns
Microvascular resistance Ram

Reimplemented in OpenLoopCoronaryVarResBC.

◆ setup_dofs()

void OpenLoopCoronaryBC::setup_dofs ( DOFHandler & dofhandler)
virtual

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.

◆ setup_initial_state_dependent_params()

void OpenLoopCoronaryBC::setup_initial_state_dependent_params ( State initial_state,
std::vector< double > & parameters )
virtual

Setup parameters that depend on the initial state.

Parameters
initial_stateThe initial state of the system
parametersThe parameter values vector (at time 0)

Reimplemented from Block.

◆ update_constant()

void OpenLoopCoronaryBC::update_constant ( SparseSystem & system,
std::vector< double > & parameters )
virtual

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 OpenLoopCoronaryBC::update_time ( SparseSystem & system,
std::vector< double > & parameters )
virtual

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.

Member Data Documentation

◆ num_triplets

TripletsContributions OpenLoopCoronaryBC::num_triplets {5, 4, 0}

Number of triplets of element.

Number of triplets that the element contributes to the global system (relevant for sparse memory reservation)

◆ P_Cim_0

double OpenLoopCoronaryBC::P_Cim_0 = 0
protected

Pressure proximal to Cim/Vim at initial state.

◆ Pim_0

double OpenLoopCoronaryBC::Pim_0 = 0
protected

Pim at initial state.


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