Skip to content

Commit

Permalink
Add some docs¨
Browse files Browse the repository at this point in the history
  • Loading branch information
finsberg committed Oct 8, 2024
1 parent 2aa6bf8 commit 181b5fd
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
26 changes: 26 additions & 0 deletions src/circulation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ def deep_update(d, u):


class CirculationModel(ABC):
"""Base class for circulation models
Parameters
----------
parameters : dict[str, Any] | None, optional
Parameters used in the model, by default None which uses the default parameters
add_units : bool, optional
Add units to the parameters, by default False. Note that adding units
will drastically slow down the simulation, so it is recommended to
use this only for testing purposes.
callback : base.CallBack | None, optional
Optional callback function which is called at every time step, by default None.
The callback function take three arguments: the model, the current time,
and a boolean flag `save` which indicates if the current state should be saved.
verbose : bool, optional
Print additional information, by default False
comm : mpi4py.MPI_InterComm optional
MPI communicator, by default None
callback_save_state : base.CallBack | None, optional
Optional callback function called every time the state should be saved, by default None.
The function should take three arguments: the model, the current time, and a boolean
flag `save` which indicates if the current state should be saved.
initial_state : dict[str, float] | None, optional
Initial state of the model, by default None which uses the default initial state
"""

def __init__(
self,
parameters: dict[str, Any] | None = None,
Expand Down
6 changes: 3 additions & 3 deletions src/circulation/bestel.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class BestelActivation:
Notes
-----
The active stress is taken from Bestel et al. [3]_, characterized through
a time-dependent stress function \tau solution to the evolution equation
a time-dependent stress function :math:`\tau` solution to the evolution equation
.. math::
\dot{\tau}(t) = -|a(t)|\tau(t) + \sigma_0|a(t)|_+
being a(\cdot) the activation function and \sigma_0 contractility,
with :math:`a(\cdot)` being the activation function and \sigma_0 contractility,
where each remaining term is described below:
.. math::
Expand Down Expand Up @@ -145,7 +145,7 @@ class BestelPressure:
\dot{p}(t) = -|b(t)|p(t) + \sigma_{\mathrm{mid}}|b(t)|_+
+ \sigma_{\mathrm{pre}}|g_{\mathrm{pre}}(t)|
being b(\cdot) the activation function described below:
with :math:`b(\cdot)` being the activation function described below:
.. math::
b(t) =& a_{\mathrm{pre}}(t) + \alpha_{\mathrm{pre}}g_{\mathrm{pre}}(t)
Expand Down
29 changes: 29 additions & 0 deletions src/circulation/regazzoni2020.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,35 @@ class Regazzoni2020(base.CirculationModel):
closed-loop blood circulation. Part I: model derivation", arXiv (2020)
https://arxiv.org/abs/2011.15040
Parameters
----------
parameters : dict[str, Any] | None, optional
Parameters used in the model, by default None which uses the default parameters
p_LV_func : Callable[[float, float], float] | None, optional
Optional function to calculate the pressure in the LV, by default None.
The function should take the volume in the LV as the first argument and
the time as the second argument, and return the pressure in the LV
p_BiV_func : Callable[[float, float, float], float] | None, optional
Optional function to calculate the pressure in the LV and RV, by default None.
The function should take the volume in the LV as the first argument, the volume
in the RV as the second argument, and the time as the third argument, and return
a tuple (plv, prv) with the pressures in the LV and RV.
add_units : bool, optional
Add units to the parameters, by default False. Note that adding units
will drastically slow down the simulation, so it is recommended to
use this only for testing purposes.
callback : base.CallBack | None, optional
Optional callback function, by default None. The callback function takes
three arguments: the model, the current time, and a boolean flag `save`
which indicates if the current state should be saved.
verbose : bool, optional
Print additional information, by default False
comm : mpi4py.MPI_InterComm optional
MPI communicator, by default None
outdir : Path, optional
Output directory, by default Path("results-regazzoni")
initial_state : dict[str, float] | None, optional
Initial state of the model, by default None which uses the default initial state
"""

def __init__(
Expand Down

0 comments on commit 181b5fd

Please sign in to comment.