JoshuaLampert / DispersiveShallowWater.jl

Structure-preserving numerical methods for dispersive shallow water models
https://joshualampert.github.io/DispersiveShallowWater.jl/
MIT License
15 stars 3 forks source link

Use sparse Cholesky decomposition with `ldiv!` #122

Open JoshuaLampert opened 3 months ago

JoshuaLampert commented 3 months ago

Currently, we use an LU factorization for the BBMBBMEquations1D and BBMBBMVariableEquations1D although the matrix is spd, which means we could use a Cholesky decomposition. We did this because ldiv! was not supported for sparse Cholesky factorizations, see the discussion in https://github.com/JoshuaLampert/DispersiveShallowWater.jl/pull/108#discussion_r1608314166. For the SvaerdKalischEquations1D we use a sparse Cholesky decomposition, but use \ instead of ldiv!, again, because ldiv! was not implemented for sparse Cholesky decompositions. Once https://github.com/JuliaSparse/SparseArrays.jl/pull/547 (thanks for the PR @ranocha!) is available, it should be possible to use a sparse Cholesky decomposition together with ldiv! for all equations. This will be with Julia v1.12.

JoshuaLampert commented 2 months ago

In this case, we could reuse the function solve_system_matrix!, which is currently only used for the Serre-Green-Naghdi equations for the others, too.