Blocks Library

Capacitances

Module describing capacitance blocks

class CBlock(pressure: Quantity[float64], capacitance: Quantity[float64], time: Time)

C Block quantities and flux definitions

Figure made with TikZ

C Block scheme

Node 1:

\(Q = - C\dot{P}\)

Discretisation:

\[Q^{n + \frac{1}{2}} = - C\ \frac{P^{n + 1} - P^{n}}{\Delta t^n}\]
pressure: Quantity[float64]

Pressure quantity

capacitance: Quantity[float64]

Block capacitance quantity

time: Time

Simulation time

flux() Any

Compute the flux at local node 1

Returns:

the flux

Return type:

np.float64

dflux_dpressure() Any

Compute the flux at local node 1 partial derivative for pressure

Returns:

the flux derivative

Return type:

np.float64

class RCBlock(pressure_1: Quantity[float64], pressure_2: Quantity[float64], resistance: Quantity[float64], capacitance: Quantity[float64], time: Time)

RC Block quantities and fluxes definitions

Figure made with TikZ

RC Block scheme

Node 1:

\(Q_1 = \frac{P_2 - P_1}{R}\)

Node 2:

\(Q_2 = \frac{P_1 - P_2}{R} - C\dot{P_2}\)

Discretisation:

\[Q_1^{n + \frac{1}{2}} = \frac{P_2^{n + \frac{1}{2}} - P_1^{n + \frac{1}{2}}}{R}\]
\[Q_2^{n + \frac{1}{2}} = \frac{P_1^{n + \frac{1}{2}} - P_2^{n + \frac{1}{2}}}{R} - C\ \frac{P_2^{n + 1} - P_2^{n}}{\Delta t^n}\]
pressure_1: Quantity[float64]

Pressure at local node 1 of the block

pressure_2: Quantity[float64]

Pressure at local node 2 of the block

resistance: Quantity[float64]

Resistance value of the block

capacitance: Quantity[float64]

Capacitor value of the block

time: Time

The simulation time

flux_1() Any

Computes the outlet flux at local node 1.

Returns:

the flux value for current block values

Return type:

np.float64

dflux_1_dpressure_1() Any

Computes the outlet flux at node 1 derivative for pressure_1.

Returns:

the flux derivative for pressure_1

Return type:

np.float64

dflux_1_dpressure_2() Any

Computes the outlet flux at node 1 derivative for pressure_2.

Returns:

the flux derivative for pressure_2

Return type:

np.float64

flux_2() Any

Computes the outlet flux at node 2.

Returns:

the flux value for current block values

Return type:

np.float64

dflux_2_dpressure_1() Any

Computes the outlet flux at node 2 derivative for pressure_1.

Returns:

the flux derivative for pressure_1

Return type:

np.float64

dflux_2_dpressure_2() Any

Computes the outlet flux at node 2 derivative for pressure_2.

Returns:

the flux derivative for pressure_2

Return type:

np.float64

class RCRBlock(pressure_1: Quantity[float64], pressure_2: Quantity[float64], pressure_mid: Quantity[float64], resistance_1: Quantity[float64], capacitance: Quantity[float64], resistance_2: Quantity[float64], time: Time)

RCR Block quantities and flux definitions

Figure made with TikZ

Node 1:

\(Q_1 = \frac{P_{mid} - P_1}{R_1}\)

Node 2:

\(Q_2 = \frac{P_{mid} - P_2}{R_2}\)

Internal equation:

\[\frac{P_1 - P_{mid}}{R_1} + \frac{P_2 - P_{mid}}{R_2} - C\dot{P}_{mid} = 0\]

Discretisation:

\[Q_1^{n + \frac{1}{2}} = \frac{P_{mid}^{n + \frac{1}{2}} - P_1^{n + \frac{1}{2}}}{R_1}\]
\[Q_2^{n + \frac{1}{2}} = \frac{P_{mid}^{n + \frac{1}{2}} - P_2^{n + \frac{1}{2}}}{R_2}\]
\[\frac{P_1^{n + \frac{1}{2}} - P_{mid}^{n + \frac{1}{2}}}{R_1} + \frac{P_2^{n + \frac{1}{2}} - P_{mid}^{n + \frac{1}{2}}}{R_2} - C\ \frac{P_{mid}^{n + 1} - P_{mid}^{n}}{\Delta t^n} = 0\]
pressure_1: Quantity[float64]

Pressure at the input of the block

pressure_2: Quantity[float64]

Pressure at the output of the block

pressure_mid: Quantity[float64]

Pressure at the output of the block

resistance_1: Quantity[float64]

Resistance in value of the block

capacitance: Quantity[float64]

Capacitor value of the block

resistance_2: Quantity[float64]

Resistance out value of the block

time: Time

The simulation time

flux_1() Any

Computes the outlet flux at node 1.

Returns:

the flux value

Return type:

np.float64

dflux_1_dp_1() Any

Computes the outlet flux at node 1 derivative for pressure_1.

Returns:

flux derivative for pressure_1

Return type:

np.float64

dflux_1_dp_mid() Any

Computes the outlet flux at node 1 derivative for pressure_mid.

Returns:

flux derivative for pressure_2

Return type:

np.float64

flux_2() Any

Computes the flux at node 2.

Returns:

the flux value

Return type:

np.float64

dflux_2_dp_mid() Any

Computes the outlet flux at node 2 derivative for pressure_mid.

Returns:

flux derivative for pressure_mid

Return type:

np.float64

dflux_2_dp_2() Any

Computes the outlet flux at node 2 derivative for pressure_2.

Returns:

flux derivative for pressure_2

Return type:

np.float64

pressure_mid_residual() Any

Compute the residual representing dynamics of the mid node pressure.

Returns:

the residual value

Return type:

np.float64

pressure_mid_residual_dp_1() Any

Compute the residual derivative for pressure_1

Returns:

the residual derivative for pressure_1

Return type:

np.float64

pressure_mid_residual_dp_2() Any

Compute the residual derivative for pressure_2

Returns:

the residual derivative for pressure_2

Return type:

np.float64

pressure_mid_residual_dp_mid() Any

Compute the residual derivative for pressure_mid

Returns:

the residual derivative for pressure_mid

Return type:

np.float64

compute_volume_stored() Any

Computes volume stored in the capacitance.

Returns:

volume stored in the capacitance

Return type:

np.float64

Valves

Module describing Valve Blocks

class ValveRLBlock(flux: Quantity[float64], pressure_1: Quantity[float64], pressure_2: Quantity[float64], inductance: Quantity[float64], conductance: Quantity[float64], backward_conductance: Quantity[float64], scheme_ts_flux: Quantity[float64], time: Time)

Describes valve RL block quantities and flux definitions

Figure made with TikZ

Valve RC Scheme

Node 1:

\(Q_1 = - Q\)

Node 2:

\(Q_2 = Q\)

Internal Equations:

\[\begin{split}L\ \dot{Q} + P_2 - P_1 + \begin{cases} RQ \text{ if Q $>$ 0 } \\ R_{\text{back}}Q \text{ else } \end{cases} = 0\end{split}\]

Discretisation:

\[Q_1^{{n + \frac{1}{2}}} = - Q^{{n + \frac{1}{2}}}\]
\[Q_2^{{n + \frac{1}{2}}} = Q^{{n + \frac{1}{2}}}\]
\[\begin{split}L\ \frac{Q^{n + 1} - Q^{n}}{\Delta t^n} + P_2^{n + \frac{1}{2}} - P_1^{n + \frac{1}{2}} + \begin{cases} RQ^{{n + \theta}} \text{ if } Q^{{n + \theta}} > 0 \\ R_{\text{back}}Q^{{n + \theta}} \text{ else } \end{cases} = 0\end{split}\]
flux: Quantity[float64]

Flux traversing the block

pressure_1: Quantity[float64]

Pressure quantity at local node 1

pressure_2: Quantity[float64]

Pressure quantity at local node 2

inductance: Quantity[float64]

Inductance quantity

conductance: Quantity[float64]

Conductance quantity for positive flux

backward_conductance: Quantity[float64]

Conductance quantity for negative flux

scheme_ts_flux: Quantity[float64]

Scheme time shift for flux

time: Time

Simulation time

initialize() None

Override this method to define specific for model initialization.

flux_residual() Any

Compute the residual giving the dynamics on the flux in the valve.

Returns:

the residual value

Return type:

np.float64

flux_residual_dflux() Any

Compute the residual partial derivative for flux

Returns:

the residual partial derivative for flux

Return type:

np.float64

flux_residual_dp1() Any

Compute the residual partial derivative for pressure_1

Returns:

the residual partial derivative for pressure_1

Return type:

np.float64

flux_residual_dp2() Any

Compute the residual partial derivative for pressure_2

Returns:

the residual partial derivative for pressure_2

Return type:

np.float64

flux_1() Any

Compute the block flux at node 1

Returns:

the block flux at node 1

Return type:

np.float64

dflux_1_dflux() Any

Compute the block flux at node 1 partial derivative for flux

Returns:

the block flux at node 1 partial derivative for flux

Return type:

np.float64

flux_2() Any

Compute the block flux at node 2

Returns:

the block flux at node 2

Return type:

np.float64

dflux_2_dflux() Any

Compute the block flux at node 2 partial derivative for flux

Returns:

the block flux at node 2 partial derivative for flux

Return type:

np.float64

Cavities

Describes cavity blocks

class SphericalCavityBlock(disp: Quantity[float64], radius: Quantity[float64], thickness: Quantity[float64], time: Time)

Spherical cavity block implementation

Figure made with TikZ

Spherical Cavity Scheme

Node 1:

\(Q = - \frac {dV(y)}{dt}\)

Discretised:

\(Q^{n + \frac{1}{2}} = - \frac {V(y^{n + 1}) - V(y^{n})}{\Delta t^n}\)

Note

Notice that no dynamics is given on the DOF in the block. Model components of the cavity can access the pressure and give it a dynamics.

disp: Quantity[float64]

Displacement y

radius: Quantity[float64]

Initial Sphere radius R0

thickness: Quantity[float64]

Initial thickness d0

time: Time

time

initialize() None

Initialize block attributes from current quantity values

fluid_volume_current() Any

Compute the current fluid volume in the cavity.

Returns:

the fluid volume

Return type:

np.float64

fluid_volume_new() Any

Compute the new fluid volume in the cavity.

Returns:

the fluid volume

Return type:

np.float64

cavity_flux() Any

Compute the ventricule flux at local node 1.

Returns:

the flux

Return type:

np.float64

dcavity_flux_ddisp() Any

Compute the partial derivative of the cavity flux for disp

Returns:

the flux partial derivative

Return type:

np.float64