Skip to content

Solvers ​

Overview ​

MethodFunctionGivesAssumptions
Bloch-Torrey equationsolve_btpdemagnetization, signalnone (reference)
Homogenized ADCsolve_hadc, solve_hadc_tensorsADC, apparent diffusion tensorimpermeable membranes, low b
Matrix formalismsolve_laplace, solve_mfmagnetization, signaltruncated eigenfunction basis
Matrix formalism, effective tensorcompute_mf_diffusion_tensorapparent diffusion tensorlow b
Kärger modelsolve_kargersignalwell mixed compartments
Short diffusion time approximationcompute_adc_staADCshort diffusion times
Analytical matrix formalismsolve_analytical_mfsignallayered 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:

julia
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:

julia
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

julia
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).