Closed navidcy closed 1 year ago
This PR makes the calcF! functions for stochastic forcing faster and with fewer allocations.
calcF!
julia> using BenchmarkTools julia> function calcF!(Fh, sol, t, clock, vars, params, grid) Fh .= sqrt.(forcing_spectrum) .* exp.(2π * im * random_uniform(eltype(grid), size(sol))) ./ sqrt(clock.dt) return nothing end calcF! (generic function with 1 method) julia> function calcF_new!(Fh, sol, t, clock, vars, params, grid) @. Fh = sqrt(forcing_spectrum) * cis(2random_uniform()) / sqrt(clock.dt) return nothing end calcF_new! (generic function with 1 method) julia> @btime calcF!(Fh, sol, t, clock, vars, params, grid) 152.208 μs (14 allocations: 195.33 KiB) julia> @btime calcF_new!(Fh, sol, t, clock, vars, params, grid) 111.416 μs (11 allocations: 240 bytes)
The PR also fixes some links to Makie package in the docs.
This PR makes the
calcF!
functions for stochastic forcing faster and with fewer allocations.The PR also fixes some links to Makie package in the docs.