comparison benchmark/benchmarks.jl @ 2082:87157cfca640 feature/sbp_operators/laplace_curvilinear

Add benchmarks for laplace on a bunch of different grids
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 25 Feb 2026 14:33:42 +0100
parents 471a948cd2b2
children
comparison
equal deleted inserted replaced
2081:efdc4d9391ee 2082:87157cfca640
4 using Diffinitive.Grids 4 using Diffinitive.Grids
5 using Diffinitive.SbpOperators 5 using Diffinitive.SbpOperators
6 using Diffinitive.LazyTensors 6 using Diffinitive.LazyTensors
7 7
8 using LinearAlgebra 8 using LinearAlgebra
9 using StaticArrays
9 10
10 const SUITE = BenchmarkGroup() 11 const SUITE = BenchmarkGroup()
11 12
12 13
13 sz(d) = ntuple(i->100, d) 14 sz(d) = ntuple(i->100, d)
15 lu(d) = ntuple(i->1., d) 16 lu(d) = ntuple(i->1., d)
16 17
17 g1 = equidistant_grid(ll(1)[1], lu(1)[1], sz(1)...) 18 g1 = equidistant_grid(ll(1)[1], lu(1)[1], sz(1)...)
18 g2 = equidistant_grid(ll(2), lu(2), sz(2)...) 19 g2 = equidistant_grid(ll(2), lu(2), sz(2)...)
19 g3 = equidistant_grid(ll(3), lu(3), sz(3)...) 20 g3 = equidistant_grid(ll(3), lu(3), sz(3)...)
21
22
23 c = Chart(unitsquare()) do (ξ,η)
24 @SVector[2ξ + η*(1-η), 3η+(1+η/2)*ξ^2]
25 end
26 Grids.jacobian(c::typeof(c), (ξ,η)) = @SMatrix[2 1-2η; (2+η)*ξ 3+ξ^2/2]
27
28 g2_curved = equidistant_grid(c, sz(2)...)
20 29
21 v1 = rand(sz(1)...) 30 v1 = rand(sz(1)...)
22 v2 = rand(sz(2)...) 31 v2 = rand(sz(2)...)
23 v3 = rand(sz(3)...) 32 v3 = rand(sz(3)...)
24 33
93 SUITE["derivatives"]["second_derivative_variable"]["3D"]["y"] = @benchmarkable $u3 .= $Dy*$v3 102 SUITE["derivatives"]["second_derivative_variable"]["3D"]["y"] = @benchmarkable $u3 .= $Dy*$v3
94 SUITE["derivatives"]["second_derivative_variable"]["3D"]["z"] = @benchmarkable $u3 .= $Dz*$v3 103 SUITE["derivatives"]["second_derivative_variable"]["3D"]["z"] = @benchmarkable $u3 .= $Dz*$v3
95 104
96 105
97 106
107 SUITE["derivatives"]["laplace"] = BenchmarkGroup()
108
109 Δ = laplace(g1, stencil_set)
110 SUITE["derivatives"]["laplace"]["1D"] = @benchmarkable $u1 .= $Δ*$v1
111
112 Δ = laplace(g2, stencil_set)
113 SUITE["derivatives"]["laplace"]["2D"] = @benchmarkable $u2 .= $Δ*$v2
114
115 Δ = laplace(g2_curved, stencil_set)
116 SUITE["derivatives"]["laplace"]["2D_curved"] = @benchmarkable $u2 .= $Δ*$v2
117
118 Δ = laplace(g3, stencil_set)
119 SUITE["derivatives"]["laplace"]["3D"] = @benchmarkable $u3 .= $Δ*$v3
120
121
98 122
99 SUITE["derivatives"]["addition"] = BenchmarkGroup() 123 SUITE["derivatives"]["addition"] = BenchmarkGroup()
100 124
101 D₁ = first_derivative(g1,stencil_set) 125 D₁ = first_derivative(g1,stencil_set)
102 D₂ = second_derivative(g1,stencil_set) 126 D₂ = second_derivative(g1,stencil_set)