Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
finsberg committed Sep 8, 2024
1 parent e0214ae commit d875690
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parts:
- file: "examples/regazzoni.py"
- file: "examples/zenker.py"
- file: "examples/regazzoni_bleeding.py"
- file: "examples/bestel.py"
- caption: Python API
chapters:
- file: "docs/api"
56 changes: 56 additions & 0 deletions examples/bestel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# # Bestel model

# In this example we will show the both the pressure and activation model from Bestel et al. {cite}`bestel2001biomechanical`.

import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import solve_ivp

from circulation import bestel

# First let us define a time array

t_eval = np.linspace(0, 1, 200)

# Now we will solve the activation model

activation = bestel.BestelActivation()
result_activation = solve_ivp(
activation,
[0, 1],
[0.0],
t_eval=t_eval,
method="Radau",
)

# and plot the results

fig, ax = plt.subplots()
ax.plot(result_activation.t, result_activation.y[0])
ax.set_xlabel("Time [s]")
ax.set_ylabel("Active tension [Pa]")
plt.show()

# Now we will solve the pressure model

pressure = bestel.BestelPressure()
result_pressure = solve_ivp(
pressure,
[0, 1],
[0.0],
t_eval=t_eval,
method="Radau",
)

# and plot the results

fig, ax = plt.subplots()
ax.plot(result_pressure.t, result_pressure.y[0])
ax.set_xlabel("Time [s]")
ax.set_ylabel("Pressure [Pa]")
plt.show()

# # References
# ```{bibliography}
# :filter: docname in docnames
# ```

0 comments on commit d875690

Please sign in to comment.