Hemodynamics · Korakianitis–Shi
TorchCor · hemodynamics module

How the Korakianitis–Shi model works

A simple model of the whole circulation: 4 heart chambers, 4 valves and 6 blood-vessel segments. This page shows what goes in, what comes out, and what each number means for the heart.

01

The circulation is one closed ring

The model splits the circulation into 10 compartments. Each one empties into the next, and the last empties into the first, so no blood is lost. The order is the same as in the code:

Red = oxygen-rich blood, blue = oxygen-poor. Capillaries are included in sat and pat. Click any part to learn more.

PPressure p_*, mmHg

How hard blood is pushed. More volume in a stretchy wall → more pressure.

QFlow q_*, mL/s

Blood leaving per second. It runs from high to low pressure.

VVolume v_*, mL

Blood held in a compartment. It changes by inflow − outflow. The total never changes.

02

One heartbeat, step by step

The model's output for the default patient (60 beats/min). Press play or drag across a plot. Coloured bands are the phases of the beat.

t = 0.000 s
Pressure (mmHg)
Volume (mL)
Valve flow (mL/s)
Contraction A(t), 0 = relaxed, 1 = full
Pressure–volume loop
03

Four building blocks

The model uses only four kinds of piece. Move the sliders to see what each parameter does.

lv · la · rv · ra

A chamber is a balloon that stiffens when it contracts

Relaxed, it fills at low pressure. Contracted, the same volume gives a high pressure, so blood is pushed out.

p = A(t) · Eact · (V − Vref) + Epas · (ekpas(V − Vref) − 1)

Active part: grows with contraction A(t). Passive part: grows steeply as the chamber fills.

In the body: E_act = contractility (how strong the squeeze is). E_pas, k_pas = stiffness when relaxed (high in a stiff heart). Each loop sits between the two curves.
Left ventricle contracted (A = 1)relaxed (A = 0)A = slidermodel's loop
04

Inputs: the parameters

A virtual patient is a list of numbers in KSParam.toml. 42 of them have a range and can be varied. Click a part of the ring to see its parameters.

⚠ sas.v is the blood volume

Not the aortic-root volume: it is the total blood in all six vessels (700 mL). With the chambers, the total is 870 mL.

⚠ Timings are fractions of T

delay, tr, td0, tpww are multiplied by T to get seconds.

⚠ Fixed values are not sampled

Leaks (RRA = 0) never vary, and the CQ ranges cover only healthy valves. Widen them to study valve disease.

All parameters in one table
05

Outputs: what the model gives back

The model repeats beats until they stop changing, then returns the last beat as waveforms and summary numbers.

30 waveforms

A volume, pressure and flow for each compartment: v_lv = LV volume, p_sat = arterial pressure, q_ao = aortic-valve flow. Click to compare.

Summary numbers

Each one is read off a single waveform.

Clinical measures you can read from the waveforms

Shown on example patients with a diseased valve.

07

Under the hood

From the first beat to a steady beat

A run starts from the volumes in the file. Beats are repeated until each one matches the last. Top: LV volume, beat by beat. Bottom: change from the previous beat.

How it is solved

  • Unknowns: 10 volumes and 4 artery flows.
  • Method: Runge–Kutta (4th order): 1000 points per beat, 16 small steps between points.
  • Steady beat: stops when p_pat, q_pat, p_rv, v_rv change by < 0.01% between beats (3 to 30 beats).
  • Speed: on a GPU, thousands of patients run at once.
  • Units: mmHg, mL, s.

✓ same numbers as the Python code

This page runs a JavaScript copy of KSModel.py. On 14 test patients its outputs matched the Python code to within 0.0002%.

Which file does what

parameters
KSParam.toml

Default value and range of each parameter.

sampler
KSSampler.py

Draws virtual patients from the ranges.

case table
KS_param_N.csv

One row per patient.

solver
KSModel.py

Simulates every patient to a steady beat.

outputs
outputs.py

Computes the summary numbers.

korashi.py uses the same vessels and valves, but takes chamber pressures from a 3D heart model.

Differences from the 2006 paper

FeaturePaperThis codeResult
ValvesLeaflets moveOpen or shut instantlyNo dicrotic notch
Valve ring motionModelledNot modelledSmall effect
Relaxed chamberLinear stiffnessExponential stiffnessMore realistic filling
Small vesselsSeparate resistancesAdded into sat.r, pat.rOne resistance per circuit
TimingIn secondsFractions of the beatScales with heart rate