fewjfpwejfew

next
parent cf21d9ca66
commit 96bbdc58d8

@ -1,13 +1,23 @@
using SparseArrays using SparseArrays
using MAT using MAT
# 11 x 16 # 20 x 20 x 20 grid
nx = 11 - 1 nx = 20 - 1
ny = 16 - 1 ny = 20 - 1
nz = 20 - 1
ex = fill(1, nx) ex = fill(1, nx)
ey = fill(1, ny) ey = fill(1, ny)
ez = fill(1, nz)
Dxx = spdiagm(-1 => ex, 0 => -2 * ex, +1 => ex) Dxx = spdiagm(-1 => ex, 0 => -2 * ex, +1 => ex)
Dyy = spdiagm(-1 => ey, 0 => -2 * ey, +1 => ey) Dyy = spdiagm(-1 => ey, 0 => -2 * ey, +1 => ey)
L = kron(Dyy, spdiagm(0 => [ex; 1])) + kron(spdiagm(0 => [ey; 1]), Dxx); Dzz = spdiagm(-1 => ez, 0 => -2 * ez, +1 => ez)
Ix = spdiagm(0 => [ex; 1])
Iy = spdiagm(0 => [ey; 1])
Iz = spdiagm(0 => [ez; 1])
L = kron(Dxx, Iy, Iz) + kron(Ix, Dyy, Iz) + kron(Ix, Iy, Dzz)
matwrite("laplacian-discretization-3d.mat", Dict("A" => L)) matwrite("laplacian-discretization-3d.mat", Dict("A" => L))

Loading…
Cancel
Save