Skip to main content
. 2020 Oct 16;11:566303. doi: 10.3389/fphys.2020.566303

Algorithm 1.

Algorithm for simulating activation scenarios

 1:  initialize relative diameters α(0) = 1
 2:  deactivate secondary constraints ϵ = 0
 3:  ν ← 0
 4:  while simulation is running do
 5:       BLOOD FLOW WITH RBC DYNAMICS
 6:       for each time step t=1NΔt(ν) do
 7:           compute q[t] and p[t] based on the current RBC distribution (Equations 1–6)
 8:           move RBCs for a time step Δt
 9:       compute averages 〈q(ν) and 〈p(ν) (Equation 8)
10:      compute ρ(ν) (Equation 28)
11:      update cost function J(ν) (Equation 27)
12:      if J(ν) > tol then
13:           UPDATE RELATIVE DIAMETERS
14:           compute T~n, μ~rel(ν) and T~(ν)α(ν) (Equations 9,25,26)
15:           compute g~(ν)α(ν) and g~(ν)p(ν) (Equations 22,23),
16:           compute J(ν)α(ν) (Equation 29) and J(ν)p(ν) (Equation 30)
17:           compute sensitivity dJ(ν)dα(ν) (Equations 13 and 14)
18:           update parameters α(ν+1) (Equation 12)
19:      else
20:           UPDATE SECONDARY CONSTRAINTS
21:           if ϵ = 0 then
22:               activate secondary constraints, e.g., ϵ = 1
23:           set new ρmin<ρ(ν)
24:      ν ← ν + 1
25:  return final parameters α(ν)