biocircuits.rd_solve

biocircuits.rd_solve(c_0_tuple, t, L=1, derivs_0=0, derivs_L=0, diff_coeff_fun=None, diff_coeff_params=(), rxn_fun=None, rxn_params=(), rtol=1.49012e-08, atol=1.49012e-08)

Solve a system of reaction-diffusion equations in space and time.

Parameters
  • c_0_tuple (tuple) – c_0_tuple[i] is a NumPy array of length n_gridpoints with the initial concentrations of chemical species i at the grid points.

  • t (ndarray) – An array of time points for which the solution is desired.

  • L (float) – Total length of the x-domain.

  • derivs_0 (ndarray, shape (n_species)) – derivs_0[i] is the value of dc_i/dx at x = 0.

  • derivs_L (ndarray, shape (n_species)) – derivs_L[i] is the value of dc_i/dx at x = L, the rightmost boundary of the domain of x.

  • diff_coeff_fun (function) – Function of the form diff_coeff_fun(c_tuple, t, x, *diff_coeff_params). Returns an tuple where entry i is a NumPy array containing the diffusion coefficient of species i at the grid points. c_tuple[i] is a NumPy array containing the concentrations of species i at the grid points.

  • diff_coeff_params (arbitrary) – Tuple of parameters to be passed into diff_coeff_fun.

  • rxn_fun (function) – Function of the form rxn_fun(c_tuple, t, *rxn_params). Returns an tuple where entry i is a NumPy array containing the net rate of production of species i by chemical reaction at the grid points. c_tuple[i] is a NumPy array containing the concentrations of species i at the grid poitns.

  • rxn_params (arbitrary) – Tuple of parameters to be passed into rxn_fun.

  • rtol (float) – Relative tolerance for solver. Default os odeint’s default.

  • atol (float) – Absolute tolerance for solver. Default os odeint’s default.

Returns

c_tuple – c_tuple[i] is a NumPy array of shape (len(t), n_gridpoints) with the initial concentrations of chemical species i at the grid points over time.

Return type

tuple

Notes