Author: Georgina Al-Badri georgina.kennedy.13@ucl.ac.uk
1D and 2D axisymmetric solvers for reaction-advection-diffusion PDE. Also includes applications: parameter sweep, parameter sensitivity analysis (SALib), parameter optimisation (PSO - pyswarms).
This Jupyter notebook displays outputs for an example use of the following code/applications contained in this repository.
This repository contains solvers for a reaction-advection-diffusion PDE in 1D and 2D axisymmetric (r-z axis). The solver files
- Solver1D.py
- Solver2D.py (axisymmetric)
each contain required functions to solve the equations at each timestep as a matrix problem, where the equation has been discretised using finite differences and is solver numerically using spsolve.
Additionally Solver1D.py contains the solver PSOrad_solver_1D, which is equivalent to rad_solver_1D except that it takes only a dictionary argument, for use with particle swarm optimisation (called in PSOMinimiser1D and PSO1D).
The parameter sweep function file
- ParameterSweep1D.py
is an alternative for the 1D model, based on Solver1D, to enable the function to be solved for a range of parameters and/or timepoints to visually compare outcomes.
The manager files
- Manager1D.py
- Manager2D.py
use the appropriate solvers to solve the PDE for given parameters, time and geometry.
Additionally, the repository contains two applications: Sensitivity Analysis and Parameter Optimisation.
The file for sensitivity analysis
- SensitivityAnalysis1D.py
uses the Python library SALib to generate parameter samples, uses multiprocessing Pool to run these samples through the appriate solver, and uses a SALib analyser to generate a graph showing the sensitivity of a particular model outcome to each input parameter.
The files for parameter optimisation
- PSO1D.py
- PSOMinimiser1D.py
use the Python library Pyswarms to optimise input parameters to match a set model outcome. The PSO is run through PSO1D, which minimised the function in Minimiser1D (based on Solver1D.py function PSOrad_solver_1D.py).
c
: soluteu
,v
: x, y components of solvent velocity (1D/2D cartesian)u
,v
: z, r components of solvent velocity (2D axisymmetric)w
: water volume fraction (w=1 if modelling solute in liquid; w<1 if modelling solute in liquid within solid/rigid porous scaffold).
D
: diffusion coefficient of solutealpha
: production rate of solutedelta
: degradation rate of solutekappa
: uptake rate of solution (Michaelis-Menten kinetics)K
: concentration of solute at which uptake is half-maximal (Michaelis-Menten kinetics)dt
: timesteph
: grid spacingL
: height/length of model geometryT
: typical time
Manager*.py
Requires Solver and Preliminary
Solver*.py
Parameter Sweep*.py (uses Solver*.py)
SensitivityAnalysis*.py and PSO*.py
September 2021: All solvers and applications in 1D ready and tested. Next update will bring 2D file structure in line with 1D, and add sesntivity analysis and parameter sweep applications.
Addition of flux boundary conditions projected October 2021.