2d finite differences implementation for a Numerical Analysis lecture

Hi! I’m new to Julia world and would need some help in the transition from Matlab.
I am teaching a numerical analysis class where I use finite differences on a two dimensional (cartesian but not necessarily square) domain. The Matlab function delsq was very useful as I could then generate the grid by meshgrid, build the FD matrix from it, change boundary conditions to Neumann or Robin to a part of the boundary and also localise the source term, diffusion coeff etc…
I all want are simple teaching codes where I can illustrate all the basic concepts on finite differences in a genuinely 2d implementation (no kronecker of 1d!) - and not black box like in [GitHub - SciML/DifferentialEquations.jl: Multi-language suite for high-performance solvers of differential equations and scientific machine learning (SciML) components]
Has someone already tried that?

Maybe the codes in parallel-gpu-workshop-JuliaCon21/scripts at main · luraess/parallel-gpu-workshop-JuliaCon21 · GitHub can be of use, e.g. here diffusion with a forward euler step parallel-gpu-workshop-JuliaCon21/diffusion_2D_expl.jl at main · luraess/parallel-gpu-workshop-JuliaCon21 · GitHub.

2 Likes

Thanks a lot! This is very useful.