Solvers
Overview
| Method | Function | Gives | Assumptions |
|---|---|---|---|
| Bloch-Torrey equation | solve_btpde | magnetization, signal | none (reference) |
| Homogenized ADC | solve_hadc, solve_hadc_tensors | ADC, apparent diffusion tensor | impermeable membranes, low b |
| Matrix formalism | solve_laplace, solve_mf | magnetization, signal | truncated eigenfunction basis |
| Matrix formalism, effective tensor | compute_mf_diffusion_tensor | apparent diffusion tensor | low b |
| Kärger model | solve_karger | signal | well mixed compartments |
| Short diffusion time approximation | compute_adc_sta | ADC | short diffusion times |
| Analytical matrix formalism | solve_analytical_mf | signal | layered plates, cylinders, spheres |
The ADC follows from the signals of several b-values with fit_adc, and apparent diffusion tensors from ADCs in several directions with fit_tensors. See Apparent diffusion coefficients for a comparison.
Time stepping
solve_btpde uses a ThetaSolver by default (Crank-Nicolson): one sparse factorization per interval for PGSE-like sequences, and GMRES with a preconditioner for other gradients. The time step is a thousandth of the echo time by default:
u = solve_btpde(model, matrices, gradient, ThetaSolver(; timestep = 50.0))
signal = compute_signal(matrices.M, u)The adaptive ODE solvers of OrdinaryDiffEq are also available, after loading one of its solver packages, for example using OrdinaryDiffEqBDF:
u = solve_btpde(model, matrices, gradient, QNDF(); abstol = 1e-8, reltol = 1e-6)Periodic boundary conditions
The meshes of the samples of periodic tissue (PeriodicBoxECS, VoronoiSetup) are periodic. With
matrices = assemble_matrices(model; periodic = true)the points on opposite faces of the box are identified, and solve_btpde (with ThetaSolver) and solve_hadc use periodic boundary conditions instead of impermeable box faces (see Periodic boundary conditions). The signals and ADCs then do not depend on the position of the cells in the box, and the water of the ECS is not trapped by the box. See Dense tissue with periodic boundary conditions and White matter.
Callbacks
solve_btpde calls the callbacks after each time step: Printer prints information, VTKWriter saves the magnetization for ParaView, and Plotter plots it (see Plotting and output).