# Sage Math Tutorial - Cell Growth

The demos below span several related topics:

## Cell Growth

If your are solving a simple 1st or 2nd order ordinary differential equation, you can use desolve() to get an analytical solution. Here we are simulating a system in which cells 'X' grow at a rate proportional to their number, resulting in unbounded exponential growth:

For initial value problems featuring systems of first-order differential equations, try the numerical solver desolve_system_rk4(). In this example, we are simulating a system in which cells 'X' are increasing in concentration by consuming a substrate 'S'; the cells' growth rate 'mu' obeys saturation kinetics with respect to substrate concentration:

For some initial value problems, the 4th-order Runge-Kutta method used by desolve_system_rk4() is insufficient. This will especially be the case when two or more variables are changing on very different time scales, in so-called 'stiff' systems. You can use the versatile ode_solver() class, which can run an adaptive stepsize or implicit version of Euler's Method to successfully solve stiff systems. Graphing the solution is also easier, with the convenient interpolate_solution() method:

Now let's add some more detail to the model: the cellular growth rate 'mu' obeys saturation kinetics, attaining a value of 'mu_max' at high concentations of substrate 'S' and a value of 0.5*mu_max at substrate concentration 'K_m'; the conversion rate of substrate to cells is the growth yield, 'Y'. Try modifying the values of mu_max, K_m, and Y and re-evaluating to see the effect!

## The CSTR

More complex still? First let's simulate a CSTR. The tank starts devoid of 'S', and at time=0 an input stream containing S is started:

How about if the system is fed batch, so Vin occurs in surges?

## CSTR with Reaction

Now let's add a reaction, so that 'S' in the system is consumed with first-order kinetics:

How do things change if we switch from batch feed to continuous feed, intermittent effluent?

## CSTR with Cells

Let's take the fully-continuous system and replace the first-order reaction with cell growth!

Doing the same for the fed batch system, you see that this setup is not particularly chemostatic:

Unlike the fed-batch system, the intermittent effluent system is highly chemostatic:

## Draining a Conical Vessel

A conical vessel draining with controlled constant outflow rate:

A conical vessel draining with uncontrolled gravity flow, in which the outlet flow rate is proportional to the square root of the liquid height. The variable 'k' is proportional to the square root the pressure drop across the orifice, which is itself proportional to fluid density; try changing this value to scale the magnitude of gravity's influence on the system.

A conical vessel draining: controlled constant outflow and uncontrolled gravity flow, superimposed. Try changing 'k'!

## Intercooled CSTR

An immersion-intercooled CSTR. Try changing the convection coefficient 'h'!