  We present a finite element scheme for fractional diffusion problems with
varying diffusivity and fractional order. We consider a symmetric integral form
of these nonlocal equations defined on general geometries and in arbitrary
bounded domains. A number of challenges are encountered when discretizing these
equations. The first comes from the heterogeneous kernel singularity in the
fractional integral operator. The second comes from the dense discrete operator
with its quadratic growth in memory footprint and arithmetic operations. An
additional challenge comes from the need to handle volume conditions-the
generalization of classical local boundary conditions to the nonlocal setting.
Satisfying these conditions requires that the effect of the whole domain,
including both the interior and exterior regions, can be computed on every
interior point in the discretization. Performed directly, this would result in
quadratic complexity. To address these challenges, we propose a strategy that
decomposes the stiffness matrix into three components. The first is a sparse
matrix that handles the singular near-field separately and is computed by
adapting singular quadrature techniques available for the homogeneous case to
the case of spatially variable order. The second component handles the
remaining smooth part of the near-field as well as the far field and is
approximated by a hierarchical $\mathcal{H}^{2}$ matrix that maintains linear
complexity in storage and operations. The third component handles the effect of
the global mesh at every node and is written as a weighted mass matrix whose
density is computed by a fast-multipole type method. The resulting algorithm
has therefore overall linear space and time complexity. Analysis of the
consistency of the stiffness matrix is provided and numerical experiments are
conducted to illustrate the convergence and performance of the proposed
algorithm.
