whalenpt / rkstiff

Runge-Kutta adaptive-step solvers for nonlinear PDEs. Solvers include both exponential time differencing and integrating factor methods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow block-diagonal linear operators with diagonalize=True

hippalectryon-0 opened this issue · comments

Use case: we have a lot of degrees of freedom (e.g. N=30000, for example a 3D grid 20x20x20 with 4 fields), but the linear step is diagonal by block with small blocks.

Example equation: homogeneous Rayleigh-Bénard system with variables $u_x,u_y,u_z,\theta$:
$\partial_t u_i + u_j\partial_ju_i + \nabla P = Pr\Delta u_i + RaPr \theta\delta_{i=z}$
$\partial\theta+u_j\partial_j\theta=\Delta \theta+u_z$.

In this system, the linear term for $\theta$ is extremely simple $\mathcal{L}(k_x,k_y,k_z)\theta=-k^2\theta+u_z$. It is block-diagonal with blocks of size 4 (the number of equations).

However, if we use (for instance) EDT35, we have to compute the NxN full matrix of the operator, which is way too big (1e10 elements !!).

Moreover, looking at the code of _ETD35_Diagonalized, it seems to me that all the quantities involved are stable by block diagonalization, so I expect that we could handle gracefully those cases (maybe using scipy.sparse ?).