Is solving a PDE using ParallelStencil an explicit method?

Hi all, I’m trying to implement diffusion in my 3D Agents.jl agent-based model. The “agents” produce or consume substance at each time step, thus changing the local concentration at their grid position x,y,z. I then run Δt diffusion using a stencil from ParallelStencil.jl’s heat equation example.

function diffusion3D_step!(T2, T, λ, dt, dx, dy, dz)
    @inn(T2) = @inn(T) + dt*(λ*(@d2_xi(T)/dx^2 + @d2_yi(T)/dy^2 + @d2_zi(T)/dz^2));

My question is, does this amount to an explicit method for solving the heat equation? If so, are there any automated methods in the Julia ecosystem that could slot in here that are implicit? Or should I be looking at linear algebra packages to invert a big matrix?

Apologies if this doesn’t really make sense, I am very new to this, thanks for reading.

Hi @jdm204, nice to see your using ParallelStencil.jl in your work. The above snippet represents in this context an explicit update. However, depending on your needs, you could use various iterative-based solution approaches to achieve an implicit solution. Relying on direct-iterative approaches (“inverting a big matrix”) may be a bottleneck in 3D. Some hints about (GPU-friendly) iterative implicit approaches in this paper and this course.


Hi @luraess - that’s incredibly helpful, thank you! ParallelStencil is great.

1 Like