Adaptive Finite Volume Toolbox¶
This is a toolbox to apply the adaptive finite volume method solving Fokker-Planck equations in economic applications
For an introduction to the finite-volume method, one can read any reference, but one can read [Ahn, 2019] written with the computation of the distribution for the heterogeneous agent models in mind. However, working through the Tutorials should be sufficient for most applications.
The advantages of (adaptive) finite volume method are:
Conservation of mass (of discretized equations)
Positivity of the distribution function
Local interaction of parameters (compared to global approximations such as Chebyshev polynomials)
- More interpretable results from geometric nature of parameters
- Adjusting approximation domain in a natural manner
- Since parameters are local/interpretable in nature, a natural candidate for the function approximation under perturbation methods.
The disadvantages are:
Grid points increase exponentially
- adaptive refinement helps address this issue
Keeping the structure of completely unstructured grid is costly.
Ultimately, the result of the cost-benefit analysis for a particular problem is hard to estimate without testing. The codes/toolbox should shorten the testing time for the finite-volume method for Fokker-Planck equations.
Initialize Gridgrid = afv_grid(n_dim);
Split the grid for the first time:grid.split_init(1, x_cuts);
Set drifts and variances:grid.drift = stuff; grid.diffusion = stuff;
Compute the Transition Matrix:A_FP = grid.compute_transition_matrix_modified(); A_FP_boundary = grid.compute_transition_matrix_boundary(ind, dir, flow, is_left_edge); A_FP = A_FP + A_FP_boundary;
Further refine grids:grid.split(indices);