trixi-framework / TrixiParticles.jl

TrixiParticles.jl: Particle-based multiphysics simulations in Julia
https://trixi-framework.github.io/TrixiParticles.jl/
MIT License
33 stars 10 forks source link

Factorize correction matrix #135

Closed efaulhaber closed 1 year ago

efaulhaber commented 1 year ago

For the total Lagrangian SPH, it might be faster to store the factorization of the correction matrix instead of storing the inverse.

LasNikas commented 1 year ago

I'm with you. Also, the correction matrix is not only used for the TLSPH but for other schemes as well. This correction matrix is to overcome incomplete kernel support. We didn't need this for fluid, since we have the boundary particles. But for modelling the structure dynamic, the correction matrix is crucial.

It might be reasonable to put this calculation in a separate file.

efaulhaber commented 1 year ago

Update: Factorizing the matrix doesn't make sense here. We work with a small SMatrix, which makes computations extremely fast. Solving L \ v takes 2.8ns for a 2x2 SMatrix L, whereas v * inverse takes 2.5ns, where inverse is the inverse of L. Using an LU decomposition here needs two multiplications, which take twice as long as a result.