# Models

Several models are already implemented in the CellBasedModels. You can use them by calling

CBMModels.NameOfModel

and introduced in the Agent using the baseModelInit or baseModelEnd keyord arguments. e.g.

ABM(2,
baseModelInit=[CBMModels.Bacteria2D]
#More arguments...
)

## Soft spheres

Model names
CBMModel.softSpheres2D
CBMModel.softSpheres3D
ParameterScopeDescription
$b$GlobalFloatViscosity of the medium
$\mu$GLobalFloatRelative distance of cell-cell repulsion
$f0$LocalFloatForce of repulsion
$m$LocalFloatMass of the sphere
$r$LocalFloatRadius of the sphere
$vx$, $vy$, $vz$LocalFloatVelocity of sphere
$fx$, $fy$, $fz$LocalFloatInteractionForce of repulsio interaction

The cells are spheroids that behave under the following equations:

$$$m_i\frac{dv_i}{dt} =-bv_i+\sum_j F_{ij}$$$$$$\frac{dx_i}{dt} =v_i$$$

where the force is

$$$F_{ij}= \begin{cases} f0(\frac{r_{ij}}{d_{ij}}-1)(\frac{\mu r_{ij}}{d_{ij}}-1)\frac{(x_i-x_j)}{d_{ij}}\hspace{1cm}if\;d_{ij}<\mu r_{ij}\\ 0\hspace{5cm}otherwise \end{cases}$$$

where $d_{ij}$ is the Euclidean distance and $r_{ij}$ is the sum of both radius.

## Rod-shape agent

Model names
CBMModels.rod2D
ParameterScopeDescriptionNormal values
$kn$GlobalFloatRepulsion strength0.0001
$\gamma n$GlobalFloatNormal velocity friction constant1
$\gamma t$GlobalFloatTangential velocity friction constant1
$\mu cc$GlobalFloatFriction coefficient rod-rod.1
$\beta$GlobalFloatFriction constant.5
$\beta\omega$GlobalFloatAngular friction constant.1
$vx$, $vy$LocalFloatVelocity of rod
$theta$LocalFloatAngle of orientation of the rod
$\omega$LocalFloatAngular velocity of rod
$d$LocalFloatWidth of rod
$l$LocalFloatLength of the rod
$m$LocalFloatMass of the rod
$fx$, $fy$LocalFloatInteractionRepulsion force
$W$LocalFloatInteractionAngular momentum

Model of physical interactions for bacteria modeled as 2D rod-shape like cells. This implementation follows the model of Volfson et al.

The forces that the rods feel are computed by the closest virtual spheres in contact. For a rod of mass $m$.

$$$\bold{f}_{ij}=f_n\bold{n}_{ij}+f_t\bold{v}_t$$$

where $\bold{n}_{ij}$ if the normal vector between between the center of the spheres, defined as $\bold{n}_{ij}=(\bold{r}_i-\bold{r}_j)/r_{ij}$; and the normal and tangential forces are defined as

\begin{aligned} f_n &= k_n\delta^{3/2}-\gamma_n \frac{m}{2}\delta v_n\\ f_t &= -\min(\gamma_t\frac{m}{2}\delta^{1/2},\mu_{cc}f_n) \end{aligned}

and $\delta=d-r_{ij}$, $v_n=\bold{v}_{ij}·\bold{n}_{ij}$ and $\bold{v}_t=\bold{v}_{ij}-v_n\bold{n}_{ij}$.

The equations of for a bacteria $i$ are given by

\begin{aligned} m\ddot{\bold{r}_i} &= \sum_s\bold{f}_{s}-\beta m \bold{v}\\ \bold{I}·\dot{\bold{\omega}}_i &= \sum_s(\bold{r}_s-\bold{r_i})\times\bold{f}_s - \beta_\omega\omega \end{aligned}

where $s$ denotes for the sum over the virtual interacting spheres acting on bacteria $i$ and $\bold{I}$ is the tensor of inertia of a cylinder.

### Functions assotiated with the model

Here you may find functions that the defined model uses to compute it and can be used and modify it to make your own models.

Missing docstring.

Missing docstring for CBMModels.rodForces. Check Documenter's build log for details.

Missing docstring.

Missing docstring for CBMMetrics.rodIntersection. Check Documenter's build log for details.